Add some explicit casts-through-void* to silence warnings about casts that increase the alignment requirements of the pointee (mostly caused by using char* for arithmetic).

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32219 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Chisnall 2011-02-19 15:34:21 +00:00
parent de088f97a4
commit ddad542fb1
8 changed files with 25 additions and 21 deletions

View file

@ -50,7 +50,7 @@ static Class CXXExceptionClass;
// TODO: Add an API for registering other classes for other exception types
static Class boxClass(int64_t foo)
{
if (foo == *(int64_t*)"GNUCC++\0")
if (foo == *(int64_t*)(void*)"GNUCC++\0")
{
return CXXExceptionClass;
}
@ -75,7 +75,7 @@ static Class boxClass(int64_t foo)
{
char *ptr = (char*)ex;
ptr -= __builtin_offsetof(struct __cxa_exception, unwindHeader);
return ((struct __cxa_exception*)ptr)->exceptionType;
return ((struct __cxa_exception*)(void*)ptr)->exceptionType;
}
- (void) rethrow
{

View file

@ -1685,7 +1685,7 @@ NSDictionary *locale)
LABEL (form_strerror):
/* Print description of error ERRNO. */
errno = save_errno;
string = (unichar *)[[[NSError _last] localizedDescription]
string = (unichar *)(void*)[[[NSError _last] localizedDescription]
cStringUsingEncoding: NSUnicodeStringEncoding];
is_long = 1; /* This is a unicode string. */
goto LABEL (print_string);

View file

@ -809,7 +809,7 @@ static NSString * const GSSOCKSAckConn = @"GSSOCKSAckConn";
#endif /* AF_INET6 */
else
{
struct sockaddr_in *addr = (struct sockaddr_in*)[istream _address];
struct sockaddr_in *addr = (struct sockaddr_in*)(void*)[istream _address];
NSDictionary *conf;
NSString *host;
int pnum;

View file

@ -1840,7 +1840,7 @@ getCStringE_c(GSStr self, char *buffer, unsigned int maxLength,
if (maxLength >= sizeof(unichar))
{
unsigned bytes = maxLength - sizeof(unichar);
unichar *u = (unichar*)buffer;
unichar *u = (unichar*)(void*)buffer;
if (GSToUnicode(&u, &bytes, self->_contents.c, self->_count,
internalEncoding, NSDefaultMallocZone(), GSUniTerminate) == NO)
@ -1848,7 +1848,7 @@ getCStringE_c(GSStr self, char *buffer, unsigned int maxLength,
[NSException raise: NSCharacterConversionException
format: @"Can't convert to Unicode string."];
}
if (u == (unichar*)buffer)
if (u == (unichar*)(void*)buffer)
{
return YES;
}
@ -4136,7 +4136,7 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
}
length /= sizeof(unichar);
if (GSUnicode((unichar*)chars, length, &isASCII, &isLatin1) != length)
if (GSUnicode((unichar*)(void*)chars, length, &isASCII, &isLatin1) != length)
{
if (shouldFree == YES && chars != 0)
{
@ -4153,7 +4153,7 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
_flags.wide = 0;
while (length-- > 0)
{
_contents.c[length] = ((unichar*)chars)[length];
_contents.c[length] = ((unichar*)(void*)chars)[length];
}
if (shouldFree == YES && chars != 0)
{
@ -4166,7 +4166,7 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
if (shouldFree == YES)
{
_zone = NSZoneFromPointer(chars);
_contents.u = (unichar*)chars;
_contents.u = (unichar*)(void*)chars;
}
else
{

View file

@ -1221,13 +1221,17 @@ static NSUInteger _defaultBehavior = 0;
- (void) setRoundingIncrement: (NSNumber *) number
{
switch ([number objCType][0])
{
case 'd':
case 'f':
#if GS_USE_ICU == 1
if ([number class] == [NSDoubleNumber class])
unum_setDoubleAttribute (internal->_formatter, UNUM_ROUNDING_INCREMENT,
[number doubleValue]);
#else
return;
#endif
default:
return;
}
}
- (NSNumber *) roundingIncrement

View file

@ -1034,7 +1034,7 @@ static IMP _xRefImp; /* Serialize a crossref. */
#else
val = GSSwapBigI128ToHost(val);
#if GS_HAVE_I64
bigval = *(uint64_t*)&val;
bigval = *(uint64_t*)(void*)&val;
#else
bigval = *(uint32_t*)&val;
#endif

View file

@ -1265,7 +1265,7 @@ handle_printf_atsign (FILE *stream,
data_bytes = [d bytes];
if ((data_bytes != NULL) && (len >= 2))
{
const unichar *data_ucs2chars = (const unichar *) data_bytes;
const unichar *data_ucs2chars = (const unichar *)(void*) data_bytes;
if ((data_ucs2chars[0] == byteOrderMark)
|| (data_ucs2chars[0] == byteOrderMarkSwapped))
{
@ -1332,7 +1332,7 @@ handle_printf_atsign (FILE *stream,
data_bytes = [d bytes];
if ((data_bytes != NULL) && (len >= 2))
{
const unichar *data_ucs2chars = (const unichar *) data_bytes;
const unichar *data_ucs2chars = (const unichar *)(void*) data_bytes;
if ((data_ucs2chars[0] == byteOrderMark)
|| (data_ucs2chars[0] == byteOrderMarkSwapped))
{
@ -1434,7 +1434,7 @@ handle_printf_atsign (FILE *stream,
data_bytes = [d bytes];
if ((data_bytes != NULL) && (len >= 2))
{
const unichar *data_ucs2chars = (const unichar *) data_bytes;
const unichar *data_ucs2chars = (const unichar *)(void*) data_bytes;
if ((data_ucs2chars[0] == byteOrderMark)
|| (data_ucs2chars[0] == byteOrderMarkSwapped))
{
@ -1480,7 +1480,7 @@ handle_printf_atsign (FILE *stream,
data_bytes = [d bytes];
if ((data_bytes != NULL) && (len >= 2))
{
const unichar *data_ucs2chars = (const unichar *) data_bytes;
const unichar *data_ucs2chars = (const unichar *)(void*) data_bytes;
if ((data_ucs2chars[0] == byteOrderMark)
|| (data_ucs2chars[0] == byteOrderMarkSwapped))
{
@ -2931,7 +2931,7 @@ handle_printf_atsign (FILE *stream,
if (maxLength > length * sizeof(unichar))
{
unichar *ptr = (unichar*)buffer;
unichar *ptr = (unichar*)(void*)buffer;
maxLength = (maxLength - 1) / sizeof(unichar);
[self getCharacters: ptr

View file

@ -2894,9 +2894,9 @@ newDetailInZoneForType(GSTimeZone *zone, TypeInfo *type)
format: @"TZ_MAGIC is incorrect"];
}
#endif
n_trans = GSSwapBigI32ToHost(*(int32_t*)header->tzh_timecnt);
n_types = GSSwapBigI32ToHost(*(int32_t*)header->tzh_typecnt);
charcnt = GSSwapBigI32ToHost(*(int32_t*)header->tzh_charcnt);
n_trans = GSSwapBigI32ToHost(*(int32_t*)(void*)header->tzh_timecnt);
n_types = GSSwapBigI32ToHost(*(int32_t*)(void*)header->tzh_typecnt);
charcnt = GSSwapBigI32ToHost(*(int32_t*)(void*)header->tzh_charcnt);
i = pos;
i += sizeof(int32_t)*n_trans;