Diff for /np2/wince/dosio.cpp between versions 1.4 and 1.6

version 1.4, 2004/01/12 08:01:00 version 1.6, 2004/06/20 02:57:47
Line 2 Line 2
 #include        "dosio.h"  #include        "dosio.h"
   
   
 static  char    curpath[MAX_PATH];  static  OEMCHAR curpath[MAX_PATH];
 static  char    *curfilep = curpath;  static  OEMCHAR *curfilep = curpath;
   
 #define ISKANJI(c)      (((((c) ^ 0x20) - 0xa1) & 0xff) < 0x3c)  // #define ISKANJI(c)   (((((c) ^ 0x20) - 0xa1) & 0xff) < 0x3c)
   
 #if defined(UNICODE)  #if defined(UNICODE)
   
Line 17  static HANDLE CreateFile_A(LPCSTR lpFile Line 17  static HANDLE CreateFile_A(LPCSTR lpFile
                                         DWORD dwFlagsAndAttributes,                                          DWORD dwFlagsAndAttributes,
                                         HANDLE hTemplateFile) {                                          HANDLE hTemplateFile) {
   
         TCHAR   FileNameW[MAX_PATH*2];          UINT16  FileNameW[MAX_PATH];
   
   #if defined(OSLANG_SJIS)
         MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpFileName, -1,          MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpFileName, -1,
                                                         FileNameW, sizeof(FileNameW)/sizeof(TCHAR));                                                          FileNameW, sizeof(FileNameW)/sizeof(UINT16));
   #else
           ucscnv_utf8toucs2(FileNameW, sizeof(FileNameW)/sizeof(UINT16),
                                                                                                           lpFileName, (UINT)-1);
   #endif
         return(CreateFile(FileNameW, dwDesiredAccess, dwShareMode,          return(CreateFile(FileNameW, dwDesiredAccess, dwShareMode,
                                                 lpSecurityAttributes, dwCreationDisposition,                                                  lpSecurityAttributes, dwCreationDisposition,
                                                 dwFlagsAndAttributes, hTemplateFile));                                                  dwFlagsAndAttributes, hTemplateFile));
