archivers/zip.c
changeset 22 49f6101707b4
parent 21 b1ea58d70a56
child 28 529214f57d1b
equal deleted inserted replaced
21:b1ea58d70a56 22:49f6101707b4
     6  *  This file written by Ryan C. Gordon.
     6  *  This file written by Ryan C. Gordon.
     7  */
     7  */
     8 
     8 
     9 #include <stdio.h>
     9 #include <stdio.h>
    10 #include <stdlib.h>
    10 #include <stdlib.h>
       
    11 #include "physfs.h"
    11 
    12 
    12 #define __PHYSICSFS_INTERNAL__
    13 #define __PHYSICSFS_INTERNAL__
    13 #include "physfs_internal.h"
    14 #include "physfs_internal.h"
    14 
    15 
    15 #if (!defined PHYSFS_SUPPORTS_ZIP)
    16 #if (!defined PHYSFS_SUPPORTS_ZIP)
    16 #error PHYSFS_SUPPORTS_ZIP must be defined.
    17 #error PHYSFS_SUPPORTS_ZIP must be defined.
    17 #endif
    18 #endif
    18 
    19 
    19 extern const DirFunctions __PHYSFS_DirFunctions_ZIP;
    20 extern const DirFunctions __PHYSFS_DirFunctions_ZIP;
    20 extern const FileFunctions __PHYSFS_FileHandle_ZIP;
    21 static const FileFunctions __PHYSFS_FileFunctions_ZIP;
    21 
    22 
    22 
    23 
    23 static int ZIP_read(FileHandle *handle, void *buffer,
    24 static int ZIP_read(FileHandle *handle, void *buffer,
    24                     unsigned int objSize, unsigned int objCount)
    25                     unsigned int objSize, unsigned int objCount)
    25 {
    26 {
    91     ZIP_read,       /* read() method  */
    92     ZIP_read,       /* read() method  */
    92     NULL,           /* write() method */
    93     NULL,           /* write() method */
    93     ZIP_eof,        /* eof() method   */
    94     ZIP_eof,        /* eof() method   */
    94     ZIP_tell,       /* tell() method  */
    95     ZIP_tell,       /* tell() method  */
    95     ZIP_seek,       /* seek() method  */
    96     ZIP_seek,       /* seek() method  */
    96     ZIP_fileClose,  /* fileClose() method */
    97     ZIP_fileClose   /* fileClose() method */
    97 };
    98 };
    98 
    99 
    99 
   100 
   100 const DirFunctions __PHYSFS_DirFunctions_ZIP =
   101 const DirFunctions __PHYSFS_DirFunctions_ZIP =
   101 {
   102 {
   108     ZIP_openRead,           /* openRead() method       */
   109     ZIP_openRead,           /* openRead() method       */
   109     NULL,                   /* openWrite() method      */
   110     NULL,                   /* openWrite() method      */
   110     NULL,                   /* openAppend() method     */
   111     NULL,                   /* openAppend() method     */
   111     NULL,                   /* remove() method         */
   112     NULL,                   /* remove() method         */
   112     NULL,                   /* mkdir() method          */
   113     NULL,                   /* mkdir() method          */
   113     ZIP_dirClose,           /* dirClose() method       */
   114     ZIP_dirClose            /* dirClose() method       */
   114 };
   115 };
   115 
   116 
   116 const __PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP =
   117 const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP =
   117 {
   118 {
   118     "ZIP",
   119     "ZIP",
   119     "PkZip/WinZip/Info-Zip compatible"
   120     "PkZip/WinZip/Info-Zip compatible"
   120 };
   121 };
   121 
   122