summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-11 08:49:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-11 08:49:37 +0000
commitbbfe73888ac71cdb56125023a028aeb62c33d8a8 (patch)
tree5db76343406e1405bf4d257acd4268faa90550f3 /ext
parent1e7898d76a90befec85074f9d580531cf64ee9be (diff)
* 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/branches/ruby_1_8@23667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/bigdecimal/bigdecimal.c22
-rw-r--r--ext/bigdecimal/bigdecimal.h2
2 files changed, 13 insertions, 11 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 0257ca50a7..2de82b518e 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -647,10 +647,10 @@ BigDecimal_coerce(VALUE self, VALUE other)
VALUE obj;
Real *b;
if(TYPE(other) == T_FLOAT) {
- obj = rb_assoc_new(other, BigDecimal_to_f(self));
+ obj = rb_assoc_new(other, BigDecimal_to_f(self));
} else {
- GUARD_OBJ(b,GetVpValue(other,1));
- obj = rb_assoc_new(b->obj, self);
+ GUARD_OBJ(b,GetVpValue(other,1));
+ obj = rb_assoc_new(b->obj, self);
}
return obj;
}
@@ -1945,7 +1945,7 @@ Init_bigdecimal(void)
rb_define_method(rb_cBigDecimal, "add", BigDecimal_add2, 2);
rb_define_method(rb_cBigDecimal, "sub", BigDecimal_sub2, 2);
rb_define_method(rb_cBigDecimal, "mult", BigDecimal_mult2, 2);
- rb_define_method(rb_cBigDecimal, "div",BigDecimal_div2, -1);
+ rb_define_method(rb_cBigDecimal, "div", BigDecimal_div2, -1);
rb_define_method(rb_cBigDecimal, "hash", BigDecimal_hash, 0);
rb_define_method(rb_cBigDecimal, "to_s", BigDecimal_to_s, -1);
rb_define_method(rb_cBigDecimal, "to_i", BigDecimal_to_i, 0);
@@ -2005,7 +2005,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 */
@@ -2458,8 +2460,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 */
@@ -3609,7 +3611,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;
@@ -3653,7 +3655,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;
@@ -3775,7 +3777,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 */
@@ -4130,7 +4132,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;
diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h
index 3bd70fc7cb..c2178a6f7a 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)