summaryrefslogtreecommitdiff
path: root/ext/bigdecimal
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-15 09:20:44 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-15 09:20:44 +0000
commit56d3b926ce01e79388c0e8caa29448b24dd21e06 (patch)
treecb27ffbb639e696b6d8852a7c35c0a9e5c1d0ccd /ext/bigdecimal
parent5dde183d0ad5362174e4f2cfac080b667c230089 (diff)
* ext/bigdecimal/bigdecimal.c (BigDecimal_dump, BigDecimal_inspect, VPrint, VpToString, VpVarCheck): use PRIuSIZE, PRIdSIZE, PRIdVALUE, and PRIxVALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal')
-rw-r--r--ext/bigdecimal/bigdecimal.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 1985a26acc6..007d742d17c 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -239,7 +239,7 @@ BigDecimal_dump(int argc, VALUE *argv, VALUE self)
GUARD_OBJ(vp,GetVpValue(self,1));
dump = rb_str_new(0,VpNumOfChars(vp,"E")+50);
psz = RSTRING_PTR(dump);
- sprintf(psz,"%zu:",VpMaxPrec(vp)*VpBaseFig());
+ sprintf(psz, "%"PRIuSIZE":", VpMaxPrec(vp)*VpBaseFig());
VpToString(vp, psz+strlen(psz), 0, 0);
rb_str_resize(dump, strlen(psz));
return dump;
@@ -1635,11 +1635,11 @@ BigDecimal_inspect(VALUE self)
obj = rb_str_new(0, nc+256);
psz = RSTRING_PTR(obj);
- sprintf(psz,"#<BigDecimal:%lx,'",self);
+ sprintf(psz,"#<BigDecimal:%"PRIxVALUE",'",self);
tmp = psz + strlen(psz);
VpToString(vp, tmp, 10, 0);
tmp += strlen(tmp);
- sprintf(tmp, "',%zu(%zu)>", VpPrec(vp)*VpBaseFig(), VpMaxPrec(vp)*VpBaseFig());
+ sprintf(tmp, "',%"PRIuSIZE"(%"PRIuSIZE")>", VpPrec(vp)*VpBaseFig(), VpMaxPrec(vp)*VpBaseFig());
rb_str_resize(obj, strlen(psz));
return obj;
}
@@ -3692,7 +3692,7 @@ VPrint(FILE *fp, const char *cntl_chr, Real *a)
m /= 10;
}
}
- nc += fprintf(fp, "E%zi", VpExponent10(a));
+ nc += fprintf(fp, "E%"PRIdVALUE, VpExponent10(a));
} else {
nc += fprintf(fp, "0.0");
}
@@ -3889,7 +3889,7 @@ VpToString(Real *a, char *psz, size_t fFmt, int fPlus)
shift /= 10;
}
while(psz[-1]=='0') *(--psz) = 0;
- sprintf(psz, "E%ld", ex);
+ sprintf(psz, "E%"PRIdVALUE, ex);
if(fFmt) VpFormatSt(pszSav, fFmt);
}
@@ -4394,7 +4394,7 @@ converge:
if(gfDebug) {
VpMult(r, y, y);
VpAddSub(f, x, r, -1);
- printf("VpSqrt: iterations = %lu\n", nr);
+ printf("VpSqrt: iterations = %"PRIdSIZE"\n", nr);
VPrint(stdout, " y =% \n", y);
VPrint(stdout, " x =% \n", x);
VPrint(stdout, " x-y*y = % \n", f);
@@ -4779,24 +4779,24 @@ VpVarCheck(Real * v)
* other ... error
*/
{
- U_LONG i;
+ size_t i;
if(v->MaxPrec <= 0) {
- printf("ERROR(VpVarCheck): Illegal Max. Precision(=%lu)\n",
+ printf("ERROR(VpVarCheck): Illegal Max. Precision(=%"PRIuSIZE")\n",
v->MaxPrec);
return 1;
}
if((v->Prec <= 0) ||((v->Prec) >(v->MaxPrec))) {
- printf("ERROR(VpVarCheck): Illegal Precision(=%lu)\n", v->Prec);
- printf(" Max. Prec.=%lu\n", v->MaxPrec);
+ printf("ERROR(VpVarCheck): Illegal Precision(=%"PRIuSIZE")\n", v->Prec);
+ printf(" Max. Prec.=%"PRIuSIZE"\n", v->MaxPrec);
return 2;
}
for(i = 0; i < v->Prec; ++i) {
if((v->frac[i] >= BASE)) {
printf("ERROR(VpVarCheck): Illegal fraction\n");
- printf(" Frac[%ld]=%lu\n", i, v->frac[i]);
- printf(" Prec. =%lu\n", v->Prec);
- printf(" Exp. =%d\n", v->exponent);
+ printf(" Frac[%"PRIuSIZE"]=%lu\n", i, v->frac[i]);
+ printf(" Prec. =%"PRIuSIZE"\n", v->Prec);
+ printf(" Exp. =%"PRIdVALUE"\n", v->exponent);
printf(" BASE =%lu\n", BASE);
return 3;
}