Skip to content

Commit

Permalink
Cleanup PR
Browse files Browse the repository at this point in the history
  • Loading branch information
MBeijer committed May 15, 2021
1 parent 065b715 commit edb285c
Show file tree
Hide file tree
Showing 10 changed files with 450 additions and 393 deletions.
2 changes: 1 addition & 1 deletion src/audio/SDL_sysaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "SDL_mutex.h"
#include "SDL_thread.h"

#if defined(__amigaos3__)
#if defined(__AMIGA__)
#include <exec/exec.h>
#include <dos/dos.h>
#if defined(__SASC) || defined(WARPOS)
Expand Down
68 changes: 34 additions & 34 deletions src/cdrom/beos/SDL_syscdrom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ extern "C" {
#define POS_REL_F(pos) pos.position[15]

/* The maximum number of CD-ROM drives we'll detect */
#define MAX_DRIVES 16
#define MAX_DRIVES 16

/* A list of available CD-ROM drives */
static char *SDL_cdlist[MAX_DRIVES];
Expand Down Expand Up @@ -194,51 +194,51 @@ int SDL_SYS_CDInit(void)
return(0);
}
}

/* Scan the system for CD-ROM drives */
try_dir("/dev/disk");
return 0;
}


int try_dir(const char *directory)
{
BDirectory dir;
dir.SetTo(directory);
if(dir.InitCheck() != B_NO_ERROR) {
return false;
}
dir.Rewind();
BEntry entry;
while(dir.GetNextEntry(&entry) >= 0) {
BPath path;
const char *name;
entry_ref e;

if(entry.GetPath(&path) != B_NO_ERROR)
continue;
name = path.Path();

if(entry.GetRef(&e) != B_NO_ERROR)
continue;

if(entry.IsDirectory()) {
if(SDL_strcmp(e.name, "floppy") == 0)
{
BDirectory dir;
dir.SetTo(directory);
if(dir.InitCheck() != B_NO_ERROR) {
return false;
}
dir.Rewind();
BEntry entry;
while(dir.GetNextEntry(&entry) >= 0) {
BPath path;
const char *name;
entry_ref e;
if(entry.GetPath(&path) != B_NO_ERROR)
continue;
name = path.Path();
if(entry.GetRef(&e) != B_NO_ERROR)
continue;

if(entry.IsDirectory()) {
if(SDL_strcmp(e.name, "floppy") == 0)
continue; /* ignore floppy (it is not silent) */
int devfd = try_dir(name);
if(devfd >= 0)
return devfd;
}
else {
int devfd;
device_geometry g;
}
else {
int devfd;
device_geometry g;

if(SDL_strcmp(e.name, "raw") != 0)
if(SDL_strcmp(e.name, "raw") != 0)
continue; /* ignore partitions */

devfd = open(name, O_RDONLY);
if(devfd < 0)
continue;
devfd = open(name, O_RDONLY);
if(devfd < 0)
continue;

if(ioctl(devfd, B_GET_GEOMETRY, &g, sizeof(g)) >= 0) {
if(g.device_type == B_CD)
Expand All @@ -247,7 +247,7 @@ int try_dir(const char *directory)
}
}
close(devfd);
}
}
}
return B_ERROR;
}
Expand All @@ -273,7 +273,7 @@ static int SDL_SYS_CDioctl(int index, int command, void *arg)
static const char *SDL_SYS_CDName(int drive)
{
return(SDL_cdlist[drive]);
}
}

static int SDL_SYS_CDOpen(int drive)
{
Expand Down
Loading

0 comments on commit edb285c

Please sign in to comment.