From 71c43890945472c6a5d611aebef8fce8de3657ce Mon Sep 17 00:00:00 2001 From: nigel <> Date: Fri, 5 Apr 2002 12:15:34 +0000 Subject: [PATCH] Modify getCFint32() to cope with values of zero (it was assuming 0 was an error condition) --- BasiliskII/src/MacOSX/video_macosx.mm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/BasiliskII/src/MacOSX/video_macosx.mm b/BasiliskII/src/MacOSX/video_macosx.mm index 90a66fa8..5b77984a 100644 --- a/BasiliskII/src/MacOSX/video_macosx.mm +++ b/BasiliskII/src/MacOSX/video_macosx.mm @@ -187,14 +187,21 @@ static void add_standard_modes(const video_depth depth) // Helper function to get a 32bit int from a dictionary static int32 getCFint32 (CFDictionaryRef dict, CFStringRef key) { - int32 val = 0; CFNumberRef ref = CFDictionaryGetValue(dict, key); - if ( ref && CFNumberGetValue(ref, kCFNumberSInt32Type, &val) ) - if ( ! val ) - NSLog(@"getCFint32() - Logic error - Got a value of 0"); + if ( ref ) + { + int32 val; - return val; + if ( CFNumberGetValue(ref, kCFNumberSInt32Type, &val) ) + return val; + else + NSLog(@"getCFint32() - Failed to get the value %@", key); + } + else + NSLog(@"getCFint32() - Failed to get a 32bit int for %@", key); + + return 0; } static bool add_CGDirectDisplay_modes()