1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
Description: source: format bug fix
Attempt to fix (f|s|sn)printf formats as detected by gcc essentially
by adding missing casts. Note that, at the time of silencing, gcc
cannot handle custom format specifiers as the `Q' one provided by
the quadmath lbrary (for discussion and uptodate information, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47781 ). Meant to be
submitted to the upstream maintainer.
Origin: debian
Forwarded: by email
Author: Jerome Benoit <calculus@rezozer.net>
Last-Update: 2016-07-16
--- a/src/psgraph.c
+++ b/src/psgraph.c
@@ -797,7 +797,7 @@
REAL yspot = -1.4+2.8*text_chunks[i].start_y;
REAL line_ht = 1.3*text_chunks[i].vsize*2.8; // 1.3 fudge factor for helvetica vs glut font
- fprintf(fd,"\n/Helvetica findfont %f scalefont setfont\n",line_ht);
+ fprintf(fd,"\n/Helvetica findfont %f scalefont setfont\n",(DOUBLE)line_ht);
fputs("0 setgray\n",fd);
fprintf(fd,"%f %f moveto (",(DOUBLE)xspot,(DOUBLE)yspot);
for ( c = text_chunks[i].text ; *c ; c++ )
--- a/src/painter.c
+++ b/src/painter.c
@@ -2585,11 +2585,11 @@
int i;
fprintf(stderr,"Visibility edge list debug dump at u = %18.15f; debug_seq %d\n",
- sweep_u,debug_seq);
+ (DOUBLE)sweep_u,debug_seq);
for ( e = active_edge_first ; e != &sentinel ; e = e->next_active )
{ if ( e == NULL ) { fprintf(stderr,"NULL next_active.\n"); break; }
v = e->m*(sweep_u-e->v[0]->x[0]) + e->v[0]->x[1];
- fprintf(stderr,"%3d %5d v: %18.15f layers:",e->seqno,e->id,v);
+ fprintf(stderr,"%3d %5d v: %18.15f layers:",e->seqno,e->id,(DOUBLE)v);
for ( i = 0 ; i < e->layers ; i++ )
fprintf(stderr," %3d",ordinal(e->layer[i]->f_id)+1);
fprintf(stderr,"\n");
@@ -2854,7 +2854,7 @@
static int this_seq = 0; // for detecting loops in linked list
if ( visdebuglevel >= VIS_EVENTDUMP )
- printf("Vertex event at u = %18.15f v = %18.15f\n",sweep_u,v->x[1]);
+ printf("Vertex event at u = %18.15f v = %18.15f\n",(DOUBLE)sweep_u,(DOUBLE)(v->x[1]));
// First, delete left edges and associated facets.
if ( v->left_edge_head )
--- a/src/evaltree.c
+++ b/src/evaltree.c
@@ -1798,10 +1798,10 @@
{ if ( *stacktop > -100*machine_eps ) *stacktop = 0.0;
else
{ if ( valid_id(self_id) )
- sprintf(errmsg,"Square root of negative number %g in %s, %s %s.\n",*stacktop,
+ sprintf(errmsg,"Square root of negative number %g in %s, %s %s.\n",(DOUBLE)(*stacktop),
ex_current.name,typenames[id_type(self_id)],ELNAME(self_id));
else
- sprintf(errmsg,"Square root of negative number %g in %s.\n",*stacktop,ex_current.name);
+ sprintf(errmsg,"Square root of negative number %g in %s.\n",(DOUBLE)(*stacktop),ex_current.name);
sprintf(errmsg+strlen(errmsg),"(source file %s, line %d)\n",
file_names[node->file_no],node->line_no);
kb_error(1263,errmsg,RECOVERABLE);
--- a/src/dump.c
+++ b/src/dump.c
@@ -488,7 +488,7 @@
&& g->attr.varstuff.pscale != 0.0 )
{
#ifdef FLOAT128
- sprintf(msg,"pscale = %2.*rg ",DPREC,g->attr.varstuff.pscale);
+ sprintf(msg,"pscale = %2.*Qg ",DPREC,g->attr.varstuff.pscale);
#elif defined(LONGDOUBLE)
sprintf(msg,"pscale = %2.*Lg ",DPREC,g->attr.varstuff.pscale);
#else
@@ -1369,7 +1369,7 @@
{ sprintf(msg," backcolor %s ",COLORNAME(get_facet_backcolor(f_id)));
outstring(msg); }
if ( opacity_attr )
- { sprintf(msg," opacity %f ",*(REAL*)get_extra(f_id,opacity_attr));
+ { sprintf(msg," opacity %f ",(DOUBLE)(*(REAL*)get_extra(f_id,opacity_attr)));
outstring(msg);
}
if ( elptr(f_id)->method_count )
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -403,7 +403,7 @@
- ellipticE(-m/(1-m)))*sqrt(1-m);
if ( m >= 1 && fabs(phi) > M_PI )
{ sprintf(errmsg,"incompleteEllipticE: phi %f too large for given m %f.\n",
- phi,m);
+ (DOUBLE)phi,(DOUBLE)m);
kb_error(2663,errmsg,RECOVERABLE);
}
@@ -420,7 +420,7 @@
c *= c;
if ( c-m < 0.0 )
{ sprintf(errmsg,"incompleteEllipticE: phi %f too large for given m %f.\n",
- phi,m);
+ (DOUBLE)phi,(DOUBLE)m);
kb_error(3039,errmsg,RECOVERABLE);
}
lambda = 1/(fabs(c-1)+fabs(c-m)+fabs(c)); // get in nice range
--- a/src/eval_all.c
+++ b/src/eval_all.c
@@ -718,7 +718,7 @@
{ if ( stacktop->value > -100*machine_eps ) stacktop->value = 0.0;
else
{
- sprintf(errmsg,"Square root of negative number %g \n",stacktop->value);
+ sprintf(errmsg,"Square root of negative number %g \n",(DOUBLE)(stacktop->value));
sprintf(errmsg+strlen(errmsg),"(source file %s, line %d)\n",
file_names[node->file_no],node->line_no);
kb_error(4263,errmsg,RECOVERABLE);
--- a/src/eval_sec.c
+++ b/src/eval_sec.c
@@ -765,7 +765,7 @@
case SQRT_NODE:
{ int i,j;
if ( stacktop->value < 0.0 )
- { sprintf(errmsg,"Square root of negative number %g.\n",stacktop->value);
+ { sprintf(errmsg,"Square root of negative number %g.\n",(DOUBLE)(stacktop->value));
sprintf(errmsg+strlen(errmsg),"(source file %s, line %d)\n",
file_names[node->file_no],node->line_no);
kb_error(2567,errmsg,RECOVERABLE);
--- a/src/alice.c
+++ b/src/alice.c
@@ -43,32 +43,49 @@
edge_id f_id;
REAL sum=0.0;
char p[90];
+#ifdef FLOAT128
+ char *dim, *dam;
+#endif
sprintf(p,"Enter center of test function (%f %f %f): ",
(DOUBLE)xalice[0],(DOUBLE)xalice[1],(DOUBLE)xalice[2]);
prompt(p,msg,msgmax);
-#ifdef LONGDOUBLE
+#ifdef FLOAT128
+ xalice[0] = strtoflt128(msg, &dim);
+ xalice[1] = strtoflt128(dim, &dam);
+ xalice[2] = strtoflt128(dam, &dim);
+ xalice[3] = strtoflt128(dim, &dam);
+ xalice[4] = strtoflt128(dam, NULL);
+#elif defined(LONGDOUBLE)
sscanf(msg,"%Lf %Lf %Lf %Lf %Lf", xalice,xalice+1,xalice+2,xalice+3,xalice+4);
#else
sscanf(msg,"%lf %lf %lf %lf %lf", xalice,xalice+1,xalice+2,xalice+3,xalice+4);
-#endif
+#endif
sprintf(p,"Enter vector of test function (%f %f %f): ",
(DOUBLE)valice[0],(DOUBLE)valice[1],(DOUBLE)valice[2]);
prompt(p,msg,msgmax);
-#ifdef LONGDOUBLE
+#ifdef FLOAT128
+ valice[0] = strtoflt128(msg, &dim);
+ valice[1] = strtoflt128(dim, &dam);
+ valice[2] = strtoflt128(dam, &dim);
+ valice[3] = strtoflt128(dim, &dam);
+ valice[4] = strtoflt128(dam, NULL);
+#elif defined(LONGDOUBLE)
sscanf(msg,"%Lf %Lf %Lf %Lf %Lf", valice,valice+1,valice+2,valice+3,valice+4);
#else
sscanf(msg,"%lf %lf %lf %lf %lf", valice,valice+1,valice+2,valice+3,valice+4);
-#endif
+#endif
sprintf(p,"Enter characteristic size of test function (%f): ",(DOUBLE)radius);
prompt(p,msg,msgmax);
-#ifdef LONGDOUBLE
+#ifdef FLOAT128
+ radius = strtoflt128(msg, NULL);
+#elif defined(LONGDOUBLE)
sscanf(msg,"%Lf", &radius);
#else
sscanf(msg,"%lf", &radius);
-#endif
+#endif
/* integrate over every edge */
FOR_ALL_FACETS(f_id)
|