Line 28  static HANDLE CreateFile_A(LPCSTR lpFile Line 33  static HANDLE CreateFile_A(LPCSTR lpFile
   
 static inline BOOL DeleteFile_A(LPCSTR lpFileName) {  static inline BOOL DeleteFile_A(LPCSTR lpFileName) {
   
         TCHAR   FileNameW[MAX_PATH*2];          UINT16  FileNameW[MAX_PATH];
   
   #if defined(OSLANG_SJIS)
         MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpFileName, -1,          MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpFileName, -1,
                                                         FileNameW, sizeof(FileNameW)/sizeof(TCHAR));                                                          FileNameW, sizeof(FileNameW)/sizeof(UINT16));
   #else
           ucscnv_utf8toucs2(FileNameW, sizeof(FileNameW)/sizeof(UINT16),
                                                                                                           lpFileName, (UINT)-1);
   #endif
         return(DeleteFile(FileNameW));          return(DeleteFile(FileNameW));
 }  }
   
 static inline DWORD GetFileAttributes_A(LPCSTR lpFileName) {  static inline DWORD GetFileAttributes_A(LPCSTR lpFileName) {
   
         TCHAR   FileNameW[MAX_PATH*2];          UINT16  FileNameW[MAX_PATH];
   
   #if defined(OSLANG_SJIS)
         MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpFileName, -1,          MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpFileName, -1,
                                                         FileNameW, sizeof(FileNameW)/sizeof(TCHAR));                                                          FileNameW, sizeof(FileNameW)/sizeof(UINT16));
   #else
           ucscnv_utf8toucs2(FileNameW, sizeof(FileNameW)/sizeof(UINT16),
                                                                                                           lpFileName, (UINT)-1);
   #endif
         return(GetFileAttributes(FileNameW));          return(GetFileAttributes(FileNameW));
 }  }
   
 static inline BOOL CreateDirectory_A(LPCSTR lpFileName,  static inline BOOL CreateDirectory_A(LPCSTR lpFileName,
                                                                                                 LPSECURITY_ATTRIBUTES atr) {                                                                                                  LPSECURITY_ATTRIBUTES atr) {
   
         TCHAR   FileNameW[MAX_PATH*2];          UINT16  FileNameW[MAX_PATH];
   
   #if defined(OSLANG_SJIS)
         MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpFileName, -1,          MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpFileName, -1,
                                                         FileNameW, sizeof(FileNameW)/sizeof(TCHAR));                                                          FileNameW, sizeof(FileNameW)/sizeof(UINT16));
   #else
           ucscnv_utf8toucs2(FileNameW, sizeof(FileNameW)/sizeof(UINT16),
                                                                                                           lpFileName, (UINT)-1);
   #endif
         return(CreateDirectory(FileNameW, atr));          return(CreateDirectory(FileNameW, atr));
 }  }
   
 static inline HANDLE FindFirstFile_A(LPCSTR lpFileName,  static inline HANDLE FindFirstFile_A(LPCSTR lpFileName,
                                                                                                         WIN32_FIND_DATA *w32fd) {                                                                                                          WIN32_FIND_DATA *w32fd) {
   
         TCHAR   FileNameW[MAX_PATH*2];          UINT16  FileNameW[MAX_PATH];
   
   #if defined(OSLANG_SJIS)
         MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpFileName, -1,          MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpFileName, -1,
                                                         FileNameW, sizeof(FileNameW)/sizeof(TCHAR));                                                          FileNameW, sizeof(FileNameW)/sizeof(UINT16));
   #else
           ucscnv_utf8toucs2(FileNameW, sizeof(FileNameW)/sizeof(UINT16),
                                                                                                           lpFileName, (UINT)-1);
   #endif
         return(FindFirstFile(FileNameW, w32fd));          return(FindFirstFile(FileNameW, w32fd));
 }  }
 #else  #else
