ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/sys_darwin.cpp
(Generate patch)

Comparing BasiliskII/src/MacOSX/sys_darwin.cpp (file contents):
Revision 1.9 by gbeauche, 2006-05-08T12:15:58Z vs.
Revision 1.14 by nigel, 2008-02-04T01:02:58Z

# Line 7 | Line 7
7   *
8   *      Based on Apple's CDROMSample.c and Evan Jones' cd-discid.c patches
9   *
10 < *  Basilisk II (C) 1997-2005 Christian Bauer
10 > *  Basilisk II (C) 1997-2008 Christian Bauer
11   *
12   *  This program is free software; you can redistribute it and/or modify
13   *  it under the terms of the GNU General Public License as published by
# Line 115 | Line 115 | static kern_return_t get_device_path(io_
115   static void media_arrived(int type, io_iterator_t iterator)
116   {
117          io_object_t obj;
118 <        while ((obj = IOIteratorNext(iterator)) != NULL) {
118 >        while ((obj = IOIteratorNext(iterator))) {
119                  char path[MAXPATHLEN];
120                  kern_return_t kernResult = get_device_path(obj, path, sizeof(path));
121                  if (kernResult == KERN_SUCCESS) {
# Line 137 | Line 137 | static void media_arrived(int type, io_i
137   static void media_removed(int type, io_iterator_t iterator)
138   {
139          io_object_t obj;
140 <        while ((obj = IOIteratorNext(iterator)) != NULL) {
140 >        while ((obj = IOIteratorNext(iterator))) {
141                  char path[MAXPATHLEN];
142                  kern_return_t kernResult = get_device_path(obj, path, sizeof(path));
143                  if (kernResult == KERN_SUCCESS) {
# Line 236 | Line 236 | void DarwinAddFloppyPrefs(void)
236                  return;
237          }
238  
239
239          // Iterate through each floppy
240          while ( nextFloppy = IOIteratorNext(allFloppies))
241          {
242                  char            bsdPath[MAXPATHLEN];
244                CFTypeRef       bsdPathAsCFString =
245                                                IORegistryEntryCreateCFProperty(nextFloppy,
246                                                                                                                CFSTR(kIOBSDNameKey),
247                                                                                                                kCFAllocatorDefault, 0);
243                  long            size;
244                  CFTypeRef       sizeAsCFNumber =
245                                                  IORegistryEntryCreateCFProperty(nextFloppy,
# Line 261 | Line 256 | void DarwinAddFloppyPrefs(void)
256                                  continue;
257                          }
258                  }
259 <                else
260 <                        bug("Couldn't get kIOMediaSizeKey of device");
261 <                
262 <                
268 <                *bsdPath = '\0';
269 <                if ( bsdPathAsCFString )
270 <                {
271 <                        size_t devPathLength;
272 <
273 <                        strcpy(bsdPath, "/dev/");
274 <                        devPathLength = strlen(bsdPath);
275 <
276 <                        if ( CFStringGetCString((const __CFString *)bsdPathAsCFString,
277 <                                                                         bsdPath + devPathLength,
278 <                                                                         MAXPATHLEN - devPathLength,
279 <                                                                         kCFStringEncodingASCII) )
280 <                        {
281 <                                D(bug("Floppy BSD path: %s\n", bsdPath));
282 <                                PrefsAddString("floppy", bsdPath);
283 <                        }
284 <                        else
285 <                                D(bug("Could not get BSD device path for floppy\n"));
259 >                else {
260 >                        D(puts("Couldn't get kIOMediaSizeKey of device"));
261 >                        continue; // if kIOMediaSizeKey is unavailable, we shouldn't use it anyway
262 >                }
263  
264 <                        CFRelease(bsdPathAsCFString);
264 >                if (get_device_path(nextFloppy, bsdPath, sizeof(bsdPath)) == KERN_SUCCESS) {
265 >                        PrefsAddString("floppy", bsdPath);
266 >                } else {
267 >                        D(bug("Could not get BSD device path for floppy\n"));
268                  }
289                else
290                        D(bug("Cannot determine bsdPath for floppy\n"));
269          }
270  
271          IOObjectRelease(nextFloppy);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines