From 8516e5d4bf2887112dad891ed6af2d32b54dc379 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Sun, 26 Apr 2009 18:24:36 +0000 Subject: [PATCH] Remove dirent.h dependency. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3359 --- src/dos/cdrom.cpp | 7 ++++--- src/dos/drive_local.cpp | 8 ++++---- src/gui/render.cpp | 5 ++--- src/hardware/adlib.cpp | 4 +--- src/hardware/hardware.cpp | 25 +++++++++++++------------ src/hardware/mixer.cpp | 3 +-- 6 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/dos/cdrom.cpp b/src/dos/cdrom.cpp index 488f858f..8e3ec414 100644 --- a/src/dos/cdrom.cpp +++ b/src/dos/cdrom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2009 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,6 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* $Id: cdrom.cpp,v 1.27 2009-04-26 18:24:36 qbix79 Exp $ */ // ****************************************************** // SDL CDROM @@ -24,7 +25,7 @@ #include #include #include -#include + #include "dosbox.h" #include "SDL.h" #include "support.h" @@ -172,7 +173,7 @@ int CDROM_GetMountType(char* path, int forceCD) { // Detect ISO struct stat file_stat; - if ((stat(path, &file_stat) == 0) && S_ISREG(file_stat.st_mode)) return 1; + if ((stat(path, &file_stat) == 0) && (file_stat.st_mode & S_IFREG)) return 1; return 2; } diff --git a/src/dos/drive_local.cpp b/src/dos/drive_local.cpp index 91bd08b5..bd171413 100644 --- a/src/dos/drive_local.cpp +++ b/src/dos/drive_local.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2008 The DOSBox Team + * Copyright (C) 2002-2009 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,14 +16,14 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_local.cpp,v 1.78 2008-10-05 14:44:52 qbix79 Exp $ */ +/* $Id: drive_local.cpp,v 1.79 2009-04-26 18:24:36 qbix79 Exp $ */ #include #include #include #include #include -#include + #include "dosbox.h" #include "dos_inc.h" #include "drives.h" @@ -264,7 +264,7 @@ again: goto again;//No symlinks and such } - if(S_ISDIR(stat_block.st_mode)) find_attr=DOS_ATTR_DIRECTORY; + if(stat_block.st_mode & S_IFDIR) find_attr=DOS_ATTR_DIRECTORY; else find_attr=DOS_ATTR_ARCHIVE; if (~srch_attr & find_attr & (DOS_ATTR_DIRECTORY | DOS_ATTR_HIDDEN | DOS_ATTR_SYSTEM)) goto again; diff --git a/src/gui/render.cpp b/src/gui/render.cpp index 8e7311a5..cdd9cbfd 100644 --- a/src/gui/render.cpp +++ b/src/gui/render.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2008 The DOSBox Team + * Copyright (C) 2002-2009 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,10 +16,9 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: render.cpp,v 1.58 2009-02-01 14:24:36 qbix79 Exp $ */ +/* $Id: render.cpp,v 1.59 2009-04-26 18:24:36 qbix79 Exp $ */ #include -#include #include #include diff --git a/src/hardware/adlib.cpp b/src/hardware/adlib.cpp index 1a614214..8ab83109 100644 --- a/src/hardware/adlib.cpp +++ b/src/hardware/adlib.cpp @@ -16,14 +16,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: adlib.cpp,v 1.36 2009-04-26 15:37:04 c2woody Exp $ */ +/* $Id: adlib.cpp,v 1.37 2009-04-26 18:24:36 qbix79 Exp $ */ #include #include #include #include -#include - #include "adlib.h" #include "setup.h" diff --git a/src/hardware/hardware.cpp b/src/hardware/hardware.cpp index 135e6e5e..44671ab7 100644 --- a/src/hardware/hardware.cpp +++ b/src/hardware/hardware.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2008 The DOSBox Team + * Copyright (C) 2002-2009 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,9 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: hardware.cpp,v 1.21 2009-02-01 15:52:53 qbix79 Exp $ */ +/* $Id: hardware.cpp,v 1.22 2009-04-26 18:24:36 qbix79 Exp $ */ -#include #include #include #include @@ -89,15 +88,14 @@ FILE * OpenCaptureFile(const char * type,const char * ext) { } Bitu last=0; - char file_name[CROSS_LEN]; char file_start[16]; - DIR * dir;struct dirent * dir_ent; + dir_information * dir; /* Find a filename to open */ - dir=opendir(capturedir.c_str()); + dir = open_directory(capturedir.c_str()); if (!dir) { //Try creating it first Cross::CreateDir(capturedir); - dir=opendir(capturedir.c_str()); + dir=open_directory(capturedir.c_str()); if(!dir) { LOG_MSG("Can't open dir %s for capturing %s",capturedir.c_str(),type); @@ -107,17 +105,20 @@ FILE * OpenCaptureFile(const char * type,const char * ext) { strcpy(file_start,RunningProgram); lowcase(file_start); strcat(file_start,"_"); - while ((dir_ent=readdir(dir))) { - char tempname[CROSS_LEN]; - strcpy(tempname,dir_ent->d_name); + bool is_directory; + char tempname[CROSS_LEN]; + bool testRead = read_directory_first(dir, tempname, is_directory ); + for ( ; testRead; testRead = read_directory_next(dir, tempname, is_directory) ) { char * test=strstr(tempname,ext); - if (!test || strlen(test)!=strlen(ext)) continue; + if (!test || strlen(test)!=strlen(ext)) + continue; *test=0; if (strncasecmp(tempname,file_start,strlen(file_start))!=0) continue; Bitu num=atoi(&tempname[strlen(file_start)]); if (num>=last) last=num+1; } - closedir(dir); + close_directory( dir ); + char file_name[CROSS_LEN]; sprintf(file_name,"%s%c%s%03d%s",capturedir.c_str(),CROSS_FILESPLIT,file_start,last,ext); /* Open the actual file */ FILE * handle=fopen(file_name,"wb"); diff --git a/src/hardware/mixer.cpp b/src/hardware/mixer.cpp index 3c8cb9f8..81955e60 100644 --- a/src/hardware/mixer.cpp +++ b/src/hardware/mixer.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: mixer.cpp,v 1.51 2009-04-25 16:25:03 harekiet Exp $ */ +/* $Id: mixer.cpp,v 1.52 2009-04-26 18:24:36 qbix79 Exp $ */ /* Remove the sdl code from here and have it handeld in the sdlmain. @@ -25,7 +25,6 @@ #include #include -#include #include #if defined (WIN32)