diff --git a/backend/bmp.c b/backend/bmp.c index 24b7a9bd..7baaea5a 100644 --- a/backend/bmp.c +++ b/backend/bmp.c @@ -36,6 +36,10 @@ #include "common.h" #include "bmp.h" /* Bitmap header structure */ #include +#ifdef _MSC_VER +#include +#include +#endif #define SSET "0123456789ABCDEF" @@ -46,6 +50,8 @@ int bmp_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width unsigned int data_size; unsigned char *bitmap_file_start, *bmp_posn; FILE *bmp_file; + bitmap_file_header_t file_header; + bitmap_info_header_t info_header; switch (rotate_angle) { case 0: @@ -184,9 +190,6 @@ int bmp_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width data_size = symbol->bitmap_height * row_size; symbol->bitmap_byte_length = data_size; - bitmap_file_header_t file_header; - bitmap_info_header_t info_header; - file_header.header_field = 0x4d42; // "BM" file_header.file_size = sizeof(bitmap_file_header_t) + sizeof(bitmap_info_header_t) + data_size; file_header.reserved = 0; diff --git a/backend/bmp.h b/backend/bmp.h index 663aadc4..ea20b47d 100644 --- a/backend/bmp.h +++ b/backend/bmp.h @@ -36,14 +36,23 @@ extern "C" { #endif -#include +#ifdef _MSC_VER +#include +#include "stdint_msvc.h" +#else +#include +#endif typedef struct bitmap_file_header { uint16_t header_field; uint32_t file_size; uint32_t reserved; uint32_t data_offset; - } __attribute__((__packed__ )) bitmap_file_header_t; + } +#ifdef __GNUC__ + __attribute__((__packed__ )) +#endif + bitmap_file_header_t; typedef struct bitmap_info_header { uint32_t header_size; @@ -57,7 +66,11 @@ extern "C" { int32_t vert_res; uint32_t colours; uint32_t important_colours; - } __attribute__((__packed__ )) bitmap_info_header_t; + } +#ifdef __GNUC__ + __attribute__((__packed__ )) +#endif + bitmap_info_header_t; #ifdef __cplusplus } diff --git a/backend/maxihex.h b/backend/maxihex.h index 7888e212..ea294478 100644 --- a/backend/maxihex.h +++ b/backend/maxihex.h @@ -1,4 +1,4 @@ -/* maxipng.h - Shapes for Maxicode output to PNG file */ +/* maxihex.h - Shapes for Maxicode output to PNG file */ /* libzint - the open source barcode library diff --git a/backend/pcx.c b/backend/pcx.c index 6d2de070..c0c71a95 100644 --- a/backend/pcx.c +++ b/backend/pcx.c @@ -35,7 +35,11 @@ #include #include "common.h" #include "pcx.h" /* PCX header structure */ -#include +#include +#ifdef _MSC_VER +#include +#include +#endif #define SSET "0123456789ABCDEF" @@ -45,11 +49,16 @@ int pcx_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width int row, column, i, colour; int run_count; FILE *pcx_file; + pcx_header_t header; +#ifdef _MSC_VER + char* rotated_bitmap; + unsigned char* rle_row; +#endif #ifndef _MSC_VER char rotated_bitmap[image_height * image_width]; #else - char* rotated_bitmap = (char *) _alloca((image_height * image_width) * sizeof(char)); + rotated_bitmap = (char *) _alloca((image_height * image_width) * sizeof(char)); #endif /* _MSC_VER */ switch (rotate_angle) { @@ -68,7 +77,7 @@ int pcx_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width #ifndef _MSC_VER unsigned char rle_row[symbol->bitmap_width]; #else - unsignd char* rle_row = (unsigned char *) _alloca((symbol->bitmap_width * 6) * sizeof(unsigned char)); + rle_row = (unsigned char *) _alloca((symbol->bitmap_width * 6) * sizeof(unsigned char)); #endif /* _MSC_VER */ /* sort out colour options */ @@ -137,7 +146,6 @@ int pcx_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width break; } - pcx_header_t header; header.manufacturer = 10; // ZSoft header.version = 5; // Version 3.0 diff --git a/backend/pcx.h b/backend/pcx.h index 3d816d3d..0ae9f955 100644 --- a/backend/pcx.h +++ b/backend/pcx.h @@ -36,7 +36,12 @@ extern "C" { #endif -#include +#ifdef _MSC_VER +#include +#include "stdint_msvc.h" +#else +#include +#endif typedef struct pcx_header { uint8_t manufacturer; @@ -57,7 +62,11 @@ extern "C" { uint16_t horiz_screen_size; uint16_t vert_screen_size; uint8_t filler[54]; - } __attribute__((__packed__ )) pcx_header_t; + } +#ifdef __GNUC__ + __attribute__((__packed__ )) +#endif + pcx_header_t; #ifdef __cplusplus } diff --git a/backend/stdint_msvc.h b/backend/stdint_msvc.h new file mode 100644 index 00000000..52f4e05c --- /dev/null +++ b/backend/stdint_msvc.h @@ -0,0 +1,52 @@ +/* stdint_msvc.h - definitions for libzint + + libzint - the open source barcode library + Copyright (C) 2009-2016 Robin Stuart + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the project nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + */ + +#ifndef STDINT_MSVC_H +#define STDINT_MSVC_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifdef _MSC_VER + +typedef BYTE uint8_t; +typedef WORD uint16_t; +typedef DWORD uint32_t; +typedef INT32 int32_t; + +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* STDINT_MSVC_H */ diff --git a/backend_qt4/backend_qt4.pro b/backend_qt4/backend_qt4.pro index 085e2b0d..e3c9971e 100644 --- a/backend_qt4/backend_qt4.pro +++ b/backend_qt4/backend_qt4.pro @@ -53,6 +53,7 @@ SOURCES += qrencode/bitstream.c \ } HEADERS += ../backend/aztec.h \ + ../backend/bmp.h \ ../backend/code49.h \ ../backend/common.h \ ../backend/composite.h \ @@ -63,17 +64,20 @@ HEADERS += ../backend/aztec.h \ ../backend/hanxin.h \ ../backend/large.h \ ../backend/maxicode.h \ - ../backend/maxipng.h \ + ../backend/maxihex.h \ + ../backend/pcx.h \ ../backend/pdf417.h \ ../backend/reedsol.h \ ../backend/rss.h \ ../backend/sjis.h \ + ../backend/stdint_msvc.h \ ../backend/zint.h \ qzint.h SOURCES += ../backend/2of5.c \ ../backend/auspost.c \ ../backend/aztec.c \ + ../backend/bmp.c \ ../backend/code.c \ ../backend/code128.c \ ../backend/code16k.c \ @@ -89,10 +93,12 @@ SOURCES += ../backend/2of5.c \ ../backend/library.c \ ../backend/maxicode.c \ ../backend/medical.c \ + ../backend/pcx.c \ ../backend/pdf417.c \ ../backend/plessey.c \ ../backend/postal.c \ ../backend/ps.c \ + ../backend/raster.c \ ../backend/reedsol.c \ ../backend/render.c \ ../backend/rss.c \ diff --git a/backend_qt4/backend_vc8.pro b/backend_qt4/backend_vc8.pro index e5564faa..7a7a12ab 100644 --- a/backend_qt4/backend_vc8.pro +++ b/backend_qt4/backend_vc8.pro @@ -29,7 +29,7 @@ HEADERS += ../backend/aztec.h \ ../backend/gs1.h \ ../backend/large.h \ ../backend/maxicode.h \ - ../backend/maxipng.h \ + ../backend/maxihex.h \ ../backend/ms_stdint.h \ ../backend/pdf417.h \ ../backend/qr.h \ diff --git a/win32/zint_cmdline_vc6/zint_cmdline_vc6.dsp b/win32/zint_cmdline_vc6/zint_cmdline_vc6.dsp index 26ee9386..b4b19b5a 100644 --- a/win32/zint_cmdline_vc6/zint_cmdline_vc6.dsp +++ b/win32/zint_cmdline_vc6/zint_cmdline_vc6.dsp @@ -100,6 +100,10 @@ SOURCE=..\..\backend\aztec.c # End Source File # Begin Source File +SOURCE=..\..\backend\bmp.c +# End Source File +# Begin Source File + SOURCE=..\..\backend\code.c # End Source File # Begin Source File @@ -176,6 +180,10 @@ SOURCE=..\..\backend\medical.c # End Source File # Begin Source File +SOURCE=..\..\backend\pcx.c +# End Source File +# Begin Source File + SOURCE=..\..\backend\pdf417.c # End Source File # Begin Source File @@ -200,6 +208,10 @@ SOURCE=..\..\backend\qr.c # End Source File # Begin Source File +SOURCE=..\..\backend\raster.c +# End Source File +# Begin Source File + SOURCE=..\..\backend\reedsol.c # End Source File # Begin Source File