2
0

A fix build fixes on other platforms.

This commit is contained in:
Maarten Billemont 2015-02-09 18:02:22 +00:00
parent 8514a58e64
commit afaa17948f
2 changed files with 4 additions and 4 deletions

View File

@ -21,11 +21,11 @@
const MPSiteType mpw_typeWithName(const char *typeName) { const MPSiteType mpw_typeWithName(const char *typeName) {
// Lower-case and trim optionally leading "generated" string from typeName to standardize it. // Lower-case and trim optionally leading "Generated" string from typeName to standardize it.
size_t stdTypeNameOffset = 0; size_t stdTypeNameOffset = 0;
size_t stdTypeNameSize = strlen( typeName ); size_t stdTypeNameSize = strlen( typeName );
if (strcasestr(typeName, "generated" ) == typeName) if (strstr(typeName, "Generated" ) == typeName)
stdTypeNameSize -= (stdTypeNameOffset = strlen("generated")); stdTypeNameSize -= (stdTypeNameOffset = strlen( "Generated" ));
char stdTypeName[stdTypeNameSize + 1]; char stdTypeName[stdTypeNameSize + 1];
for (size_t c = 0; c < stdTypeNameSize; ++c) for (size_t c = 0; c < stdTypeNameSize; ++c)
stdTypeName[c] = (char)tolower( typeName[c + stdTypeNameOffset] ); stdTypeName[c] = (char)tolower( typeName[c + stdTypeNameOffset] );

View File

@ -26,7 +26,7 @@
//// Buffers and memory. //// Buffers and memory.
#define alloc_array(_count, _type, ...) ({ \ #define alloc_array(_count, _type, ...) ({ \
_type stackElements[] = (_type[]){ __VA_ARGS__ }; \ _type stackElements[] = { __VA_ARGS__ }; \
_count = sizeof( stackElements ) / sizeof( _type ); \ _count = sizeof( stackElements ) / sizeof( _type ); \
_type *allocElements = malloc( sizeof( stackElements ) ); \ _type *allocElements = malloc( sizeof( stackElements ) ); \
memcpy( allocElements, stackElements, sizeof( stackElements ) ); \ memcpy( allocElements, stackElements, sizeof( stackElements ) ); \