From 610c0568c4f14f11f824a7d30bfe4c51e11b0b7a Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 11 Jun 2009 08:49:37 +0000 Subject: * ext/bigdecimal/bigdecimal.c (gfCheckVal): never used. * ext/bigdecimal/bigdecimal.c (VpInit): fixed format modifiers. * ext/bigdecimal/bigdecimal.c (VPrint): constified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/bigdecimal/bigdecimal.c | 24 +++++++++++++----------- ext/bigdecimal/bigdecimal.h | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'ext') diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index bbdab3f2c8..d80e0a764e 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -2054,7 +2054,9 @@ Init_bigdecimal(void) */ #ifdef _DEBUG static int gfDebug = 1; /* Debug switch */ +#if 0 static int gfCheckVal = 1; /* Value checking flag in VpNmlz() */ +#endif #endif /* _DEBUG */ static U_LONG gnPrecLimit = 0; /* Global upper limit of the precision newly allocated */ @@ -2507,8 +2509,8 @@ VpInit(U_LONG BaseVal) printf(" BASE = %lu\n", BASE); printf(" HALF_BASE = %lu\n", HALF_BASE); printf(" BASE1 = %lu\n", BASE1); - printf(" BASE_FIG = %lu\n", BASE_FIG); - printf(" DBLE_FIG = %lu\n", DBLE_FIG); + printf(" BASE_FIG = %d\n", BASE_FIG); + printf(" DBLE_FIG = %d\n", DBLE_FIG); } #endif /* _DEBUG */ @@ -3658,7 +3660,7 @@ Exit: * a ... VP variable to be printed */ VP_EXPORT int -VPrint(FILE *fp, char *cntl_chr, Real *a) +VPrint(FILE *fp, const char *cntl_chr, Real *a) { U_LONG i, j, nc, nd, ZeroSup; U_LONG n, m, e, nn; @@ -3702,7 +3704,7 @@ VPrint(FILE *fp, char *cntl_chr, Real *a) while(m) { nn = e / m; if((!ZeroSup) || nn) { - nc += fprintf(fp, "%lu", nn); /* The reading zero(s) */ + nc += fprintf(fp, "%lu", nn); /* The leading zero(s) */ /* as 0.00xx will not */ /* be printed. */ ++nd; @@ -3824,7 +3826,7 @@ VpSzMantissa(Real *a,char *psz) while(m) { nn = e / m; if((!ZeroSup) || nn) { - sprintf(psz, "%lu", nn); /* The reading zero(s) */ + sprintf(psz, "%lu", nn); /* The leading zero(s) */ psz += strlen(psz); /* as 0.00xx will be ignored. */ ZeroSup = 0; /* Set to print succeeding zeros */ @@ -4179,7 +4181,7 @@ Exit: if(gfDebug) { VPrint(stdout, " VpVtoD: m=%\n", m); printf(" d=%e * 10 **%ld\n", *d, *e); - printf(" DBLE_FIG = %ld\n", DBLE_FIG); + printf(" DBLE_FIG = %d\n", DBLE_FIG); } #endif /*_DEBUG */ return f; @@ -4447,11 +4449,11 @@ VpMidRound(Real *y, int f, int nf) nf += y->exponent*((int)BASE_FIG); exptoadd=0; if (nf < 0) { - /* rounding position too left(large). */ - if((f!=VP_ROUND_CEIL) && (f!=VP_ROUND_FLOOR)) { - VpSetZero(y,VpGetSign(y)); /* truncate everything */ - return 0; - } + /* rounding position too left(large). */ + if((f!=VP_ROUND_CEIL) && (f!=VP_ROUND_FLOOR)) { + VpSetZero(y,VpGetSign(y)); /* truncate everything */ + return 0; + } exptoadd = -nf; nf = 0; } diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h index a30a08e615..c8a1feb30e 100644 --- a/ext/bigdecimal/bigdecimal.h +++ b/ext/bigdecimal/bigdecimal.h @@ -211,7 +211,7 @@ VP_EXPORT Real *VpOne(void); #define VpExponent(a) (a->exponent) #ifdef _DEBUG int VpVarCheck(Real * v); -VP_EXPORT int VPrint(FILE *fp,char *cntl_chr,Real *a); +VP_EXPORT int VPrint(FILE *fp,const char *cntl_chr,Real *a); #endif /* _DEBUG */ #if defined(__cplusplus) -- cgit v1.2.3