From 598011d59a03d3233d71c8b8fcebf697928d5ed5 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Thu, 26 Mar 2015 20:39:02 +0000 Subject: [PATCH] OS X: Fix build. DONT_BUILD. git-svn-id: https://svn.eduke32.com/eduke32@5094 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/GameListSource.game.m | 14 +++++++------- polymer/eduke32/source/grpscan.c | 10 ++++++++++ polymer/eduke32/source/grpscan.h | 10 ++++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/polymer/eduke32/source/GameListSource.game.m b/polymer/eduke32/source/GameListSource.game.m index 25ebf258d..d9c9c9d78 100644 --- a/polymer/eduke32/source/GameListSource.game.m +++ b/polymer/eduke32/source/GameListSource.game.m @@ -20,17 +20,17 @@ self = [super init]; if (self) { struct grpfile *p; - int i; - + list = [[NSMutableArray alloc] init]; - + for (p = foundgrps; p; p=p->next) { - for (i=0; icrcval == internalgrpfiles[i].crcval) break; - if (i == NUMGRPFILES) continue; - [list addObject:[[GrpFile alloc] initWithGrpfile:p andName:[NSString stringWithCString:internalgrpfiles[i].name encoding:NSUTF8StringEncoding]]]; + struct grpfile const * const group = GetInternalGroup(p->crcval); + if (group == NULL) + continue; + [list addObject:[[GrpFile alloc] initWithGrpfile:p andName:[NSString stringWithCString:group->name encoding:NSUTF8StringEncoding]]]; } } - + return self; } diff --git a/polymer/eduke32/source/grpscan.c b/polymer/eduke32/source/grpscan.c index 71e9308c1..9388948c2 100644 --- a/polymer/eduke32/source/grpscan.c +++ b/polymer/eduke32/source/grpscan.c @@ -60,6 +60,16 @@ struct grpfile internalgrpfiles[] = { "NAPALM", NAPALM_CRC, 44365728, GAMEFLAG_NAM|GAMEFLAG_NAPALM, 0, NULL, NULL, NULL, NULL }, { "WWII GI", WW2GI_CRC, 77939508, GAMEFLAG_WW2GI|GAMEFLAG_NAM, 0, NULL, NULL, NULL, NULL }, }; + +struct grpfile const * GetInternalGroup(int32_t crcval) +{ + for (size_t i = 0; i < ARRAY_SIZE(internalgrpfiles); i++) + if (crcval == internalgrpfiles[i].crcval) + return &internalgrpfiles[i]; + + return NULL; +} + struct grpfile *foundgrps = NULL; struct grpfile *listgrps = NULL; diff --git a/polymer/eduke32/source/grpscan.h b/polymer/eduke32/source/grpscan.h index 3a47d8689..13e7a93cb 100644 --- a/polymer/eduke32/source/grpscan.h +++ b/polymer/eduke32/source/grpscan.h @@ -23,6 +23,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef grpscan_h_ #define grpscan_h_ +#ifdef __cplusplus +extern "C" { +#endif + #define MAXLISTNAMELEN 32 // List of internally-known GRP files @@ -71,8 +75,14 @@ extern struct grpfile internalgrpfiles[]; extern struct grpfile *foundgrps; extern struct grpfile *listgrps; +extern struct grpfile const * GetInternalGroup(int32_t crcval); + extern struct grpfile * FindGroup(int32_t crcval); int32_t ScanGroups(void); void FreeGroups(void); +#ifdef __cplusplus +} +#endif + #endif