From afba63724478d34d07de7d8e32a41fe65a07b1f3 Mon Sep 17 00:00:00 2001 From: rogerman Date: Thu, 14 May 2015 20:56:00 +0000 Subject: [PATCH] Cocoa Port: - Silence some compiler warnings. --- desmume/src/cocoa/cocoa_input.mm | 2 +- desmume/src/cocoa/cocoa_rom.mm | 35 ++++++++++++-------------------- desmume/src/cocoa/utilities.c | 4 ++-- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/desmume/src/cocoa/cocoa_input.mm b/desmume/src/cocoa/cocoa_input.mm index b54ab0fb2..89548d02a 100644 --- a/desmume/src/cocoa/cocoa_input.mm +++ b/desmume/src/cocoa/cocoa_input.mm @@ -573,7 +573,7 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE); theSample = sampleGenerator->generateSample(); } - _hwMicLevelList->push_back(abs((float)theSample - MIC_NULL_SAMPLE_VALUE)); + _hwMicLevelList->push_back(fabs((float)theSample - MIC_NULL_SAMPLE_VALUE)); return theSample; } diff --git a/desmume/src/cocoa/cocoa_rom.mm b/desmume/src/cocoa/cocoa_rom.mm index 4271b3e3c..7b2153c89 100644 --- a/desmume/src/cocoa/cocoa_rom.mm +++ b/desmume/src/cocoa/cocoa_rom.mm @@ -151,22 +151,19 @@ static NSMutableDictionary *saveTypeValues = nil; return; } - if (&ndsRomBanner != NULL) - { - [self.header setValue:[self banner:ndsRomBanner.titles[0]] forKey:@"bannerJapanese"]; - [self.header setValue:[self banner:ndsRomBanner.titles[1]] forKey:@"bannerEnglish"]; - [self.header setValue:[self banner:ndsRomBanner.titles[2]] forKey:@"bannerFrench"]; - [self.header setValue:[self banner:ndsRomBanner.titles[3]] forKey:@"bannerGerman"]; - [self.header setValue:[self banner:ndsRomBanner.titles[4]] forKey:@"bannerItalian"]; - [self.header setValue:[self banner:ndsRomBanner.titles[5]] forKey:@"bannerSpanish"]; - - [self.bindings setValue:[self.header objectForKey:@"bannerJapanese"] forKey:@"bannerJapanese"]; - [self.bindings setValue:[self.header objectForKey:@"bannerEnglish"] forKey:@"bannerEnglish"]; - [self.bindings setValue:[self.header objectForKey:@"bannerFrench"] forKey:@"bannerFrench"]; - [self.bindings setValue:[self.header objectForKey:@"bannerGerman"] forKey:@"bannerGerman"]; - [self.bindings setValue:[self.header objectForKey:@"bannerItalian"] forKey:@"bannerItalian"]; - [self.bindings setValue:[self.header objectForKey:@"bannerSpanish"] forKey:@"bannerSpanish"]; - } + [self.header setValue:[self banner:ndsRomBanner.titles[0]] forKey:@"bannerJapanese"]; + [self.header setValue:[self banner:ndsRomBanner.titles[1]] forKey:@"bannerEnglish"]; + [self.header setValue:[self banner:ndsRomBanner.titles[2]] forKey:@"bannerFrench"]; + [self.header setValue:[self banner:ndsRomBanner.titles[3]] forKey:@"bannerGerman"]; + [self.header setValue:[self banner:ndsRomBanner.titles[4]] forKey:@"bannerItalian"]; + [self.header setValue:[self banner:ndsRomBanner.titles[5]] forKey:@"bannerSpanish"]; + + [self.bindings setValue:[self.header objectForKey:@"bannerJapanese"] forKey:@"bannerJapanese"]; + [self.bindings setValue:[self.header objectForKey:@"bannerEnglish"] forKey:@"bannerEnglish"]; + [self.bindings setValue:[self.header objectForKey:@"bannerFrench"] forKey:@"bannerFrench"]; + [self.bindings setValue:[self.header objectForKey:@"bannerGerman"] forKey:@"bannerGerman"]; + [self.bindings setValue:[self.header objectForKey:@"bannerItalian"] forKey:@"bannerItalian"]; + [self.bindings setValue:[self.header objectForKey:@"bannerSpanish"] forKey:@"bannerSpanish"]; if (ndsRomHeader != NULL) { @@ -665,12 +662,6 @@ void RomIconToRGBA8888(uint32_t *bitmapData) return; } - if (&ndsRomBanner == NULL) - { - memset(bitmapData, 0, 4096); // 4096 bytes = 32px * 32px * sizeof(uint32_t) - return; - } - // Set all of our icon read pointers. iconClutPtr = (uint16_t *)ndsRomBanner.palette + 1; iconPixPtr = (uint32_t *)ndsRomBanner.bitmap; diff --git a/desmume/src/cocoa/utilities.c b/desmume/src/cocoa/utilities.c index dd58d9602..2db026a16 100644 --- a/desmume/src/cocoa/utilities.c +++ b/desmume/src/cocoa/utilities.c @@ -381,7 +381,7 @@ CGSize GetTransformedBounds(const double normalBoundsWidth, const double normalB } else { - transformBounds.width = abs(x[1] - x[3]); + transformBounds.width = fabs(x[1] - x[3]); } // Determine the transformed height, which is dependent on the location of @@ -418,7 +418,7 @@ CGSize GetTransformedBounds(const double normalBoundsWidth, const double normalB } else { - transformBounds.height = abs(y[3] - y[1]); + transformBounds.height = fabs(y[3] - y[1]); } return transformBounds;