physfs.c
changeset 74 a4a5066fb640
parent 66 63c02eb30b04
child 93 74d1df359be3
equal deleted inserted replaced
73:96828990c739 74:a4a5066fb640
   624     return(retval);
   624     return(retval);
   625 } /* PHYSFS_getSearchPath */
   625 } /* PHYSFS_getSearchPath */
   626 
   626 
   627 
   627 
   628 int PHYSFS_setSaneConfig(const char *appName, const char *archiveExt,
   628 int PHYSFS_setSaneConfig(const char *appName, const char *archiveExt,
   629                          int includeCdRoms, int archivesFirst)
   629                                      int includeCdRoms, int archivesFirst)
   630 {
   630 {
   631     const char *basedir = PHYSFS_getBaseDir();
   631     const char *basedir = PHYSFS_getBaseDir();
   632     const char *userdir = PHYSFS_getUserDir();
   632     const char *userdir = PHYSFS_getUserDir();
   633     const char *dirsep = PHYSFS_getDirSeparator();
   633     const char *dirsep = PHYSFS_getDirSeparator();
   634     char *str;
   634     char *str;
   735     allowSymLinks = allow;
   735     allowSymLinks = allow;
   736 } /* PHYSFS_permitSymbolicLinks */
   736 } /* PHYSFS_permitSymbolicLinks */
   737 
   737 
   738 
   738 
   739 /* string manipulation in C makes my ass itch. */
   739 /* string manipulation in C makes my ass itch. */
   740 char *__PHYSFS_convertToDependent(const char *prepend,
   740 char * __PHYSFS_convertToDependent(const char *prepend,
   741                                   const char *dirName,
   741                                               const char *dirName,
   742                                   const char *append)
   742                                               const char *append)
   743 {
   743 {
   744     const char *dirsep = PHYSFS_getDirSeparator();
   744     const char *dirsep = PHYSFS_getDirSeparator();
   745     int sepsize = strlen(dirsep);
   745     int sepsize = strlen(dirsep);
   746     char *str;
   746     char *str;
   747     char *i1;
   747     char *i1;
  1231     return(rc);
  1231     return(rc);
  1232 } /* PHYSFS_close */
  1232 } /* PHYSFS_close */
  1233 
  1233 
  1234 
  1234 
  1235 int PHYSFS_read(PHYSFS_file *handle, void *buffer,
  1235 int PHYSFS_read(PHYSFS_file *handle, void *buffer,
  1236                 unsigned int objSize, unsigned int objCount)
  1236                             unsigned int objSize, unsigned int objCount)
  1237 {
  1237 {
  1238     FileHandle *h = (FileHandle *) handle->opaque;
  1238     FileHandle *h = (FileHandle *) handle->opaque;
  1239     assert(h != NULL);
  1239     assert(h != NULL);
  1240     assert(h->funcs != NULL);
  1240     assert(h->funcs != NULL);
  1241     BAIL_IF_MACRO(h->funcs->read == NULL, ERR_NOT_SUPPORTED, -1);
  1241     BAIL_IF_MACRO(h->funcs->read == NULL, ERR_NOT_SUPPORTED, -1);
  1242     return(h->funcs->read(h, buffer, objSize, objCount));
  1242     return(h->funcs->read(h, buffer, objSize, objCount));
  1243 } /* PHYSFS_read */
  1243 } /* PHYSFS_read */
  1244 
  1244 
  1245 
  1245 
  1246 int PHYSFS_write(PHYSFS_file *handle, void *buffer,
  1246 int PHYSFS_write(PHYSFS_file *handle, void *buffer,
  1247                  unsigned int objSize, unsigned int objCount)
  1247                             unsigned int objSize, unsigned int objCount)
  1248 {
  1248 {
  1249     FileHandle *h = (FileHandle *) handle->opaque;
  1249     FileHandle *h = (FileHandle *) handle->opaque;
  1250     assert(h != NULL);
  1250     assert(h != NULL);
  1251     assert(h->funcs != NULL);
  1251     assert(h->funcs != NULL);
  1252     BAIL_IF_MACRO(h->funcs->write == NULL, ERR_NOT_SUPPORTED, -1);
  1252     BAIL_IF_MACRO(h->funcs->write == NULL, ERR_NOT_SUPPORTED, -1);
  1292     assert(h->funcs != NULL);
  1292     assert(h->funcs != NULL);
  1293     BAIL_IF_MACRO(h->funcs->fileLength == NULL, ERR_NOT_SUPPORTED, 0);
  1293     BAIL_IF_MACRO(h->funcs->fileLength == NULL, ERR_NOT_SUPPORTED, 0);
  1294     return(h->funcs->fileLength(h));
  1294     return(h->funcs->fileLength(h));
  1295 } /* PHYSFS_filelength */
  1295 } /* PHYSFS_filelength */
  1296 
  1296 
  1297 
       
  1298 /* end of physfs.c ... */
  1297 /* end of physfs.c ... */
  1299 
  1298