mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
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:
parent
56cdca569a
commit
f31000e770
8 changed files with 25 additions and 21 deletions
|
@ -50,7 +50,7 @@ static Class CXXExceptionClass;
|
||||||
// TODO: Add an API for registering other classes for other exception types
|
// TODO: Add an API for registering other classes for other exception types
|
||||||
static Class boxClass(int64_t foo)
|
static Class boxClass(int64_t foo)
|
||||||
{
|
{
|
||||||
if (foo == *(int64_t*)"GNUCC++\0")
|
if (foo == *(int64_t*)(void*)"GNUCC++\0")
|
||||||
{
|
{
|
||||||
return CXXExceptionClass;
|
return CXXExceptionClass;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ static Class boxClass(int64_t foo)
|
||||||
{
|
{
|
||||||
char *ptr = (char*)ex;
|
char *ptr = (char*)ex;
|
||||||
ptr -= __builtin_offsetof(struct __cxa_exception, unwindHeader);
|
ptr -= __builtin_offsetof(struct __cxa_exception, unwindHeader);
|
||||||
return ((struct __cxa_exception*)ptr)->exceptionType;
|
return ((struct __cxa_exception*)(void*)ptr)->exceptionType;
|
||||||
}
|
}
|
||||||
- (void) rethrow
|
- (void) rethrow
|
||||||
{
|
{
|
||||||
|
|
|
@ -1685,7 +1685,7 @@ NSDictionary *locale)
|
||||||
LABEL (form_strerror):
|
LABEL (form_strerror):
|
||||||
/* Print description of error ERRNO. */
|
/* Print description of error ERRNO. */
|
||||||
errno = save_errno;
|
errno = save_errno;
|
||||||
string = (unichar *)[[[NSError _last] localizedDescription]
|
string = (unichar *)(void*)[[[NSError _last] localizedDescription]
|
||||||
cStringUsingEncoding: NSUnicodeStringEncoding];
|
cStringUsingEncoding: NSUnicodeStringEncoding];
|
||||||
is_long = 1; /* This is a unicode string. */
|
is_long = 1; /* This is a unicode string. */
|
||||||
goto LABEL (print_string);
|
goto LABEL (print_string);
|
||||||
|
|
|
@ -809,7 +809,7 @@ static NSString * const GSSOCKSAckConn = @"GSSOCKSAckConn";
|
||||||
#endif /* AF_INET6 */
|
#endif /* AF_INET6 */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct sockaddr_in *addr = (struct sockaddr_in*)[istream _address];
|
struct sockaddr_in *addr = (struct sockaddr_in*)(void*)[istream _address];
|
||||||
NSDictionary *conf;
|
NSDictionary *conf;
|
||||||
NSString *host;
|
NSString *host;
|
||||||
int pnum;
|
int pnum;
|
||||||
|
|
|
@ -1840,7 +1840,7 @@ getCStringE_c(GSStr self, char *buffer, unsigned int maxLength,
|
||||||
if (maxLength >= sizeof(unichar))
|
if (maxLength >= sizeof(unichar))
|
||||||
{
|
{
|
||||||
unsigned bytes = 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,
|
if (GSToUnicode(&u, &bytes, self->_contents.c, self->_count,
|
||||||
internalEncoding, NSDefaultMallocZone(), GSUniTerminate) == NO)
|
internalEncoding, NSDefaultMallocZone(), GSUniTerminate) == NO)
|
||||||
|
@ -1848,7 +1848,7 @@ getCStringE_c(GSStr self, char *buffer, unsigned int maxLength,
|
||||||
[NSException raise: NSCharacterConversionException
|
[NSException raise: NSCharacterConversionException
|
||||||
format: @"Can't convert to Unicode string."];
|
format: @"Can't convert to Unicode string."];
|
||||||
}
|
}
|
||||||
if (u == (unichar*)buffer)
|
if (u == (unichar*)(void*)buffer)
|
||||||
{
|
{
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -4136,7 +4136,7 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
|
||||||
}
|
}
|
||||||
|
|
||||||
length /= sizeof(unichar);
|
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)
|
if (shouldFree == YES && chars != 0)
|
||||||
{
|
{
|
||||||
|
@ -4153,7 +4153,7 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
|
||||||
_flags.wide = 0;
|
_flags.wide = 0;
|
||||||
while (length-- > 0)
|
while (length-- > 0)
|
||||||
{
|
{
|
||||||
_contents.c[length] = ((unichar*)chars)[length];
|
_contents.c[length] = ((unichar*)(void*)chars)[length];
|
||||||
}
|
}
|
||||||
if (shouldFree == YES && chars != 0)
|
if (shouldFree == YES && chars != 0)
|
||||||
{
|
{
|
||||||
|
@ -4166,7 +4166,7 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
|
||||||
if (shouldFree == YES)
|
if (shouldFree == YES)
|
||||||
{
|
{
|
||||||
_zone = NSZoneFromPointer(chars);
|
_zone = NSZoneFromPointer(chars);
|
||||||
_contents.u = (unichar*)chars;
|
_contents.u = (unichar*)(void*)chars;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1221,13 +1221,17 @@ static NSUInteger _defaultBehavior = 0;
|
||||||
|
|
||||||
- (void) setRoundingIncrement: (NSNumber *) number
|
- (void) setRoundingIncrement: (NSNumber *) number
|
||||||
{
|
{
|
||||||
|
switch ([number objCType][0])
|
||||||
|
{
|
||||||
|
case 'd':
|
||||||
|
case 'f':
|
||||||
#if GS_USE_ICU == 1
|
#if GS_USE_ICU == 1
|
||||||
if ([number class] == [NSDoubleNumber class])
|
|
||||||
unum_setDoubleAttribute (internal->_formatter, UNUM_ROUNDING_INCREMENT,
|
unum_setDoubleAttribute (internal->_formatter, UNUM_ROUNDING_INCREMENT,
|
||||||
[number doubleValue]);
|
[number doubleValue]);
|
||||||
#else
|
|
||||||
return;
|
|
||||||
#endif
|
#endif
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSNumber *) roundingIncrement
|
- (NSNumber *) roundingIncrement
|
||||||
|
|
|
@ -1034,7 +1034,7 @@ static IMP _xRefImp; /* Serialize a crossref. */
|
||||||
#else
|
#else
|
||||||
val = GSSwapBigI128ToHost(val);
|
val = GSSwapBigI128ToHost(val);
|
||||||
#if GS_HAVE_I64
|
#if GS_HAVE_I64
|
||||||
bigval = *(uint64_t*)&val;
|
bigval = *(uint64_t*)(void*)&val;
|
||||||
#else
|
#else
|
||||||
bigval = *(uint32_t*)&val;
|
bigval = *(uint32_t*)&val;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1265,7 +1265,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
data_bytes = [d bytes];
|
data_bytes = [d bytes];
|
||||||
if ((data_bytes != NULL) && (len >= 2))
|
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)
|
if ((data_ucs2chars[0] == byteOrderMark)
|
||||||
|| (data_ucs2chars[0] == byteOrderMarkSwapped))
|
|| (data_ucs2chars[0] == byteOrderMarkSwapped))
|
||||||
{
|
{
|
||||||
|
@ -1332,7 +1332,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
data_bytes = [d bytes];
|
data_bytes = [d bytes];
|
||||||
if ((data_bytes != NULL) && (len >= 2))
|
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)
|
if ((data_ucs2chars[0] == byteOrderMark)
|
||||||
|| (data_ucs2chars[0] == byteOrderMarkSwapped))
|
|| (data_ucs2chars[0] == byteOrderMarkSwapped))
|
||||||
{
|
{
|
||||||
|
@ -1434,7 +1434,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
data_bytes = [d bytes];
|
data_bytes = [d bytes];
|
||||||
if ((data_bytes != NULL) && (len >= 2))
|
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)
|
if ((data_ucs2chars[0] == byteOrderMark)
|
||||||
|| (data_ucs2chars[0] == byteOrderMarkSwapped))
|
|| (data_ucs2chars[0] == byteOrderMarkSwapped))
|
||||||
{
|
{
|
||||||
|
@ -1480,7 +1480,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
data_bytes = [d bytes];
|
data_bytes = [d bytes];
|
||||||
if ((data_bytes != NULL) && (len >= 2))
|
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)
|
if ((data_ucs2chars[0] == byteOrderMark)
|
||||||
|| (data_ucs2chars[0] == byteOrderMarkSwapped))
|
|| (data_ucs2chars[0] == byteOrderMarkSwapped))
|
||||||
{
|
{
|
||||||
|
@ -2931,7 +2931,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
|
|
||||||
if (maxLength > length * sizeof(unichar))
|
if (maxLength > length * sizeof(unichar))
|
||||||
{
|
{
|
||||||
unichar *ptr = (unichar*)buffer;
|
unichar *ptr = (unichar*)(void*)buffer;
|
||||||
|
|
||||||
maxLength = (maxLength - 1) / sizeof(unichar);
|
maxLength = (maxLength - 1) / sizeof(unichar);
|
||||||
[self getCharacters: ptr
|
[self getCharacters: ptr
|
||||||
|
|
|
@ -2894,9 +2894,9 @@ newDetailInZoneForType(GSTimeZone *zone, TypeInfo *type)
|
||||||
format: @"TZ_MAGIC is incorrect"];
|
format: @"TZ_MAGIC is incorrect"];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
n_trans = GSSwapBigI32ToHost(*(int32_t*)header->tzh_timecnt);
|
n_trans = GSSwapBigI32ToHost(*(int32_t*)(void*)header->tzh_timecnt);
|
||||||
n_types = GSSwapBigI32ToHost(*(int32_t*)header->tzh_typecnt);
|
n_types = GSSwapBigI32ToHost(*(int32_t*)(void*)header->tzh_typecnt);
|
||||||
charcnt = GSSwapBigI32ToHost(*(int32_t*)header->tzh_charcnt);
|
charcnt = GSSwapBigI32ToHost(*(int32_t*)(void*)header->tzh_charcnt);
|
||||||
|
|
||||||
i = pos;
|
i = pos;
|
||||||
i += sizeof(int32_t)*n_trans;
|
i += sizeof(int32_t)*n_trans;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue