From 2095d24842e34f7f85d5025767134badbf9dd44f Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 9 Apr 1997 19:41:24 +0000 Subject: Tweaks to keep the Microsoft compiler quiet. --- Objects/dictobject.c | 2 +- Objects/listobject.c | 2 +- Objects/longobject.c | 28 ++++++++++++++-------------- Objects/mappingobject.c | 2 +- Objects/stringobject.c | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 51f0018..cd915e9 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -168,7 +168,7 @@ lookmapping(mp, key, hash) register unsigned incr; register unsigned long sum = (unsigned long) hash; register mappingentry *freeslot = NULL; - register int mask = mp->ma_size-1; + register unsigned int mask = mp->ma_size-1; mappingentry *ep0 = mp->ma_table; register mappingentry *ep; /* We must come up with (i, incr) such that 0 <= i < ma_size diff --git a/Objects/listobject.c b/Objects/listobject.c index 8aca28d..e2f6fd8 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -67,7 +67,7 @@ newlistobject(size) } nbytes = size * sizeof(object *); /* Check for overflow */ - if (nbytes / sizeof(object *) != size) { + if (nbytes / sizeof(object *) != (size_t)size) { return err_nomem(); } op = (listobject *) malloc(sizeof(listobject)); diff --git a/Objects/longobject.c b/Objects/longobject.c index 123d570..dc84583 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -101,7 +101,7 @@ newlongobject(ival) v->ob_size = -(v->ob_size); } for (i = 0; i < 5; i++) { - v->ob_digit[i] = t & MASK; + v->ob_digit[i] = (digit) (t & MASK); t >>= SHIFT; } v = long_normalize(v); @@ -122,7 +122,7 @@ PyLong_FromUnsignedLong(ival) unsigned long t = ival; int i; for (i = 0; i < 5; i++) { - v->ob_digit[i] = t & MASK; + v->ob_digit[i] = (digit) (t & MASK); t >>= SHIFT; } v = long_normalize(v); @@ -158,7 +158,7 @@ dnewlongobject(dval) frac = ldexp(frac, (expo-1) % SHIFT + 1); for (i = ndig; --i >= 0; ) { long bits = (long)frac; - v->ob_digit[i] = bits; + v->ob_digit[i] = (digit) bits; frac = frac - (double)bits; frac = ldexp(frac, SHIFT); } @@ -293,10 +293,10 @@ muladd1(a, n, extra) return NULL; for (i = 0; i < size_a; ++i) { carry += (twodigits)a->ob_digit[i] * n; - z->ob_digit[i] = carry & MASK; + z->ob_digit[i] = (digit) (carry & MASK); carry >>= SHIFT; } - z->ob_digit[i] = carry; + z->ob_digit[i] = (digit) carry; return long_normalize(z); } @@ -321,10 +321,10 @@ divrem1(a, n, prem) return NULL; for (i = size; --i >= 0; ) { rem = (rem << SHIFT) + a->ob_digit[i]; - z->ob_digit[i] = rem/n; + z->ob_digit[i] = (digit) (rem/n); rem %= n; } - *prem = rem; + *prem = (digit) rem; return long_normalize(z); } @@ -383,7 +383,7 @@ long_format(aa, base) else rem += 'A'-10; assert(p > GETSTRINGVALUE(str)); - *--p = rem; + *--p = (char) rem; DECREF(a); a = temp; SIGCHECK({ @@ -552,7 +552,7 @@ x_divrem(v1, w1, prem) longobject **prem; { int size_v = ABS(v1->ob_size), size_w = ABS(w1->ob_size); - digit d = (twodigits)BASE / (w1->ob_digit[size_w-1] + 1); + digit d = (digit) ((twodigits)BASE / (w1->ob_digit[size_w-1] + 1)); longobject *v = mul1(v1, d); longobject *w = mul1(w1, d); longobject *a; @@ -599,7 +599,7 @@ x_divrem(v1, w1, prem) for (i = 0; i < size_w && i+k < size_v; ++i) { twodigits z = w->ob_digit[i] * q; - digit zz = z >> SHIFT; + digit zz = (digit) (z >> SHIFT); carry += v->ob_digit[i+k] - z + ((twodigits)zz << SHIFT); v->ob_digit[i+k] = carry & MASK; carry = (carry >> SHIFT) - zz; @@ -611,10 +611,10 @@ x_divrem(v1, w1, prem) } if (carry == 0) - a->ob_digit[k] = q; + a->ob_digit[k] = (digit) q; else { assert(carry == -1); - a->ob_digit[k] = q-1; + a->ob_digit[k] = (digit) q-1; carry = 0; for (i = 0; i < size_w && i+k < size_v; ++i) { carry += v->ob_digit[i+k] + w->ob_digit[i]; @@ -903,13 +903,13 @@ long_mul(a, b) }) for (j = 0; j < size_b; ++j) { carry += z->ob_digit[i+j] + b->ob_digit[j] * f; - z->ob_digit[i+j] = carry & MASK; + z->ob_digit[i+j] = (digit) (carry & MASK); carry >>= SHIFT; } for (; carry != 0; ++j) { assert(i+j < z->ob_size); carry += z->ob_digit[i+j]; - z->ob_digit[i+j] = carry & MASK; + z->ob_digit[i+j] = (digit) (carry & MASK); carry >>= SHIFT; } } diff --git a/Objects/mappingobject.c b/Objects/mappingobject.c index 51f0018..cd915e9 100644 --- a/Objects/mappingobject.c +++ b/Objects/mappingobject.c @@ -168,7 +168,7 @@ lookmapping(mp, key, hash) register unsigned incr; register unsigned long sum = (unsigned long) hash; register mappingentry *freeslot = NULL; - register int mask = mp->ma_size-1; + register unsigned int mask = mp->ma_size-1; mappingentry *ep0 = mp->ma_table; register mappingentry *ep; /* We must come up with (i, incr) such that 0 <= i < ma_size diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 724121f..881cdab 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -327,7 +327,7 @@ string_repeat(a, n) register int n; { register int i; - register unsigned int size; + register int size; register stringobject *op; if (n < 0) n = 0; -- cgit v0.12