diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2004-10-08 14:40:38 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2004-10-08 07:40:38 -0700 |
commit | 8d488306cbde45ed18c6c98edd1107ca7ed23850 (patch) | |
tree | 2b4814a6fef8f05a50646e6438a475fdfb5ced18 /libobjc | |
parent | ea3c4ca872e8fe9e5efbc1b299ec4df34a8d4890 (diff) | |
download | gcc-8d488306cbde45ed18c6c98edd1107ca7ed23850.zip gcc-8d488306cbde45ed18c6c98edd1107ca7ed23850.tar.gz gcc-8d488306cbde45ed18c6c98edd1107ca7ed23850.tar.bz2 |
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
Diffstat (limited to 'libobjc')
-rw-r--r-- | libobjc/ChangeLog | 5 | ||||
-rw-r--r-- | libobjc/archive.c | 104 |
2 files changed, 58 insertions, 51 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index 3c8017a..8f06ee8 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,8 @@ +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> PR libobjc/16448 diff --git a/libobjc/archive.c b/libobjc/archive.c index b6a1ec3..096ca69 100644 --- a/libobjc/archive.c +++ b/libobjc/archive.c @@ -84,7 +84,7 @@ objc_write_unsigned_char (struct objc_typed_stream *stream, { unsigned char buf[sizeof (unsigned char) + 1]; 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 @@ -105,7 +105,7 @@ objc_write_char (struct objc_typed_stream *stream, signed char value) { unsigned char buf[sizeof (char) + 1]; 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 @@ -143,7 +143,7 @@ objc_write_unsigned_short (struct objc_typed_stream *stream, { unsigned char buf[sizeof (unsigned short) + 1]; 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 @@ -161,7 +161,7 @@ objc_write_short (struct objc_typed_stream *stream, short value) { unsigned char buf[sizeof (short) + 1]; 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) { unsigned char buf[sizeof (unsigned int) + 1]; 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 @@ -217,7 +217,7 @@ objc_write_int (struct objc_typed_stream *stream, int value) { unsigned char buf[sizeof (int) + 1]; 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 @@ -255,7 +255,7 @@ objc_write_unsigned_long (struct objc_typed_stream *stream, { unsigned char buf[sizeof (unsigned long) + 1]; 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 @@ -273,7 +273,7 @@ objc_write_long (struct objc_typed_stream *stream, long value) { unsigned char buf[sizeof (long) + 1]; 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, else /* _B_NINT */ buf[0] = (buf[0]&_B_VALUE)|_B_NSTR; - if ((*stream->write) (stream->physical, buf, len) != 0) - return (*stream->write) (stream->physical, string, nbytes); + if ((*stream->write) (stream->physical, (char*)buf, len) != 0) + return (*stream->write) (stream->physical, (char*)string, nbytes); else return 0; } @@ -323,12 +323,12 @@ objc_write_register_common (struct objc_typed_stream *stream, { buf[0] = _B_RCOMM|0x01; buf[1] &= _B_VALUE; - return (*stream->write) (stream->physical, buf, len + 1); + return (*stream->write) (stream->physical, (char*)buf, len + 1); } else { 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) { buf[0] = _B_UCOMM|0x01; buf[1] &= _B_VALUE; - return (*stream->write) (stream->physical, buf, 2); + return (*stream->write) (stream->physical, (char*)buf, 2); } else { 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) if (code <= _B_VALUE) { unsigned char buf = code|_B_EXT; - return (*stream->write) (stream->physical, &buf, 1); + return (*stream->write) (stream->physical, (char*)&buf, 1); } else { @@ -376,7 +376,7 @@ __objc_write_object (struct objc_typed_stream *stream, id object) __objc_write_extension (stream, _BX_OBJECT); objc_write_class (stream, object->class_pointer); (*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 return objc_write_use_common (stream, 0); @@ -435,7 +435,7 @@ inline int __objc_write_class (struct objc_typed_stream *stream, struct objc_class *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)); return objc_write_unsigned_long (stream, class->version); } @@ -466,9 +466,9 @@ __objc_write_selector (struct objc_typed_stream *stream, SEL selector) __objc_write_extension (stream, _BX_SEL); /* to handle NULL selectors */ if ((SEL)0 == selector) - return objc_write_string (stream, "", 0); + return objc_write_string (stream, (unsigned char*)"", 0); 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 @@ -506,7 +506,7 @@ objc_read_char (struct objc_typed_stream *stream, char *val) { unsigned char buf; int len; - len = (*stream->read) (stream->physical, &buf, 1); + len = (*stream->read) (stream->physical, (char*)&buf, 1); if (len != 0) { if ((buf & _B_CODE) == _B_SINT) @@ -533,13 +533,13 @@ objc_read_unsigned_char (struct objc_typed_stream *stream, unsigned char *val) { unsigned char buf; 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) (*val) = (buf & _B_VALUE); else if ((buf & _B_NUMBER) == 1) - len = (*stream->read) (stream->physical, val, 1); + len = (*stream->read) (stream->physical, (char*)val, 1); else objc_error (nil, OBJC_ERR_BAD_DATA, @@ -554,7 +554,7 @@ objc_read_short (struct objc_typed_stream *stream, short *value) { unsigned char buf[sizeof (short) + 1]; 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) (*value) = (buf[0] & _B_VALUE); @@ -566,7 +566,7 @@ objc_read_short (struct objc_typed_stream *stream, short *value) if (nbytes > (int) sizeof (short)) objc_error (nil, OBJC_ERR_BAD_DATA, "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; while (pos <= nbytes) (*value) = ((*value)*0x100) + buf[pos++]; @@ -583,7 +583,7 @@ objc_read_unsigned_short (struct objc_typed_stream *stream, { unsigned char buf[sizeof (unsigned short) + 1]; 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) (*value) = (buf[0] & _B_VALUE); @@ -595,7 +595,7 @@ objc_read_unsigned_short (struct objc_typed_stream *stream, if (nbytes > (int) sizeof (short)) objc_error (nil, OBJC_ERR_BAD_DATA, "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; while (pos <= nbytes) (*value) = ((*value)*0x100) + buf[pos++]; @@ -610,7 +610,7 @@ objc_read_int (struct objc_typed_stream *stream, int *value) { unsigned char buf[sizeof (int) + 1]; 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) (*value) = (buf[0] & _B_VALUE); @@ -621,7 +621,7 @@ objc_read_int (struct objc_typed_stream *stream, int *value) int nbytes = buf[0] & _B_NUMBER; if (nbytes > (int) sizeof (int)) 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; while (pos <= nbytes) (*value) = ((*value)*0x100) + buf[pos++]; @@ -637,7 +637,7 @@ objc_read_long (struct objc_typed_stream *stream, long *value) { unsigned char buf[sizeof (long) + 1]; 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) (*value) = (buf[0] & _B_VALUE); @@ -648,7 +648,7 @@ objc_read_long (struct objc_typed_stream *stream, long *value) int nbytes = buf[0] & _B_NUMBER; if (nbytes > (int) sizeof (long)) 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; while (pos <= nbytes) (*value) = ((*value)*0x100) + buf[pos++]; @@ -670,7 +670,7 @@ __objc_read_nbyte_uint (struct objc_typed_stream *stream, if (nbytes > sizeof (int)) 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; while (pos < nbytes) (*val) = ((*val)*0x100) + buf[pos++]; @@ -684,7 +684,7 @@ objc_read_unsigned_int (struct objc_typed_stream *stream, { unsigned char buf[sizeof (unsigned int) + 1]; 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) (*value) = (buf[0] & _B_VALUE); @@ -707,7 +707,7 @@ __objc_read_nbyte_ulong (struct objc_typed_stream *stream, if (nbytes > sizeof (long)) 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; while (pos < nbytes) (*val) = ((*val)*0x100) + buf[pos++]; @@ -721,7 +721,7 @@ objc_read_unsigned_long (struct objc_typed_stream *stream, { unsigned char buf[sizeof (unsigned long) + 1]; 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) (*value) = (buf[0] & _B_VALUE); @@ -739,14 +739,14 @@ objc_read_string (struct objc_typed_stream *stream, { unsigned char buf[sizeof (unsigned int) + 1]; int len; - if ((len = (*stream->read) (stream->physical, buf, 1))) + if ((len = (*stream->read) (stream->physical, (char*)buf, 1))) { unsigned long key = 0; if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ { 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) { @@ -800,7 +800,7 @@ objc_read_object (struct objc_typed_stream *stream, id *object) { unsigned char buf[sizeof (unsigned int)]; 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:"); unsigned long key = 0; @@ -808,7 +808,7 @@ objc_read_object (struct objc_typed_stream *stream, id *object) if ((buf[0]&_B_CODE) == _B_RCOMM) /* register common */ { 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)) @@ -830,7 +830,7 @@ objc_read_object (struct objc_typed_stream *stream, id *object) (*get_imp (class, read_sel)) (*object, read_sel, stream); /* check null-byte */ - len = (*stream->read) (stream->physical, buf, 1); + len = (*stream->read) (stream->physical, (char*)buf, 1); if (buf[0] != '\0') objc_error (nil, OBJC_ERR_BAD_DATA, "expected null-byte, got opcode %c", buf[0]); @@ -875,19 +875,20 @@ objc_read_class (struct objc_typed_stream *stream, Class *class) { unsigned char buf[sizeof (unsigned int)]; int len; - if ((len = (*stream->read) (stream->physical, buf, 1))) + if ((len = (*stream->read) (stream->physical, (char*)buf, 1))) { unsigned long key = 0; if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ { 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)) { - char *class_name = ""; + char temp[1] = ""; + char *class_name = temp; unsigned long version; /* get class */ @@ -926,19 +927,20 @@ objc_read_selector (struct objc_typed_stream *stream, SEL* selector) { unsigned char buf[sizeof (unsigned int)]; int len; - if ((len = (*stream->read) (stream->physical, buf, 1))) + if ((len = (*stream->read) (stream->physical, (char*)buf, 1))) { unsigned long key = 0; if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ { 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! */ { - char *selector_name = ""; + char temp[1] = ""; + char *selector_name = temp; /* get selector */ len = objc_read_string (stream, &selector_name); @@ -1032,11 +1034,11 @@ objc_write_type (TypedStream *stream, const char *type, const void *data) case _C_CHARPTR: return objc_write_string (stream, - *(char **) data, strlen (*(char **) data)); + *(unsigned char **) data, strlen (*(char **) data)); break; case _C_ATOM: - return objc_write_string_atomic (stream, *(char **) data, + return objc_write_string_atomic (stream, *(unsigned char **) data, strlen (*(char **) data)); break; @@ -1241,15 +1243,15 @@ objc_write_types (TypedStream *stream, const char *type, ...) case _C_CHARPTR: { - char **str = va_arg (args, char **); - res = objc_write_string (stream, *str, strlen (*str)); + unsigned char **str = va_arg (args, unsigned char **); + res = objc_write_string (stream, *str, strlen ((char*)*str)); } break; case _C_ATOM: { - char **str = va_arg (args, char **); - res = objc_write_string_atomic (stream, *str, strlen (*str)); + unsigned char **str = va_arg (args, unsigned char **); + res = objc_write_string_atomic (stream, *str, strlen ((char*)*str)); } break; |