]> granicus.if.org Git - python/commitdiff
Tweaks to keep the Microsoft compiler quiet.
authorGuido van Rossum <guido@python.org>
Wed, 9 Apr 1997 19:41:24 +0000 (19:41 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 9 Apr 1997 19:41:24 +0000 (19:41 +0000)
Objects/dictobject.c
Objects/listobject.c
Objects/longobject.c
Objects/mappingobject.c
Objects/stringobject.c

index 51f001802811aeb448171c2391d0f887673d8bf6..cd915e9acde37d05cfe54781b6ee0215929194cc 100644 (file)
@@ -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
index 8aca28dc303c27b3c6e5b24fa8b683bbd2e06e78..e2f6fd883949ae3f2f4ec726ba19837017c752a5 100644 (file)
@@ -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));
index 123d570b2bf0a057bf5a9f7621d5d0885ab16854..dc84583c393ac09a2bfb7e654c8588e8e54f6bbe 100644 (file)
@@ -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;
                }
        }
index 51f001802811aeb448171c2391d0f887673d8bf6..cd915e9acde37d05cfe54781b6ee0215929194cc 100644 (file)
@@ -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
index 724121f0b1159d0f14a95c53a19ef4b319895d75..881cdaba89286cfdef3645a05ead5540dc193b1d 100644 (file)
@@ -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;