"ubyte format requires 0 <= number <= 255");
return -1;
}
- *p = (char)x;
+ *(unsigned char *)p = (unsigned char)x;
return 0;
}
{
long x;
Py_ssize_t i;
+ unsigned char *q = (unsigned char *)p;
if (get_long(v, &x) < 0)
return -1;
i = f->size;
#endif
}
do {
- p[--i] = (char)x;
+ q[--i] = (unsigned char)(x & 0xffL);
x >>= 8;
} while (i > 0);
return 0;
{
unsigned long x;
Py_ssize_t i;
+ unsigned char *q = (unsigned char *)p;
if (get_ulong(v, &x) < 0)
return -1;
i = f->size;
RANGE_ERROR(x, f, 1, maxint - 1);
}
do {
- p[--i] = (char)x;
+ q[--i] = (unsigned char)(x & 0xffUL);
x >>= 8;
} while (i > 0);
return 0;
{
long x;
Py_ssize_t i;
+ unsigned char *q = (unsigned char *)p;
if (get_long(v, &x) < 0)
return -1;
i = f->size;
#endif
}
do {
- *p++ = (char)x;
+ *q++ = (unsigned char)(x & 0xffL);
x >>= 8;
} while (--i > 0);
return 0;
{
unsigned long x;
Py_ssize_t i;
+ unsigned char *q = (unsigned char *)p;
if (get_ulong(v, &x) < 0)
return -1;
i = f->size;
RANGE_ERROR(x, f, 1, maxint - 1);
}
do {
- *p++ = (char)x;
+ *q++ = (unsigned char)(x & 0xffUL);
x >>= 8;
} while (--i > 0);
return 0;