// optional: .<precision>, .*, or .*<argpos>$ for the precision
// length modifiers: h for forcing a float, l for forcing an int/entity (by default, %d etc. cast a float to int)
// conversions:
-// di take a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to an int
+// d takes a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to an int
+// i takes an int/entity if no length is specified or i is, and a float if h is specified as length, and cast it to an int
// ouxXc take a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to an unsigned int
// eEfFgG take a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to a double
// s takes a string
int width, precision, thisarg, flags;
char formatbuf[16];
char *f;
- qboolean isfloat;
+ int isfloat;
static int dummyivec[3] = {0, 0, 0};
static float dummyvec[3] = {0, 0, 0};
precision = -1;
thisarg = -1;
flags = 0;
+ isfloat = -1;
// is number following?
if(*s >= '0' && *s <= '9')
}
}
- isfloat = true;
for(;;)
{
switch(*s)
{
- case 'h': isfloat = true; break;
- case 'l': isfloat = false; break;
- case 'L': isfloat = false; break;
+ case 'h': isfloat = 1; break;
+ case 'l': isfloat = 0; break;
+ case 'L': isfloat = 0; break;
case 'j': break;
case 'z': break;
case 't': break;
}
nolength:
+ // now s points to the final directive char and is no longer changed
+ if(isfloat < 0)
+ {
+ if(*s == 'i')
+ isfloat = 0;
+ else
+ isfloat = 1;
+ }
+
if(thisarg < 0)
thisarg = argpos++;