Commit 8d488306 by Andrew Pinski Committed by Andrew Pinski

archive.c: Fix all the warnings about passing unsigned char* to char* and the other way too.

2004-10-08  Andrew Pinski  <pinskia@physics.uc.edu>

        * archive.c: Fix all the warnings about passing unsigned char*
        to char* and the other way too.

From-SVN: r88758
parent ea3c4ca8
2004-10-08 Andrew Pinski <pinskia@physics.uc.edu>
* archive.c: Fix all the warnings about passing unsigned char*
to char* and the other way too.
2004-09-16 Andrew Pinski <pinskia@physics.uc.edu> 2004-09-16 Andrew Pinski <pinskia@physics.uc.edu>
PR libobjc/16448 PR libobjc/16448
......
...@@ -84,7 +84,7 @@ objc_write_unsigned_char (struct objc_typed_stream *stream, ...@@ -84,7 +84,7 @@ objc_write_unsigned_char (struct objc_typed_stream *stream,
{ {
unsigned char buf[sizeof (unsigned char) + 1]; unsigned char buf[sizeof (unsigned char) + 1];
int len = __objc_code_unsigned_char (buf, value); int len = __objc_code_unsigned_char (buf, value);
return (*stream->write) (stream->physical, buf, len); return (*stream->write) (stream->physical, (char*)buf, len);
} }
static inline int static inline int
...@@ -105,7 +105,7 @@ objc_write_char (struct objc_typed_stream *stream, signed char value) ...@@ -105,7 +105,7 @@ objc_write_char (struct objc_typed_stream *stream, signed char value)
{ {
unsigned char buf[sizeof (char) + 1]; unsigned char buf[sizeof (char) + 1];
int len = __objc_code_char (buf, value); int len = __objc_code_char (buf, value);
return (*stream->write) (stream->physical, buf, len); return (*stream->write) (stream->physical, (char*)buf, len);
} }
static inline int static inline int
...@@ -143,7 +143,7 @@ objc_write_unsigned_short (struct objc_typed_stream *stream, ...@@ -143,7 +143,7 @@ objc_write_unsigned_short (struct objc_typed_stream *stream,
{ {
unsigned char buf[sizeof (unsigned short) + 1]; unsigned char buf[sizeof (unsigned short) + 1];
int len = __objc_code_unsigned_short (buf, value); int len = __objc_code_unsigned_short (buf, value);
return (*stream->write) (stream->physical, buf, len); return (*stream->write) (stream->physical, (char*)buf, len);
} }
static inline int static inline int
...@@ -161,7 +161,7 @@ objc_write_short (struct objc_typed_stream *stream, short value) ...@@ -161,7 +161,7 @@ objc_write_short (struct objc_typed_stream *stream, short value)
{ {
unsigned char buf[sizeof (short) + 1]; unsigned char buf[sizeof (short) + 1];
int len = __objc_code_short (buf, value); int len = __objc_code_short (buf, value);
return (*stream->write) (stream->physical, buf, len); return (*stream->write) (stream->physical, (char*)buf, len);
} }
...@@ -199,7 +199,7 @@ objc_write_unsigned_int (struct objc_typed_stream *stream, unsigned int value) ...@@ -199,7 +199,7 @@ objc_write_unsigned_int (struct objc_typed_stream *stream, unsigned int value)
{ {
unsigned char buf[sizeof (unsigned int) + 1]; unsigned char buf[sizeof (unsigned int) + 1];
int len = __objc_code_unsigned_int (buf, value); int len = __objc_code_unsigned_int (buf, value);
return (*stream->write) (stream->physical, buf, len); return (*stream->write) (stream->physical, (char*)buf, len);
} }
static inline int static inline int
...@@ -217,7 +217,7 @@ objc_write_int (struct objc_typed_stream *stream, int value) ...@@ -217,7 +217,7 @@ objc_write_int (struct objc_typed_stream *stream, int value)
{ {
unsigned char buf[sizeof (int) + 1]; unsigned char buf[sizeof (int) + 1];
int len = __objc_code_int (buf, value); int len = __objc_code_int (buf, value);
return (*stream->write) (stream->physical, buf, len); return (*stream->write) (stream->physical, (char*)buf, len);
} }
static inline int static inline int
...@@ -255,7 +255,7 @@ objc_write_unsigned_long (struct objc_typed_stream *stream, ...@@ -255,7 +255,7 @@ objc_write_unsigned_long (struct objc_typed_stream *stream,
{ {
unsigned char buf[sizeof (unsigned long) + 1]; unsigned char buf[sizeof (unsigned long) + 1];
int len = __objc_code_unsigned_long (buf, value); int len = __objc_code_unsigned_long (buf, value);
return (*stream->write) (stream->physical, buf, len); return (*stream->write) (stream->physical, (char*)buf, len);
} }
static inline int static inline int
...@@ -273,7 +273,7 @@ objc_write_long (struct objc_typed_stream *stream, long value) ...@@ -273,7 +273,7 @@ objc_write_long (struct objc_typed_stream *stream, long value)
{ {
unsigned char buf[sizeof (long) + 1]; unsigned char buf[sizeof (long) + 1];
int len = __objc_code_long (buf, value); int len = __objc_code_long (buf, value);
return (*stream->write) (stream->physical, buf, len); return (*stream->write) (stream->physical, (char*)buf, len);
} }
...@@ -290,8 +290,8 @@ objc_write_string (struct objc_typed_stream *stream, ...@@ -290,8 +290,8 @@ objc_write_string (struct objc_typed_stream *stream,
else /* _B_NINT */ else /* _B_NINT */
buf[0] = (buf[0]&_B_VALUE)|_B_NSTR; buf[0] = (buf[0]&_B_VALUE)|_B_NSTR;
if ((*stream->write) (stream->physical, buf, len) != 0) if ((*stream->write) (stream->physical, (char*)buf, len) != 0)
return (*stream->write) (stream->physical, string, nbytes); return (*stream->write) (stream->physical, (char*)string, nbytes);
else else
return 0; return 0;
} }
...@@ -323,12 +323,12 @@ objc_write_register_common (struct objc_typed_stream *stream, ...@@ -323,12 +323,12 @@ objc_write_register_common (struct objc_typed_stream *stream,
{ {
buf[0] = _B_RCOMM|0x01; buf[0] = _B_RCOMM|0x01;
buf[1] &= _B_VALUE; buf[1] &= _B_VALUE;
return (*stream->write) (stream->physical, buf, len + 1); return (*stream->write) (stream->physical, (char*)buf, len + 1);
} }
else else
{ {
buf[1] = (buf[1]&_B_VALUE)|_B_RCOMM; buf[1] = (buf[1]&_B_VALUE)|_B_RCOMM;
return (*stream->write) (stream->physical, buf + 1, len); return (*stream->write) (stream->physical, (char*)buf + 1, len);
} }
} }
...@@ -341,12 +341,12 @@ objc_write_use_common (struct objc_typed_stream *stream, unsigned long key) ...@@ -341,12 +341,12 @@ objc_write_use_common (struct objc_typed_stream *stream, unsigned long key)
{ {
buf[0] = _B_UCOMM|0x01; buf[0] = _B_UCOMM|0x01;
buf[1] &= _B_VALUE; buf[1] &= _B_VALUE;
return (*stream->write) (stream->physical, buf, 2); return (*stream->write) (stream->physical, (char*)buf, 2);
} }
else else
{ {
buf[1] = (buf[1]&_B_VALUE)|_B_UCOMM; buf[1] = (buf[1]&_B_VALUE)|_B_UCOMM;
return (*stream->write) (stream->physical, buf + 1, len); return (*stream->write) (stream->physical, (char*)buf + 1, len);
} }
} }
...@@ -356,7 +356,7 @@ __objc_write_extension (struct objc_typed_stream *stream, unsigned char code) ...@@ -356,7 +356,7 @@ __objc_write_extension (struct objc_typed_stream *stream, unsigned char code)
if (code <= _B_VALUE) if (code <= _B_VALUE)
{ {
unsigned char buf = code|_B_EXT; unsigned char buf = code|_B_EXT;
return (*stream->write) (stream->physical, &buf, 1); return (*stream->write) (stream->physical, (char*)&buf, 1);
} }
else else
{ {
...@@ -376,7 +376,7 @@ __objc_write_object (struct objc_typed_stream *stream, id object) ...@@ -376,7 +376,7 @@ __objc_write_object (struct objc_typed_stream *stream, id object)
__objc_write_extension (stream, _BX_OBJECT); __objc_write_extension (stream, _BX_OBJECT);
objc_write_class (stream, object->class_pointer); objc_write_class (stream, object->class_pointer);
(*objc_msg_lookup (object, write_sel)) (object, write_sel, stream); (*objc_msg_lookup (object, write_sel)) (object, write_sel, stream);
return (*stream->write) (stream->physical, &buf, 1); return (*stream->write) (stream->physical, (char*)&buf, 1);
} }
else else
return objc_write_use_common (stream, 0); return objc_write_use_common (stream, 0);
...@@ -435,7 +435,7 @@ inline int ...@@ -435,7 +435,7 @@ inline int
__objc_write_class (struct objc_typed_stream *stream, struct objc_class *class) __objc_write_class (struct objc_typed_stream *stream, struct objc_class *class)
{ {
__objc_write_extension (stream, _BX_CLASS); __objc_write_extension (stream, _BX_CLASS);
objc_write_string_atomic (stream, (char *) class->name, objc_write_string_atomic (stream, (unsigned char *) class->name,
strlen ((char *) class->name)); strlen ((char *) class->name));
return objc_write_unsigned_long (stream, class->version); return objc_write_unsigned_long (stream, class->version);
} }
...@@ -466,9 +466,9 @@ __objc_write_selector (struct objc_typed_stream *stream, SEL selector) ...@@ -466,9 +466,9 @@ __objc_write_selector (struct objc_typed_stream *stream, SEL selector)
__objc_write_extension (stream, _BX_SEL); __objc_write_extension (stream, _BX_SEL);
/* to handle NULL selectors */ /* to handle NULL selectors */
if ((SEL)0 == selector) if ((SEL)0 == selector)
return objc_write_string (stream, "", 0); return objc_write_string (stream, (unsigned char*)"", 0);
sel_name = sel_get_name (selector); sel_name = sel_get_name (selector);
return objc_write_string (stream, sel_name, strlen ((char*)sel_name)); return objc_write_string (stream, (unsigned char*)sel_name, strlen ((char*)sel_name));
} }
int int
...@@ -506,7 +506,7 @@ objc_read_char (struct objc_typed_stream *stream, char *val) ...@@ -506,7 +506,7 @@ objc_read_char (struct objc_typed_stream *stream, char *val)
{ {
unsigned char buf; unsigned char buf;
int len; int len;
len = (*stream->read) (stream->physical, &buf, 1); len = (*stream->read) (stream->physical, (char*)&buf, 1);
if (len != 0) if (len != 0)
{ {
if ((buf & _B_CODE) == _B_SINT) if ((buf & _B_CODE) == _B_SINT)
...@@ -533,13 +533,13 @@ objc_read_unsigned_char (struct objc_typed_stream *stream, unsigned char *val) ...@@ -533,13 +533,13 @@ objc_read_unsigned_char (struct objc_typed_stream *stream, unsigned char *val)
{ {
unsigned char buf; unsigned char buf;
int len; int len;
if ((len = (*stream->read) (stream->physical, &buf, 1))) if ((len = (*stream->read) (stream->physical, (char*)&buf, 1)))
{ {
if ((buf & _B_CODE) == _B_SINT) if ((buf & _B_CODE) == _B_SINT)
(*val) = (buf & _B_VALUE); (*val) = (buf & _B_VALUE);
else if ((buf & _B_NUMBER) == 1) else if ((buf & _B_NUMBER) == 1)
len = (*stream->read) (stream->physical, val, 1); len = (*stream->read) (stream->physical, (char*)val, 1);
else else
objc_error (nil, OBJC_ERR_BAD_DATA, objc_error (nil, OBJC_ERR_BAD_DATA,
...@@ -554,7 +554,7 @@ objc_read_short (struct objc_typed_stream *stream, short *value) ...@@ -554,7 +554,7 @@ objc_read_short (struct objc_typed_stream *stream, short *value)
{ {
unsigned char buf[sizeof (short) + 1]; unsigned char buf[sizeof (short) + 1];
int len; int len;
if ((len = (*stream->read) (stream->physical, buf, 1))) if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{ {
if ((buf[0] & _B_CODE) == _B_SINT) if ((buf[0] & _B_CODE) == _B_SINT)
(*value) = (buf[0] & _B_VALUE); (*value) = (buf[0] & _B_VALUE);
...@@ -566,7 +566,7 @@ objc_read_short (struct objc_typed_stream *stream, short *value) ...@@ -566,7 +566,7 @@ objc_read_short (struct objc_typed_stream *stream, short *value)
if (nbytes > (int) sizeof (short)) if (nbytes > (int) sizeof (short))
objc_error (nil, OBJC_ERR_BAD_DATA, objc_error (nil, OBJC_ERR_BAD_DATA,
"expected short, got bigger (%dbits)", nbytes*8); "expected short, got bigger (%dbits)", nbytes*8);
len = (*stream->read) (stream->physical, buf + 1, nbytes); len = (*stream->read) (stream->physical, (char*)buf + 1, nbytes);
(*value) = 0; (*value) = 0;
while (pos <= nbytes) while (pos <= nbytes)
(*value) = ((*value)*0x100) + buf[pos++]; (*value) = ((*value)*0x100) + buf[pos++];
...@@ -583,7 +583,7 @@ objc_read_unsigned_short (struct objc_typed_stream *stream, ...@@ -583,7 +583,7 @@ objc_read_unsigned_short (struct objc_typed_stream *stream,
{ {
unsigned char buf[sizeof (unsigned short) + 1]; unsigned char buf[sizeof (unsigned short) + 1];
int len; int len;
if ((len = (*stream->read) (stream->physical, buf, 1))) if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{ {
if ((buf[0] & _B_CODE) == _B_SINT) if ((buf[0] & _B_CODE) == _B_SINT)
(*value) = (buf[0] & _B_VALUE); (*value) = (buf[0] & _B_VALUE);
...@@ -595,7 +595,7 @@ objc_read_unsigned_short (struct objc_typed_stream *stream, ...@@ -595,7 +595,7 @@ objc_read_unsigned_short (struct objc_typed_stream *stream,
if (nbytes > (int) sizeof (short)) if (nbytes > (int) sizeof (short))
objc_error (nil, OBJC_ERR_BAD_DATA, objc_error (nil, OBJC_ERR_BAD_DATA,
"expected short, got int or bigger"); "expected short, got int or bigger");
len = (*stream->read) (stream->physical, buf + 1, nbytes); len = (*stream->read) (stream->physical, (char*)buf + 1, nbytes);
(*value) = 0; (*value) = 0;
while (pos <= nbytes) while (pos <= nbytes)
(*value) = ((*value)*0x100) + buf[pos++]; (*value) = ((*value)*0x100) + buf[pos++];
...@@ -610,7 +610,7 @@ objc_read_int (struct objc_typed_stream *stream, int *value) ...@@ -610,7 +610,7 @@ objc_read_int (struct objc_typed_stream *stream, int *value)
{ {
unsigned char buf[sizeof (int) + 1]; unsigned char buf[sizeof (int) + 1];
int len; int len;
if ((len = (*stream->read) (stream->physical, buf, 1))) if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{ {
if ((buf[0] & _B_CODE) == _B_SINT) if ((buf[0] & _B_CODE) == _B_SINT)
(*value) = (buf[0] & _B_VALUE); (*value) = (buf[0] & _B_VALUE);
...@@ -621,7 +621,7 @@ objc_read_int (struct objc_typed_stream *stream, int *value) ...@@ -621,7 +621,7 @@ objc_read_int (struct objc_typed_stream *stream, int *value)
int nbytes = buf[0] & _B_NUMBER; int nbytes = buf[0] & _B_NUMBER;
if (nbytes > (int) sizeof (int)) if (nbytes > (int) sizeof (int))
objc_error (nil, OBJC_ERR_BAD_DATA, "expected int, got bigger"); objc_error (nil, OBJC_ERR_BAD_DATA, "expected int, got bigger");
len = (*stream->read) (stream->physical, buf + 1, nbytes); len = (*stream->read) (stream->physical, (char*)buf + 1, nbytes);
(*value) = 0; (*value) = 0;
while (pos <= nbytes) while (pos <= nbytes)
(*value) = ((*value)*0x100) + buf[pos++]; (*value) = ((*value)*0x100) + buf[pos++];
...@@ -637,7 +637,7 @@ objc_read_long (struct objc_typed_stream *stream, long *value) ...@@ -637,7 +637,7 @@ objc_read_long (struct objc_typed_stream *stream, long *value)
{ {
unsigned char buf[sizeof (long) + 1]; unsigned char buf[sizeof (long) + 1];
int len; int len;
if ((len = (*stream->read) (stream->physical, buf, 1))) if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{ {
if ((buf[0] & _B_CODE) == _B_SINT) if ((buf[0] & _B_CODE) == _B_SINT)
(*value) = (buf[0] & _B_VALUE); (*value) = (buf[0] & _B_VALUE);
...@@ -648,7 +648,7 @@ objc_read_long (struct objc_typed_stream *stream, long *value) ...@@ -648,7 +648,7 @@ objc_read_long (struct objc_typed_stream *stream, long *value)
int nbytes = buf[0] & _B_NUMBER; int nbytes = buf[0] & _B_NUMBER;
if (nbytes > (int) sizeof (long)) if (nbytes > (int) sizeof (long))
objc_error (nil, OBJC_ERR_BAD_DATA, "expected long, got bigger"); objc_error (nil, OBJC_ERR_BAD_DATA, "expected long, got bigger");
len = (*stream->read) (stream->physical, buf + 1, nbytes); len = (*stream->read) (stream->physical, (char*)buf + 1, nbytes);
(*value) = 0; (*value) = 0;
while (pos <= nbytes) while (pos <= nbytes)
(*value) = ((*value)*0x100) + buf[pos++]; (*value) = ((*value)*0x100) + buf[pos++];
...@@ -670,7 +670,7 @@ __objc_read_nbyte_uint (struct objc_typed_stream *stream, ...@@ -670,7 +670,7 @@ __objc_read_nbyte_uint (struct objc_typed_stream *stream,
if (nbytes > sizeof (int)) if (nbytes > sizeof (int))
objc_error (nil, OBJC_ERR_BAD_DATA, "expected int, got bigger"); objc_error (nil, OBJC_ERR_BAD_DATA, "expected int, got bigger");
len = (*stream->read) (stream->physical, buf, nbytes); len = (*stream->read) (stream->physical, (char*)buf, nbytes);
(*val) = 0; (*val) = 0;
while (pos < nbytes) while (pos < nbytes)
(*val) = ((*val)*0x100) + buf[pos++]; (*val) = ((*val)*0x100) + buf[pos++];
...@@ -684,7 +684,7 @@ objc_read_unsigned_int (struct objc_typed_stream *stream, ...@@ -684,7 +684,7 @@ objc_read_unsigned_int (struct objc_typed_stream *stream,
{ {
unsigned char buf[sizeof (unsigned int) + 1]; unsigned char buf[sizeof (unsigned int) + 1];
int len; int len;
if ((len = (*stream->read) (stream->physical, buf, 1))) if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{ {
if ((buf[0] & _B_CODE) == _B_SINT) if ((buf[0] & _B_CODE) == _B_SINT)
(*value) = (buf[0] & _B_VALUE); (*value) = (buf[0] & _B_VALUE);
...@@ -707,7 +707,7 @@ __objc_read_nbyte_ulong (struct objc_typed_stream *stream, ...@@ -707,7 +707,7 @@ __objc_read_nbyte_ulong (struct objc_typed_stream *stream,
if (nbytes > sizeof (long)) if (nbytes > sizeof (long))
objc_error (nil, OBJC_ERR_BAD_DATA, "expected long, got bigger"); objc_error (nil, OBJC_ERR_BAD_DATA, "expected long, got bigger");
len = (*stream->read) (stream->physical, buf, nbytes); len = (*stream->read) (stream->physical, (char*)buf, nbytes);
(*val) = 0; (*val) = 0;
while (pos < nbytes) while (pos < nbytes)
(*val) = ((*val)*0x100) + buf[pos++]; (*val) = ((*val)*0x100) + buf[pos++];
...@@ -721,7 +721,7 @@ objc_read_unsigned_long (struct objc_typed_stream *stream, ...@@ -721,7 +721,7 @@ objc_read_unsigned_long (struct objc_typed_stream *stream,
{ {
unsigned char buf[sizeof (unsigned long) + 1]; unsigned char buf[sizeof (unsigned long) + 1];
int len; int len;
if ((len = (*stream->read) (stream->physical, buf, 1))) if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{ {
if ((buf[0] & _B_CODE) == _B_SINT) if ((buf[0] & _B_CODE) == _B_SINT)
(*value) = (buf[0] & _B_VALUE); (*value) = (buf[0] & _B_VALUE);
...@@ -739,14 +739,14 @@ objc_read_string (struct objc_typed_stream *stream, ...@@ -739,14 +739,14 @@ objc_read_string (struct objc_typed_stream *stream,
{ {
unsigned char buf[sizeof (unsigned int) + 1]; unsigned char buf[sizeof (unsigned int) + 1];
int len; int len;
if ((len = (*stream->read) (stream->physical, buf, 1))) if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{ {
unsigned long key = 0; unsigned long key = 0;
if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */
{ {
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key); len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
len = (*stream->read) (stream->physical, buf, 1); len = (*stream->read) (stream->physical, (char*)buf, 1);
} }
switch (buf[0]&_B_CODE) { switch (buf[0]&_B_CODE) {
...@@ -800,7 +800,7 @@ objc_read_object (struct objc_typed_stream *stream, id *object) ...@@ -800,7 +800,7 @@ objc_read_object (struct objc_typed_stream *stream, id *object)
{ {
unsigned char buf[sizeof (unsigned int)]; unsigned char buf[sizeof (unsigned int)];
int len; int len;
if ((len = (*stream->read) (stream->physical, buf, 1))) if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{ {
SEL read_sel = sel_get_any_uid ("read:"); SEL read_sel = sel_get_any_uid ("read:");
unsigned long key = 0; unsigned long key = 0;
...@@ -808,7 +808,7 @@ objc_read_object (struct objc_typed_stream *stream, id *object) ...@@ -808,7 +808,7 @@ objc_read_object (struct objc_typed_stream *stream, id *object)
if ((buf[0]&_B_CODE) == _B_RCOMM) /* register common */ if ((buf[0]&_B_CODE) == _B_RCOMM) /* register common */
{ {
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key); len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
len = (*stream->read) (stream->physical, buf, 1); len = (*stream->read) (stream->physical, (char*)buf, 1);
} }
if (buf[0] == (_B_EXT | _BX_OBJECT)) if (buf[0] == (_B_EXT | _BX_OBJECT))
...@@ -830,7 +830,7 @@ objc_read_object (struct objc_typed_stream *stream, id *object) ...@@ -830,7 +830,7 @@ objc_read_object (struct objc_typed_stream *stream, id *object)
(*get_imp (class, read_sel)) (*object, read_sel, stream); (*get_imp (class, read_sel)) (*object, read_sel, stream);
/* check null-byte */ /* check null-byte */
len = (*stream->read) (stream->physical, buf, 1); len = (*stream->read) (stream->physical, (char*)buf, 1);
if (buf[0] != '\0') if (buf[0] != '\0')
objc_error (nil, OBJC_ERR_BAD_DATA, objc_error (nil, OBJC_ERR_BAD_DATA,
"expected null-byte, got opcode %c", buf[0]); "expected null-byte, got opcode %c", buf[0]);
...@@ -875,19 +875,20 @@ objc_read_class (struct objc_typed_stream *stream, Class *class) ...@@ -875,19 +875,20 @@ objc_read_class (struct objc_typed_stream *stream, Class *class)
{ {
unsigned char buf[sizeof (unsigned int)]; unsigned char buf[sizeof (unsigned int)];
int len; int len;
if ((len = (*stream->read) (stream->physical, buf, 1))) if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{ {
unsigned long key = 0; unsigned long key = 0;
if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */
{ {
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key); len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
len = (*stream->read) (stream->physical, buf, 1); len = (*stream->read) (stream->physical, (char*)buf, 1);
} }
if (buf[0] == (_B_EXT | _BX_CLASS)) if (buf[0] == (_B_EXT | _BX_CLASS))
{ {
char *class_name = ""; char temp[1] = "";
char *class_name = temp;
unsigned long version; unsigned long version;
/* get class */ /* get class */
...@@ -926,19 +927,20 @@ objc_read_selector (struct objc_typed_stream *stream, SEL* selector) ...@@ -926,19 +927,20 @@ objc_read_selector (struct objc_typed_stream *stream, SEL* selector)
{ {
unsigned char buf[sizeof (unsigned int)]; unsigned char buf[sizeof (unsigned int)];
int len; int len;
if ((len = (*stream->read) (stream->physical, buf, 1))) if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{ {
unsigned long key = 0; unsigned long key = 0;
if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */
{ {
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key); len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
len = (*stream->read) (stream->physical, buf, 1); len = (*stream->read) (stream->physical, (char*)buf, 1);
} }
if (buf[0] == (_B_EXT|_BX_SEL)) /* selector! */ if (buf[0] == (_B_EXT|_BX_SEL)) /* selector! */
{ {
char *selector_name = ""; char temp[1] = "";
char *selector_name = temp;
/* get selector */ /* get selector */
len = objc_read_string (stream, &selector_name); len = objc_read_string (stream, &selector_name);
...@@ -1032,11 +1034,11 @@ objc_write_type (TypedStream *stream, const char *type, const void *data) ...@@ -1032,11 +1034,11 @@ objc_write_type (TypedStream *stream, const char *type, const void *data)
case _C_CHARPTR: case _C_CHARPTR:
return objc_write_string (stream, return objc_write_string (stream,
*(char **) data, strlen (*(char **) data)); *(unsigned char **) data, strlen (*(char **) data));
break; break;
case _C_ATOM: case _C_ATOM:
return objc_write_string_atomic (stream, *(char **) data, return objc_write_string_atomic (stream, *(unsigned char **) data,
strlen (*(char **) data)); strlen (*(char **) data));
break; break;
...@@ -1241,15 +1243,15 @@ objc_write_types (TypedStream *stream, const char *type, ...) ...@@ -1241,15 +1243,15 @@ objc_write_types (TypedStream *stream, const char *type, ...)
case _C_CHARPTR: case _C_CHARPTR:
{ {
char **str = va_arg (args, char **); unsigned char **str = va_arg (args, unsigned char **);
res = objc_write_string (stream, *str, strlen (*str)); res = objc_write_string (stream, *str, strlen ((char*)*str));
} }
break; break;
case _C_ATOM: case _C_ATOM:
{ {
char **str = va_arg (args, char **); unsigned char **str = va_arg (args, unsigned char **);
res = objc_write_string_atomic (stream, *str, strlen (*str)); res = objc_write_string_atomic (stream, *str, strlen ((char*)*str));
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment