Diff for /np2/macosx/macossub.cpp between versions 1.3 and 1.5

version 1.3, 2003/11/14 10:32:36 version 1.5, 2004/01/09 07:27:15
Line 69  static void char2str(char *dst, int size Line 69  static void char2str(char *dst, int size
         CFStringRef     cfsr;          CFStringRef     cfsr;
   
         cfsr = CFStringCreateWithCharacters(NULL, uni, unicnt);          cfsr = CFStringCreateWithCharacters(NULL, uni, unicnt);
         CFStringGetCString(cfsr, dst, size, CFStringGetSystemEncoding());      if (cfsr) {
         CFRelease(cfsr);          CFStringGetCString(cfsr, dst, size, CFStringGetSystemEncoding());
           CFRelease(cfsr);
       }
 }  }
   
 void *file_list1st(const char *dir, FLDATA *fl) {  void *file_list1st(const char *dir, FLINFO *fli) {
   
         void            *ret;          FLISTH          ret;
         Str255          fname;          Str255          fname;
         FSSpec          fss;          FSSpec          fss;
         FSRef           fsr;          FSRef           fsr;
Line 93  void *file_list1st(const char *dir, FLDA Line 95  void *file_list1st(const char *dir, FLDA
         }          }
         ((FLHDL)ret)->eoff = FALSE;          ((FLHDL)ret)->eoff = FALSE;
         ((FLHDL)ret)->fsi = fsi;          ((FLHDL)ret)->fsi = fsi;
         if (file_listnext(ret, fl) == SUCCESS) {          if (file_listnext(ret, fli) == SUCCESS) {
                 return(ret);                  return(ret);
         }          }
   
Line 104  ff1_err1: Line 106  ff1_err1:
         return(NULL);          return(NULL);
 }  }
   
 BOOL file_listnext(void *hdl, FLDATA *fl) {  BOOL file_listnext(FLISTH hdl, FLINFO *fli) {
   
         FLHDL           flhdl;          FLHDL           flhdl;
         ItemCount       count;          ItemCount       count;
Line 127  BOOL file_listnext(void *hdl, FLDATA *fl Line 129  BOOL file_listnext(void *hdl, FLDATA *fl
                 flhdl->eoff = TRUE;                  flhdl->eoff = TRUE;
                 goto ffn_err;                  goto ffn_err;
         }          }
         if (fl) {          if (fli) {
                 char2str(fl->path, sizeof(fl->path),                  char2str(fli->path, sizeof(fli->path),
                                                                 flhdl->name.unicode, flhdl->name.length);                                                                  flhdl->name.unicode, flhdl->name.length);
                 fl->size = (UINT32)flhdl->fsci.dataLogicalSize;  
                 if (flhdl->fsci.nodeFlags & kFSNodeIsDirectoryMask) {                  if (flhdl->fsci.nodeFlags & kFSNodeIsDirectoryMask) {
                         fl->attr = FILEATTR_DIRECTORY;                          fli->attr = FILEATTR_DIRECTORY;
                           fli->size = 0;
                 }                  }
                 else {                  else {
                         fl->attr = FILEATTR_ARCHIVE;                          fli->attr = FILEATTR_ARCHIVE;
                           fli->size = (UINT32)flhdl->fsci.dataLogicalSize;
                 }                  }
         }          }
         return(SUCCESS);          return(SUCCESS);
Line 144  ffn_err: Line 147  ffn_err:
         return(FAILURE);          return(FAILURE);
 }  }
   
 void file_listclose(void *hdl) {  void file_listclose(FLISTH hdl) {
   
         if (hdl) {          if (hdl) {
                 FSCloseIterator(((FLHDL)hdl)->fsi);                  FSCloseIterator(((FLHDL)hdl)->fsi);
Line 156  bool getLongFileName(char* dst, const ch Line 159  bool getLongFileName(char* dst, const ch
         FSSpec  fss;          FSSpec  fss;
         Str255  fname;          Str255  fname;
     FSRef       fref;      FSRef       fref;
     char        buffer[1024];      HFSUniStr255        name;
         char    *ret, *val;  
   
     if (*path == '\0') {      if (*path == '\0') {
         return(false);          return(false);
     }      }
         mkstr255(fname, path);          mkstr255(fname, path);
         if (FSMakeFSSpec(0, 0, fname, &fss) != noErr) {          FSMakeFSSpec(0, 0, fname, &fss);
         return(false);      FSpMakeFSRef(&fss, &fref);
     }      if (FSGetCatalogInfo(&fref, kFSCatInfoNone, NULL, &name, NULL, NULL) != noErr) {
     if (FSpMakeFSRef(&fss, &fref) != noErr) {  
         return(false);          return(false);
     }      }
     if (FSRefMakePath(&fref, (UInt8*)buffer, 1024) != noErr) {      char2str(dst, 512, name.unicode, name.length);
       if (!dst) {
         return(false);          return(false);
     }      }
         val = buffer;  
     ret = val;  
         while(*val != '\0') {  
                 if (*val++ == '/') {  
                         ret = val;  
                 }  
         }  
     strcpy(dst, ret);  
     return(true);      return(true);
 }  }
   
Line 192  typedef struct { Line 186  typedef struct {
         long            tagid;          long            tagid;
 } _FLHDL, *FLHDL;  } _FLHDL, *FLHDL;
   
 void *file_list1st(const char *dir, FLDATA *fl) {  FLISTH file_list1st(const char *dir, FLINFO *fli) {
   
         Str255  fname;          Str255  fname;
         FSSpec  fss;          FSSpec  fss;
Line 224  void *file_list1st(const char *dir, FLDA Line 218  void *file_list1st(const char *dir, FLDA
         }          }
         ret->eoff = FALSE;          ret->eoff = FALSE;
         ret->index = 1;          ret->index = 1;
         if (file_listnext((void *)ret, fl) == SUCCESS) {          if (file_listnext((FLISTH)ret, fli) == SUCCESS) {
                 return((void *)ret);                  return((FLISTH)ret);
         }          }
   
 ff1_err2:  ff1_err2:
Line 235  ff1_err1: Line 229  ff1_err1:
         return(NULL);          return(NULL);
 }  }
   
 BOOL file_listnext(void *hdl, FLDATA *fl) {  BOOL file_listnext(FLISTH hdl, FLINFO *fli) {
   
         FLHDL   flhdl;          FLHDL   flhdl;
         Str255  fname;          Str255  fname;
Line 254  BOOL file_listnext(void *hdl, FLDATA *fl Line 248  BOOL file_listnext(void *hdl, FLDATA *fl
                 goto ffn_err;                  goto ffn_err;
         }          }
         flhdl->index++;          flhdl->index++;
         if (fl) {          if (fli) {
                 mkcstr(fl->path, sizeof(fl->path), fname);                  mkcstr(fli->path, sizeof(fli->path), fname);
                 fl->size = 0;  
                 if (flhdl->pb.hFileInfo.ioFlAttrib & 0x10) {                  if (flhdl->pb.hFileInfo.ioFlAttrib & 0x10) {
                         fl->attr = FILEATTR_DIRECTORY;                          fli->attr = FILEATTR_DIRECTORY;
                           fli->size = 0;
                 }                  }
                 else {                  else {
                         fl->attr = FILEATTR_ARCHIVE;                          fli->attr = FILEATTR_ARCHIVE;
                           fli->size = flhdl->pb.hFileInfo.ioFlLgLen;
                 }                  }
         }          }
         return(SUCCESS);          return(SUCCESS);
Line 270  ffn_err: Line 265  ffn_err:
         return(FAILURE);          return(FAILURE);
 }  }
   
 void file_listclose(void *hdl) {  void file_listclose(FLISTH hdl) {
   
         if (hdl) {          if (hdl) {
                 _MFREE(hdl);                  _MFREE(hdl);
Line 278  void file_listclose(void *hdl) { Line 273  void file_listclose(void *hdl) {
 }  }
   
 bool getLongFileName(char* dst, const char* path) {  bool getLongFileName(char* dst, const char* path) {
   
     return(false);      return(false);
 }  }
 #endif  #endif
   
   

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


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