1
0
mirror of https://git.code.sf.net/p/zint/code synced 2025-12-23 04:47:03 +00:00

Make locale aware

This commit is contained in:
hooper114
2010-05-23 05:02:08 +00:00
parent 91251fbc26
commit f8b6fb20aa
2 changed files with 12 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include <locale.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@@ -45,6 +46,7 @@ int ps_plot(struct zint_symbol *symbol)
float scaler = symbol->scale; float scaler = symbol->scale;
float default_text_posn; float default_text_posn;
int plot_text = 1; int plot_text = 1;
const char *locale = NULL;
row_height=0; row_height=0;
textdone = 0; textdone = 0;
@@ -85,6 +87,7 @@ int ps_plot(struct zint_symbol *symbol)
strcpy(symbol->errtxt, "Malformed background colour target"); strcpy(symbol->errtxt, "Malformed background colour target");
return ERROR_INVALID_OPTION; return ERROR_INVALID_OPTION;
} }
locale = setlocale(LC_ALL, "C");
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]);
@@ -767,6 +770,9 @@ int ps_plot(struct zint_symbol *symbol)
fclose(feps); fclose(feps);
if (locale)
setlocale(LC_ALL, locale);
return error_number; return error_number;
} }

View File

@@ -19,6 +19,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include <locale.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@@ -41,6 +42,7 @@ int svg_plot(struct zint_symbol *symbol)
float scaler = symbol->scale; float scaler = symbol->scale;
float default_text_posn; float default_text_posn;
int plot_text = 1; int plot_text = 1;
const char *locale = NULL;
row_height=0; row_height=0;
textdone = 0; textdone = 0;
@@ -81,6 +83,7 @@ int svg_plot(struct zint_symbol *symbol)
strcpy(symbol->errtxt, "Malformed background colour target"); strcpy(symbol->errtxt, "Malformed background colour target");
return ERROR_INVALID_OPTION; return ERROR_INVALID_OPTION;
} }
locale = setlocale(LC_ALL, "C");
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]);
@@ -614,6 +617,9 @@ int svg_plot(struct zint_symbol *symbol)
fclose(fsvg); fclose(fsvg);
if (locale)
setlocale(LC_ALL, locale);
return error_number; return error_number;
} }