mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Make bakcend/dotcode.c, emf.c and tif.c compile with MS-VC6
This commit is contained in:
parent
939d4de4f0
commit
480e514754
@ -1088,6 +1088,7 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length
|
||||
#else
|
||||
char* dot_stream;
|
||||
char* dot_array;
|
||||
unsigned char* masked_codeword_array;
|
||||
unsigned char* codeword_array = (unsigned char *) _alloca(length * 3 * sizeof (unsigned char));
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
@ -1200,7 +1201,7 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length
|
||||
#ifndef _MSC_VER
|
||||
unsigned char masked_codeword_array[data_length + 1 + ecc_length];
|
||||
#else
|
||||
unsigned char* masked_codeword_array = (unsigned char *) _alloca((data_length + 1 + ecc_length) * sizeof (unsigned char));
|
||||
masked_codeword_array = (unsigned char *) _alloca((data_length + 1 + ecc_length) * sizeof (unsigned char));
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* Evaluate data mask options */
|
||||
|
@ -155,14 +155,6 @@ int emf_plot(struct zint_symbol *symbol) {
|
||||
unsigned char output_buffer[12];
|
||||
uint32_t dx;
|
||||
|
||||
#ifndef _MSC_VER
|
||||
unsigned char local_text[bump_up(ustrlen(symbol->text) + 1)];
|
||||
unsigned char string_buffer[2 * bump_up(ustrlen(symbol->text) + 1)];
|
||||
#else
|
||||
unsigned char* local_text = (unsigned char*) malloc(bump_up(ustrlen(symbol->text) + 1));
|
||||
unsigned char* string_buffer = (unsigned char*) malloc(2 * (bump_up(ustrlen(symbol->text) + 1));
|
||||
#endif
|
||||
|
||||
emr_header_t emr_header;
|
||||
emr_eof_t emr_eof;
|
||||
emr_createbrushindirect_t emr_createbrushindirect_fg;
|
||||
@ -181,15 +173,28 @@ int emf_plot(struct zint_symbol *symbol) {
|
||||
|
||||
box_t box;
|
||||
|
||||
row_height = 0;
|
||||
textdone = 0;
|
||||
comp_offset = 0;
|
||||
this_rectangle = 0;
|
||||
this_circle = 0;
|
||||
this_hexagon = 0;
|
||||
dx = 0;
|
||||
latch = 0;
|
||||
|
||||
#ifndef _MSC_VER
|
||||
unsigned char local_text[bump_up(ustrlen(symbol->text) + 1)];
|
||||
unsigned char string_buffer[2 * bump_up(ustrlen(symbol->text) + 1)];
|
||||
#else
|
||||
unsigned char* local_text;
|
||||
unsigned char* string_buffer;
|
||||
emr_rectangle_t *rectangle, *row_binding;
|
||||
emr_ellipse_t* circle;
|
||||
emr_polygon_t* hexagon;
|
||||
local_text = (unsigned char*) _alloca(bump_up(ustrlen(symbol->text) + 1) * sizeof (unsigned char));
|
||||
string_buffer = (unsigned char*) _alloca(2 * bump_up(ustrlen(symbol->text) + 1) * sizeof (unsigned char));
|
||||
#endif
|
||||
|
||||
row_height = 0;
|
||||
textdone = 0;
|
||||
comp_offset = 0;
|
||||
this_rectangle = 0;
|
||||
this_circle = 0;
|
||||
this_hexagon = 0;
|
||||
dx = 0;
|
||||
latch = 0;
|
||||
|
||||
for(i = 0; i < 6; i++) {
|
||||
regw[i] = '\0';
|
||||
regx[i] = '\0';
|
||||
@ -234,21 +239,11 @@ int emf_plot(struct zint_symbol *symbol) {
|
||||
|
||||
if (strlen(symbol->fgcolour) != 6) {
|
||||
strcpy(symbol->errtxt, "Malformed foreground colour target (F41)");
|
||||
#ifdef _MSC_VER
|
||||
free(local_text);
|
||||
free(string_buffer);
|
||||
free(dx_buffer);
|
||||
#endif
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if (strlen(symbol->bgcolour) != 6) {
|
||||
strcpy(symbol->errtxt, "Malformed background colour target (F42)");
|
||||
#ifdef _MSC_VER
|
||||
free(local_text);
|
||||
free(string_buffer);
|
||||
free(dx_buffer);
|
||||
#endif
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
@ -328,10 +323,10 @@ int emf_plot(struct zint_symbol *symbol) {
|
||||
emr_ellipse_t circle[circle_count];
|
||||
emr_polygon_t hexagon[hexagon_count];
|
||||
#else
|
||||
rectangle = (emr_rectangle_t*) malloc(rectangle_count);
|
||||
row_binding = (emr_rectangle_t*) malloc(rectangle_count);
|
||||
circle = (emr_ellipse_t*) malloc(circle_count);
|
||||
hexagon = (emr_polygon_t*) malloc(hexagon_count);
|
||||
rectangle = (emr_rectangle_t*) _alloca(rectangle_count*sizeof(emr_rectangle_t));
|
||||
row_binding = (emr_rectangle_t*) _alloca((symbol->rows - 1)*sizeof(emr_rectangle_t));
|
||||
circle = (emr_ellipse_t*) _alloca(circle_count*sizeof(emr_ellipse_t));
|
||||
hexagon = (emr_polygon_t*) _alloca(hexagon_count*sizeof(emr_polygon_t));
|
||||
#endif
|
||||
|
||||
/* Header */
|
||||
@ -1021,15 +1016,6 @@ int emf_plot(struct zint_symbol *symbol) {
|
||||
}
|
||||
if (emf_file == NULL) {
|
||||
strcpy(symbol->errtxt, "Could not open output file (F40)");
|
||||
#ifdef _MSC_VER
|
||||
free(local_text);
|
||||
free(string_buffer);
|
||||
free(dx_buffer);
|
||||
free(rectangle);
|
||||
free(row_binding);
|
||||
free(circle);
|
||||
free(hexagon);
|
||||
#endif
|
||||
return ZINT_ERROR_FILE_ACCESS;
|
||||
}
|
||||
|
||||
@ -1231,16 +1217,5 @@ int emf_plot(struct zint_symbol *symbol) {
|
||||
} else {
|
||||
fclose(emf_file);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
free(local_text);
|
||||
free(string_buffer);
|
||||
free(dx_buffer);
|
||||
free(rectangle);
|
||||
free(row_binding);
|
||||
free(circle);
|
||||
free(hexagon);
|
||||
#endif
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
@ -57,6 +57,10 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
int free_memory;
|
||||
int row, column;
|
||||
FILE *tif_file;
|
||||
#ifdef _MSC_VER
|
||||
uint32_t* strip_offset;
|
||||
uint32_t* strip_bytes;
|
||||
#endif
|
||||
|
||||
tiff_header_t header;
|
||||
tiff_ifd_t ifd;
|
||||
@ -84,8 +88,8 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
uint32_t strip_offset[strip_count];
|
||||
uint32_t strip_bytes[strip_count];
|
||||
#else
|
||||
uint32_t* strip_offset = (uint32_t*) _alloca(strip_count);
|
||||
uint32_t* strip_bytes = (uint32_t*) _alloca(strip_count);
|
||||
strip_offset = (uint32_t*) _alloca(strip_count * sizeof(uint32_t));
|
||||
strip_bytes = (uint32_t*) _alloca(strip_count * sizeof(uint32_t));
|
||||
#endif
|
||||
free_memory = 8;
|
||||
|
||||
|
@ -148,6 +148,10 @@ SOURCE=..\..\backend\eci.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\backend\emf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\frontend\getopt.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -248,6 +252,10 @@ SOURCE=..\..\backend\telepen.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\backend\tif.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\backend\upcean.c
|
||||
# End Source File
|
||||
# End Group
|
||||
|
Loading…
Reference in New Issue
Block a user