zipfile.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Definitions for using a zipped' archive.
  2. Copyright (C) 1996-2015 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GCC is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GCC; see the file COPYING3. If not see
  14. <http://www.gnu.org/licenses/>.
  15. Java and all Java-based marks are trademarks or registered trademarks
  16. of Sun Microsystems, Inc. in the United States and other countries.
  17. The Free Software Foundation is independent of Sun Microsystems, Inc. */
  18. struct ZipFile {
  19. char *name;
  20. int fd;
  21. long size;
  22. long count;
  23. long dir_size;
  24. char *central_directory;
  25. /* Chain together in SeenZipFiles. */
  26. struct ZipFile *next;
  27. };
  28. typedef struct ZipFile ZipFile;
  29. struct ZipDirectory {
  30. int direntry_size;
  31. int filename_offset;
  32. int compression_method;
  33. unsigned size; /* length of file */
  34. unsigned uncompressed_size; /* length of uncompressed data */
  35. unsigned filestart; /* start of file in archive */
  36. ZipFile *zipf;
  37. int filename_length;
  38. /* char mid_padding[...]; */
  39. /* char filename[filename_length]; */
  40. /* char end_padding[...]; */
  41. };
  42. typedef struct ZipDirectory ZipDirectory;
  43. extern struct ZipFile *SeenZipFiles;
  44. #define ZIPDIR_FILENAME(ZIPD) ((char*)(ZIPD)+(ZIPD)->filename_offset)
  45. #define ZIPDIR_NEXT(ZIPD) \
  46. ((ZipDirectory*)((char*)(ZIPD)+(ZIPD)->direntry_size))
  47. #define ZIPMAGIC 0x504b0304
  48. #define ZIPEMPTYMAGIC 0x504b0506
  49. extern ZipFile * opendir_in_zip (const char *, int);
  50. extern int read_zip_archive (ZipFile *);
  51. #ifdef GCC_JCF_H
  52. extern int read_zip_member (JCF*, ZipDirectory*, ZipFile *);
  53. extern int open_in_zip (struct JCF *, const char *, const char *, int);
  54. #endif