Line 264  short file_attr_c(const char *path) { Line 289  short file_attr_c(const char *path) {
   
 static BOOL setflist(WIN32_FIND_DATA *w32fd, FLINFO *fli) {  static BOOL setflist(WIN32_FIND_DATA *w32fd, FLINFO *fli) {
   
   #if defined(UNICODE) && defined(OSLANG_SJIS)
           WideCharToMultiByte(CP_ACP, 0, w32fd->cFileName, -1,
                                                                   fli->path, sizeof(fli->path), NULL, NULL);
   #elif defined(UNICODE) && defined(OSLANG_UTF8)
           ucscnv_ucs2toutf8(fli->path, sizeof(fli->path), w32fd->cFileName, -1);
   #else
           milstr_ncpy(fli->path, w32fd->cFileName, sizeof(fli->path));
   #endif
 #if !defined(_WIN32_WCE)  #if !defined(_WIN32_WCE)
         if ((w32fd->dwFileAttributes & FILEATTR_DIRECTORY) &&          if ((w32fd->dwFileAttributes & FILEATTR_DIRECTORY) &&
                 ((!file_cmpname(w32fd->cFileName, ".")) ||                  ((!file_cmpname(fli->path, ".")) ||
                 (!file_cmpname(w32fd->cFileName, "..")))) {                  (!file_cmpname(fli->path, "..")))) {
                 return(FAILURE);                  return(FAILURE);
         }          }
 #endif  #endif
Line 275  static BOOL setflist(WIN32_FIND_DATA *w3 Line 308  static BOOL setflist(WIN32_FIND_DATA *w3
         fli->size = w32fd->nFileSizeLow;          fli->size = w32fd->nFileSizeLow;
         fli->attr = w32fd->dwFileAttributes;          fli->attr = w32fd->dwFileAttributes;
         cnvdatetime(&w32fd->ftLastWriteTime, &fli->date, &fli->time);          cnvdatetime(&w32fd->ftLastWriteTime, &fli->date, &fli->time);
 #if defined(UNICODE)  
         WideCharToMultiByte(CP_ACP, 0, w32fd->cFileName, -1,  
                                                                 fli->path, sizeof(fli->path), NULL, NULL);  
 #else  
         milstr_ncpy(fli->path, w32fd->cFileName, sizeof(fli->path));  
 #endif  
         return(SUCCESS);          return(SUCCESS);
 }  }
   
Line 324  void file_listclose(FLISTH hdl) { Line 351  void file_listclose(FLISTH hdl) {
 }  }
   
   
 char *file_getname(char *path) {  OEMCHAR *file_getname(const OEMCHAR *path) {
   
         char    *ret;          int                     csize;
   const OEMCHAR   *ret;
   
         ret = path;          ret = path;
         while(*path != '\0') {          while((csize = milstr_charsize(path)) != 0) {
                 if (!ISKANJI(*path)) {                  if ((csize == 1) &&
                         if ((*path == '\\') || (*path == '/') || (*path == ':')) {                          ((*path == '\\') || (*path == '/') || (*path == ':'))) {
                                 ret = path + 1;                          ret = path + 1;
                         }  
                 }  
                 else {  
                         if (path[1]) {  
                                 path++;  
                         }  
                 }                  }
                 path++;                  path += csize;
         }          }
         return(ret);          return((OEMCHAR *)ret);
 }  }
   
 void file_cutname(char *path) {  void file_cutname(OEMCHAR *path) {
   
         char    *p;          OEMCHAR *p;
   
         p = file_getname(path);          p = file_getname(path);
         p[0] = '\0';          p[0] = '\0';
 }  }
   
 char *file_getext(char *path) {  OEMCHAR *file_getext(const OEMCHAR *path) {
   
         char    *p;          OEMCHAR *p;
         char    *q;          OEMCHAR *q;
           int             csize;
   
         p = file_getname(path);          p = file_getname(path);
         q = NULL;          q = NULL;
           while((csize = milstr_charsize(p)) != 0) {
         while(*p != '\0') {                  if ((csize == 1) && (*p == '.')) {
                 if (!ISKANJI(*p)) {                          q = p + 1;
                         if (*p == '.') {  
                                 q = p + 1;  
                         }  
                 }  
                 else {  
                         if (p[1]) {  
                                 p++;  
                         }  
                 }                  }
                 p++;                  p += csize;
         }          }
         if (!q) {          if (!q) {
                 q = p;                  q = p;
         }          }
         return(q);          return((OEMCHAR *)q);
 }  }
   
 void file_cutext(char *path) {  void file_cutext(OEMCHAR *path) {
   
         char    *p;          OEMCHAR *p;
         char    *q;          OEMCHAR *q;
           int             csize;
   
         p = file_getname(path);          p = file_getname(path);
         q = NULL;          q = NULL;
           while((csize = milstr_charsize(p)) != 0) {
         while(*p != '\0') {                  if ((csize == 1) && (*p == '.')) {
                 if (!ISKANJI(*p)) {                          q = p + 1;
                         if (*p == '.') {  
                                 q = p;  
                         }  
                 }  
                 else {  
                         if (p[1]) {  
                                 p++;  
                         }  
                 }                  }
                 p++;                  p += csize;
         }          }
         if (q) {          if (q) {
                 *q = '\0';                  *q = '\0';
         }          }
 }  }
   
 void file_cutseparator(char *path) {  void file_cutseparator(OEMCHAR *path) {
   
         int             pos;          int             pos;
   
Line 420  void file_cutseparator(char *path) { Line 428  void file_cutseparator(char *path) {
         }          }
 }  }
   
 void file_setseparator(char *path, int maxlen) {  void file_setseparator(OEMCHAR *path, int maxlen) {
   
         int             pos;          int             pos;
   

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


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