File tgif-4.2.5-locale-atof.patch of Package tgif
--- page.c.original 2011-06-28 04:04:58.000000000 +0200
+++ page.c 2013-03-15 14:15:52.135995555 +0100
@@ -1300,14 +1300,22 @@
(c_ptr=strstr(Spec, "In")) != NULL ||
(c_ptr=strstr(Spec, "IN")) != NULL) {
*c_ptr = '\0';
+ char *old_locale=setlocale(LC_NUMERIC, "C");
val = atof(Spec) * ((double)PIX_PER_INCH);
+ if (old_locale != NULL) {
+ setlocale(LC_NUMERIC, old_locale);
+ }
*pnNumPixels = round(val);
if (!nNonPosReturnOK && *pnNumPixels <= 0) return FALSE;
} else if ((c_ptr=strstr(Spec, "cm")) != NULL ||
(c_ptr=strstr(Spec, "Cm")) != NULL ||
(c_ptr=strstr(Spec, "CM")) != NULL) {
*c_ptr = '\0';
+ char *old_locale=setlocale(LC_NUMERIC, "C");
val = atof(Spec) * ((double)ONE_CM);
+ if (old_locale != NULL) {
+ setlocale(LC_NUMERIC, old_locale);
+ }
*pnNumPixels = round(val);
if (!nNonPosReturnOK && *pnNumPixels <= 0) return FALSE;
} else if (sscanf(Spec, "%d", pnNumPixels) != 1) {
@@ -1331,14 +1339,22 @@
(c_ptr=strstr(Spec, "In")) != NULL ||
(c_ptr=strstr(Spec, "IN")) != NULL) {
*c_ptr = '\0';
+ char *old_locale=setlocale(LC_NUMERIC, "C");
dval = atof(Spec) * ((double)PIX_PER_INCH);
+ if (old_locale != NULL) {
+ setlocale(LC_NUMERIC, old_locale);
+ }
*pd_num_pixels = dval;
if (!nNonPosReturnOK && dval < (double)0) return FALSE;
} else if ((c_ptr=strstr(Spec, "cm")) != NULL ||
(c_ptr=strstr(Spec, "Cm")) != NULL ||
(c_ptr=strstr(Spec, "CM")) != NULL) {
*c_ptr = '\0';
+ char *old_locale=setlocale(LC_NUMERIC, "C");
dval = atof(Spec) * ((double)ONE_CM);
+ if (old_locale != NULL) {
+ setlocale(LC_NUMERIC, old_locale);
+ }
*pd_num_pixels = dval;
if (!nNonPosReturnOK && dval < (double)0) return FALSE;
} else if (sscanf(Spec, "%lf", pd_num_pixels) != 1) {
--- setup.c.original 2011-06-28 04:04:58.000000000 +0200
+++ setup.c 2013-03-15 14:17:04.743983407 +0100
@@ -1470,7 +1470,11 @@
}
tiledPageScaling = 0.9;
if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"TiledPageScaling")) != NULL) {
+ char *old_locale=setlocale(LC_NUMERIC, "C");
tiledPageScaling = (float)atof(c_ptr);
+ if (old_locale != NULL) {
+ setlocale(LC_NUMERIC, old_locale);
+ }
if (tiledPageScaling <= 0.0 || tiledPageScaling > 1.0) {
fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_STR),
TOOL_NAME, "TiledPageScaling", c_ptr, "0.9");
--- tangram2.c.original 2011-06-28 04:04:59.000000000 +0200
+++ tangram2.c 2020-12-29 20:23:09.587855993 +0100
@@ -1202,7 +1202,11 @@
strcpy(execDummyStr, "Time=");
attr_ptr = FindAttrWithName(named_obj, execDummyStr, &attr_owner_obj);
if (attr_ptr == NULL) { BadAttr_Simulator(execDummyStr, orig_cmd); return; }
+ char *old_locale=setlocale(LC_NUMERIC, "C");
tempo += atof(attr_ptr->attr_value.s);
+ if (old_locale != NULL) {
+ setlocale(LC_NUMERIC, old_locale);
+ }
sprintf(execDummyStr, "%.3f", tempo);
ReplaceAttrFirstValue(attr_owner_obj, attr_ptr, execDummyStr);
@@ -1210,7 +1214,11 @@
strcpy(execDummyStr, "Transitions=");
attr_ptr = FindAttrWithName(named_obj, execDummyStr, &attr_owner_obj);
if (attr_ptr == NULL) { BadAttr_Simulator(execDummyStr, orig_cmd); return; }
+ old_locale=setlocale(LC_NUMERIC, "C");
transitions += atof(attr_ptr->attr_value.s);
+ if (old_locale != NULL) {
+ setlocale(LC_NUMERIC, old_locale);
+ }
sprintf(execDummyStr, "%d", transitions);
ReplaceAttrFirstValue(attr_owner_obj, attr_ptr, execDummyStr);
--- text.c.original 2013-03-15 13:51:10.000000000 +0100
+++ text.c 2013-03-15 14:20:35.929946357 +0100
@@ -330,7 +330,11 @@
strcpy(scriptFractionStr, "0.6");
if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"ScriptFraction")) != NULL) {
strcpy(scriptFractionStr, c_ptr);
+ char *old_locale=setlocale(LC_NUMERIC, "C");
scriptFraction = (float)atof(c_ptr);
+ if (old_locale != NULL) {
+ setlocale(LC_NUMERIC, old_locale);
+ }
if (scriptFraction < 0.2 || scriptFraction > 1.01) {
fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_STR),
TOOL_NAME, "ScriptFraction", scriptFractionStr, "0.6");
@@ -5962,7 +5966,11 @@
float fv=(float)0.0;
char buf[80];
+ char *old_locale=setlocale(LC_NUMERIC, "C");
fv = (float)atof(spec);
+ if (old_locale != NULL) {
+ setlocale(LC_NUMERIC, old_locale);
+ }
UtilStrCpyN(buf, sizeof(buf), spec);
if (fabs(fv - ((double)1.01)) < INT_TOL) {
fv = (float)1.0;
--- xbitmap.c.original 2013-03-15 13:51:10.000000000 +0100
+++ xbitmap.c 2013-03-15 14:22:09.224929200 +0100
@@ -356,7 +356,11 @@
strcpy(bitmapThresholdStr, ((halfToneBitmap) ? "0.5" : "1.0"));
if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"BitmapThreshold"))!=NULL) {
strcpy(bitmapThresholdStr, c_ptr);
+ char *old_locale=setlocale(LC_NUMERIC, "C");
bitmapThreshold = (float) atof(c_ptr);
+ if (old_locale != NULL) {
+ setlocale(LC_NUMERIC, old_locale);
+ }
if (bitmapThreshold < 0 || bitmapThreshold > 1) {
fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_STR),
TOOL_NAME, "BitmapThreshold", c_ptr,
@@ -395,7 +399,11 @@
epsiPreviewBitmapThreshold = (float)0.5;
if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,
"EPSIPreviewBitmapThreshold")) != NULL) {
+ char *old_locale=setlocale(LC_NUMERIC, "C");
epsiPreviewBitmapThreshold = (float) atof(c_ptr);
+ if (old_locale != NULL) {
+ setlocale(LC_NUMERIC, old_locale);
+ }
if (epsiPreviewBitmapThreshold < ((float)0) ||
epsiPreviewBitmapThreshold > (((float)1)+INT_TOL)) {
fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_STR),