Diff for /np2/win9xc/dosio.cpp between versions 1.4 and 1.5

version 1.4, 2005/02/13 02:36:17 version 1.5, 2005/03/20 08:58:20
Line 2 Line 2
 #include        "dosio.h"  #include        "dosio.h"
   
   
 static  OEMCHAR curpath[MAX_PATH];  static  TCHAR   curpath[MAX_PATH];
 static  OEMCHAR *curfilep = curpath;  static  TCHAR   *curfilep = curpath;
   
   
 // ----  // ----
Line 12  void dosio_init(void) { } Line 12  void dosio_init(void) { }
 void dosio_term(void) { }  void dosio_term(void) { }
   
                                                                                         // ファイル操作                                                                                          // ファイル操作
 FILEH DOSIOCALL file_open(const OEMCHAR *path) {  FILEH DOSIOCALL file_open(const TCHAR *path) {
   
         FILEH   ret;          FILEH   ret;
   
Line 28  FILEH DOSIOCALL file_open(const OEMCHAR  Line 28  FILEH DOSIOCALL file_open(const OEMCHAR 
         return(ret);          return(ret);
 }  }
   
 FILEH DOSIOCALL file_open_rb(const OEMCHAR *path) {  FILEH DOSIOCALL file_open_rb(const TCHAR *path) {
   
         FILEH   ret;          FILEH   ret;
   
Line 40  FILEH DOSIOCALL file_open_rb(const OEMCH Line 40  FILEH DOSIOCALL file_open_rb(const OEMCH
         return(ret);          return(ret);
 }  }
   
 FILEH DOSIOCALL file_create(const OEMCHAR *path) {  FILEH DOSIOCALL file_create(const TCHAR *path) {
   
         FILEH   ret;          FILEH   ret;
   
Line 126  short DOSIOCALL file_getdatetime(FILEH h Line 126  short DOSIOCALL file_getdatetime(FILEH h
         return(0);          return(0);
 }  }
   
 short DOSIOCALL file_delete(const OEMCHAR *path) {  short DOSIOCALL file_delete(const TCHAR *path) {
   
         return(DeleteFile(path)?0:-1);          return(DeleteFile(path)?0:-1);
 }  }
   
 short DOSIOCALL file_attr(const OEMCHAR *path) {  short DOSIOCALL file_attr(const TCHAR *path) {
   
         return((short)GetFileAttributes(path));          return((short)GetFileAttributes(path));
 }  }
   
 short DOSIOCALL file_dircreate(const OEMCHAR *path) {  short DOSIOCALL file_dircreate(const TCHAR *path) {
   
         return(CreateDirectory(path, NULL)?0:-1);          return(CreateDirectory(path, NULL)?0:-1);
 }  }
   
   
                                                                                         // カレントファイル操作                                                                                          // カレントファイル操作
 void DOSIOCALL file_setcd(const OEMCHAR *exepath) {  void DOSIOCALL file_setcd(const TCHAR *exepath) {
   
         file_cpyname(curpath, exepath, NELEMENTS(curpath));          file_cpyname(curpath, exepath, NELEMENTS(curpath));
         curfilep = file_getname(curpath);          curfilep = file_getname(curpath);
         *curfilep = '\0';          *curfilep = '\0';
 }  }
   
 OEMCHAR * DOSIOCALL file_getcd(const OEMCHAR *path) {  TCHAR * DOSIOCALL file_getcd(const TCHAR *path) {
   
         file_cpyname(curfilep, path, sizeof(curpath) - (curfilep - curpath));          file_cpyname(curfilep, path, NELEMENTS(curpath) - (curfilep - curpath));
         return(curpath);          return(curpath);
 }  }
   
 FILEH DOSIOCALL file_open_c(const OEMCHAR *path) {  FILEH DOSIOCALL file_open_c(const TCHAR *path) {
   
         file_cpyname(curfilep, path, sizeof(curpath) - (curfilep - curpath));          file_cpyname(curfilep, path, NELEMENTS(curpath) - (curfilep - curpath));
         return(file_open(curpath));          return(file_open(curpath));
 }  }
   
 FILEH DOSIOCALL file_open_rb_c(const OEMCHAR *path) {  FILEH DOSIOCALL file_open_rb_c(const TCHAR *path) {
   
         file_cpyname(curfilep, path, sizeof(curpath) - (curfilep - curpath));          file_cpyname(curfilep, path, NELEMENTS(curpath) - (curfilep - curpath));
         return(file_open_rb(curpath));          return(file_open_rb(curpath));
 }  }
   
 FILEH DOSIOCALL file_create_c(const OEMCHAR *path) {  FILEH DOSIOCALL file_create_c(const TCHAR *path) {
   
         file_cpyname(curfilep, path, sizeof(curpath) - (curfilep - curpath));          file_cpyname(curfilep, path, NELEMENTS(curpath) - (curfilep - curpath));
         return(file_create(curpath));          return(file_create(curpath));
 }  }
   
 short DOSIOCALL file_delete_c(const OEMCHAR *path) {  short DOSIOCALL file_delete_c(const TCHAR *path) {
   
         file_cpyname(curfilep, path, sizeof(curpath) - (curfilep - curpath));          file_cpyname(curfilep, path, NELEMENTS(curpath) - (curfilep - curpath));
         return(file_delete(curpath));          return(file_delete(curpath));
 }  }
   
 short DOSIOCALL file_attr_c(const OEMCHAR *path) {  short DOSIOCALL file_attr_c(const TCHAR *path) {
   
         file_cpyname(curfilep, path, sizeof(curpath) - (curfilep - curpath));          file_cpyname(curfilep, path, NELEMENTS(curpath) - (curfilep - curpath));
         return(file_attr(curpath));          return(file_attr(curpath));
 }  }
   
Line 191  static BRESULT DOSIOCALL setflist(WIN32_ Line 191  static BRESULT DOSIOCALL setflist(WIN32_
   
 #if !defined(_WIN32_WCE)  #if !defined(_WIN32_WCE)
         if ((w32fd->dwFileAttributes & FILEATTR_DIRECTORY) &&          if ((w32fd->dwFileAttributes & FILEATTR_DIRECTORY) &&
                 ((!file_cmpname(w32fd->cFileName, OEMTEXT("."))) ||                  ((!file_cmpname(w32fd->cFileName, _T("."))) ||
                 (!file_cmpname(w32fd->cFileName, OEMTEXT(".."))))) {                  (!file_cmpname(w32fd->cFileName, _T(".."))))) {
                 return(FAILURE);                  return(FAILURE);
         }          }
 #endif  #endif
Line 204  static BRESULT DOSIOCALL setflist(WIN32_ Line 204  static BRESULT DOSIOCALL setflist(WIN32_
         return(SUCCESS);          return(SUCCESS);
 }  }
   
 FLISTH DOSIOCALL file_list1st(const OEMCHAR *dir, FLINFO *fli) {  FLISTH DOSIOCALL file_list1st(const TCHAR *dir, FLINFO *fli) {
   
         OEMCHAR                 path[MAX_PATH];          TCHAR                   path[MAX_PATH];
         HANDLE                  hdl;          HANDLE                  hdl;
         WIN32_FIND_DATA w32fd;          WIN32_FIND_DATA w32fd;
   
         milstr_ncpy(path, dir, NELEMENTS(path));          milstr_ncpy(path, dir, NELEMENTS(path));
         file_setseparator(path, NELEMENTS(path));          file_setseparator(path, NELEMENTS(path));
         milstr_ncat(path, OEMTEXT("*.*"), NELEMENTS(path));          milstr_ncat(path, _T("*.*"), NELEMENTS(path));
         TRACEOUT(("file_list1st %s", path));          TRACEOUT(("file_list1st %s", path));
         hdl = FindFirstFile(path, &w32fd);          hdl = FindFirstFile(path, &w32fd);
         if (hdl != INVALID_HANDLE_VALUE) {          if (hdl != INVALID_HANDLE_VALUE) {
Line 244  void DOSIOCALL file_listclose(FLISTH hdl Line 244  void DOSIOCALL file_listclose(FLISTH hdl
 }  }
   
   
 OEMCHAR * DOSIOCALL file_getname(const OEMCHAR *path) {  TCHAR * DOSIOCALL file_getname(const TCHAR *path) {
   
 const OEMCHAR   *ret;  const TCHAR     *ret;
         int                     csize;          int             csize;
   
         ret = path;          ret = path;
         while((csize = milstr_charsize(path)) != 0) {          while((csize = milstr_charsize(path)) != 0) {
Line 258  const OEMCHAR *ret; Line 258  const OEMCHAR *ret;
                 }                  }
                 path += csize;                  path += csize;
         }          }
         return((OEMCHAR *)ret);          return((TCHAR *)ret);
 }  }
   
 void DOSIOCALL file_cutname(OEMCHAR *path) {  void DOSIOCALL file_cutname(TCHAR *path) {
   
         OEMCHAR *p;          TCHAR   *p;
   
         p = file_getname(path);          p = file_getname(path);
         p[0] = '\0';          p[0] = '\0';
 }  }
   
 OEMCHAR * DOSIOCALL file_getext(const OEMCHAR *path) {  TCHAR * DOSIOCALL file_getext(const TCHAR *path) {
   
 const OEMCHAR   *p;  const TCHAR     *p;
 const OEMCHAR   *q;  const TCHAR     *q;
         int                     csize;          int             csize;
   
         p = file_getname(path);          p = file_getname(path);
         q = NULL;          q = NULL;
Line 286  const OEMCHAR *q; Line 286  const OEMCHAR *q;
         if (q == NULL) {          if (q == NULL) {
                 q = p;                  q = p;
         }          }
         return((OEMCHAR *)q);          return((TCHAR *)q);
 }  }
   
 void DOSIOCALL file_cutext(OEMCHAR *path) {  void DOSIOCALL file_cutext(TCHAR *path) {
   
         OEMCHAR *p;          TCHAR   *p;
         OEMCHAR *q;          TCHAR   *q;
         int             csize;          int             csize;
   
         p = file_getname(path);          p = file_getname(path);
Line 308  void DOSIOCALL file_cutext(OEMCHAR *path Line 308  void DOSIOCALL file_cutext(OEMCHAR *path
         }          }
 }  }
   
 void DOSIOCALL file_cutseparator(OEMCHAR *path) {  void DOSIOCALL file_cutseparator(TCHAR *path) {
   
         int             pos;          int             pos;
   
         pos = OEMSTRLEN(path) - 1;          pos = lstrlen(path) - 1;
         if ((pos > 0) &&                                                        // 2文字以上でー          if ((pos > 0) &&                                                        // 2文字以上でー
                 (path[pos] == '\\') &&                                  // ケツが \ でー                  (path[pos] == '\\') &&                                  // ケツが \ でー
                 (!milstr_kanji2nd(path, pos)) &&                // 漢字の2バイト目ぢゃなくてー                  (!milstr_kanji2nd(path, pos)) &&                // 漢字の2バイト目ぢゃなくてー
Line 322  void DOSIOCALL file_cutseparator(OEMCHAR Line 322  void DOSIOCALL file_cutseparator(OEMCHAR
         }          }
 }  }
   
 void DOSIOCALL file_setseparator(OEMCHAR *path, int maxlen) {  void DOSIOCALL file_setseparator(TCHAR *path, int maxlen) {
   
         int             pos;          int             pos;
   
         pos = OEMSTRLEN(path) - 1;          pos = lstrlen(path) - 1;
         if ((pos < 0) ||          if ((pos < 0) ||
                 ((pos == 1) && (path[1] == ':')) ||                  ((pos == 1) && (path[1] == ':')) ||
                 ((path[pos] == '\\') && (!milstr_kanji2nd(path, pos))) ||                  ((path[pos] == '\\') && (!milstr_kanji2nd(path, pos))) ||

Removed from v.1.4  
changed lines
  Added in v.1.5


RetroPC.NET-CVS <cvs@retropc.net>