Make it compile with MS-VC6++

This commit is contained in:
Harald Oehlmann 2018-11-02 09:09:38 +01:00
parent 3ccc00a4d4
commit 5c00c7893e
3 changed files with 20 additions and 14 deletions

View File

@ -126,7 +126,7 @@ int bump_up(int input) {
} }
int emf_plot(struct zint_symbol *symbol) { int emf_plot(struct zint_symbol *symbol) {
int i; int i,j;
FILE *emf_file; FILE *emf_file;
int fgred, fggrn, fgblu, bgred, bggrn, bgblu; int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
int error_number = 0; int error_number = 0;
@ -160,6 +160,13 @@ int emf_plot(struct zint_symbol *symbol) {
//emr_extcreatefontindirectw_t emr_extcreatefontindirectw_big; //emr_extcreatefontindirectw_t emr_extcreatefontindirectw_big;
//emr_selectobject_t emr_selectobject_font_big; //emr_selectobject_t emr_selectobject_font_big;
#ifdef _MSC_VER
emr_rectangle_t *rectangle;
emr_ellipse_t *circle;
emr_polygon_t *hexagon;
emr_exttextoutw_t *text;
#endif
fgred = (16 * ctoi(symbol->fgcolour[0])) + ctoi(symbol->fgcolour[1]); fgred = (16 * ctoi(symbol->fgcolour[0])) + ctoi(symbol->fgcolour[1]);
fggrn = (16 * ctoi(symbol->fgcolour[2])) + ctoi(symbol->fgcolour[3]); fggrn = (16 * ctoi(symbol->fgcolour[2])) + ctoi(symbol->fgcolour[3]);
fgblu = (16 * ctoi(symbol->fgcolour[4])) + ctoi(symbol->fgcolour[5]); fgblu = (16 * ctoi(symbol->fgcolour[4])) + ctoi(symbol->fgcolour[5]);
@ -178,10 +185,10 @@ int emf_plot(struct zint_symbol *symbol) {
emr_polygon_t hexagon[hexagon_count]; emr_polygon_t hexagon[hexagon_count];
emr_exttextoutw_t text[string_count]; emr_exttextoutw_t text[string_count];
#else #else
emr_rectangle_t *rectangle = (emr_rectangle_t*) _alloca(rectangle_count * sizeof (emr_rectangle_t)); rectangle = (emr_rectangle_t*) _alloca(rectangle_count * sizeof (emr_rectangle_t));
emr_ellipse_t *circle = (emr_ellipse_t*) _alloca(circle_count * sizeof (emr_ellipse_t)); circle = (emr_ellipse_t*) _alloca(circle_count * sizeof (emr_ellipse_t));
emr_polygon_t *hexagon = (emr_polygon_t*) _alloca(hexagon_count * sizeof (emr_polygon_t)); hexagon = (emr_polygon_t*) _alloca(hexagon_count * sizeof (emr_polygon_t));
emr_exttextoutw_t *text = (emr_exttextoutw_t*) _alloca(string_count * sizeof (emr_exttextoutw_t)); text = (emr_exttextoutw_t*) _alloca(string_count * sizeof (emr_exttextoutw_t));
#endif #endif
/* Header */ /* Header */
@ -501,7 +508,7 @@ int emf_plot(struct zint_symbol *symbol) {
fwrite(&emr_selectobject_font, sizeof (emr_selectobject_t), 1, emf_file); fwrite(&emr_selectobject_font, sizeof (emr_selectobject_t), 1, emf_file);
fwrite(&text[i], sizeof (emr_exttextoutw_t), 1, emf_file); fwrite(&text[i], sizeof (emr_exttextoutw_t), 1, emf_file);
fwrite(this_string[i], bump_up(text[i].w_emr_text.chars + 1) * 2, 1, emf_file); fwrite(this_string[i], bump_up(text[i].w_emr_text.chars + 1) * 2, 1, emf_file);
for (int j = 0; j < bump_up(text[i].w_emr_text.chars + 1); j++) { for (j = 0; j < bump_up(text[i].w_emr_text.chars + 1); j++) {
fwrite(&spacing, 4, 1, emf_file); fwrite(&spacing, 4, 1, emf_file);
} }
} }

View File

@ -60,9 +60,6 @@ int ps_plot(struct zint_symbol *symbol) {
} }
if (feps == NULL) { if (feps == NULL) {
strcpy(symbol->errtxt, "645: Could not open output file"); strcpy(symbol->errtxt, "645: Could not open output file");
#ifdef _MSC_VER
free(local_text);
#endif
return ZINT_ERROR_FILE_ACCESS; return ZINT_ERROR_FILE_ACCESS;
} }

View File

@ -315,7 +315,8 @@ int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type) {
int upceanflag = 0; int upceanflag = 0;
int rect_count, last_row_start; int rect_count, last_row_start;
int this_row; int this_row;
int addon_latch = 0;
struct zint_vector_string *string;
// Sanity check colours // Sanity check colours
to_upper((unsigned char*) symbol->fgcolour); to_upper((unsigned char*) symbol->fgcolour);
to_upper((unsigned char*) symbol->bgcolour); to_upper((unsigned char*) symbol->bgcolour);
@ -432,6 +433,8 @@ int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type) {
if ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0)) { if ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0)) {
hide_text = 1; hide_text = 1;
// HaO 2018-11-02 text_height and text_offset is an int.
// This gives the idea to me that a float is intended
text_height = 0.0; text_height = 0.0;
text_offset = upceanflag ? 9.0 : 0.0; text_offset = upceanflag ? 9.0 : 0.0;
} else { } else {
@ -466,8 +469,6 @@ int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type) {
default_text_posn = symbol->height + text_offset + symbol->border_width; default_text_posn = symbol->height + text_offset + symbol->border_width;
} }
int addon_latch = 0;
// Plot rectangles - most symbols created here // Plot rectangles - most symbols created here
if ((symbol->symbology != BARCODE_MAXICODE) && ((symbol->output_options & BARCODE_DOTTY_MODE) == 0)) { if ((symbol->symbology != BARCODE_MAXICODE) && ((symbol->output_options & BARCODE_DOTTY_MODE) == 0)) {
for (r = 0; r < symbol->rows; r++) { for (r = 0; r < symbol->rows; r++) {
@ -527,11 +528,12 @@ int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type) {
// Plot Maxicode symbols // Plot Maxicode symbols
if (symbol->symbology == BARCODE_MAXICODE) { if (symbol->symbology == BARCODE_MAXICODE) {
struct zint_vector_circle *circle;
vector->width = 37.0 + (2.0 * xoffset); vector->width = 37.0 + (2.0 * xoffset);
vector->height = 36.0 + (2.0 * yoffset); vector->height = 36.0 + (2.0 * yoffset);
// Bullseye // Bullseye
struct zint_vector_circle *circle = vector_plot_create_circle(17.88 + xoffset, 17.8 + yoffset, 10.85, 0); circle = vector_plot_create_circle(17.88 + xoffset, 17.8 + yoffset, 10.85, 0);
vector_plot_add_circle(symbol, circle, &last_circle); vector_plot_add_circle(symbol, circle, &last_circle);
circle = vector_plot_create_circle(17.88 + xoffset, 17.8 + yoffset, 8.97, 1); circle = vector_plot_create_circle(17.88 + xoffset, 17.8 + yoffset, 8.97, 1);
vector_plot_add_circle(symbol, circle, &last_circle); vector_plot_add_circle(symbol, circle, &last_circle);
@ -793,7 +795,7 @@ int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type) {
//Remove control characters from readable text //Remove control characters from readable text
// This only applies to Code 128 // This only applies to Code 128
struct zint_vector_string *string = symbol->vector->strings; string = symbol->vector->strings;
if (string) { if (string) {
for (i = 0; i < string->length; i++) { for (i = 0; i < string->length; i++) {
if (string->text[i] < ' ') { if (string->text[i] < ' ') {