summaryrefslogtreecommitdiff
path: root/src/common/grfio.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-17 10:03:30 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-17 10:03:30 +0000
commit58d47620f3fc6cde55c6c39ebfe65ffdb8b0d8c1 (patch)
tree04f13dca0888a9e384970fd3996a306b5972fd7f /src/common/grfio.c
parent069d63bc755e5a9335946eb70ba610956c307386 (diff)
downloadhercules-58d47620f3fc6cde55c6c39ebfe65ffdb8b0d8c1.tar.gz
hercules-58d47620f3fc6cde55c6c39ebfe65ffdb8b0d8c1.tar.bz2
hercules-58d47620f3fc6cde55c6c39ebfe65ffdb8b0d8c1.tar.xz
hercules-58d47620f3fc6cde55c6c39ebfe65ffdb8b0d8c1.zip
* Discarded extra deflate function needed for afm reading
- as a result, discarded the whole chain of support functions, .c files and includes needed to make that one function run - also removed zlib compile/link dependencies where they are not needed - reduced the whole zlib package into two core include files - adjusted makefiles / project files to reflect this change git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10273 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/grfio.c')
-rw-r--r--src/common/grfio.c91
1 files changed, 1 insertions, 90 deletions
diff --git a/src/common/grfio.c b/src/common/grfio.c
index b15b37018..a96663b8f 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -4,20 +4,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
-#include "grfio.h"
-#include "malloc.h"
-#include "../zlib/unzip.h"
-
-#ifdef __WIN32
- #include "../zlib/zlib.h"
- #include "../zlib/iowin32.h"
-#else
- #ifndef __FREEBSD__
- #include <zlib.h>
- #endif
-#endif
+#include <zlib.h>
int decode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen)
{
@@ -79,80 +67,3 @@ int encode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char*
err = deflateEnd(&stream);
return err;
}
-
-/* ===================================
-* Unzips a file. 1: success, 0: error
-* Adapted from miniunz.c [Celest]
-* Version 1.01b, May 30th, 2004
-* Copyright (C) 1998-2004 Gilles Vollant
-* -------------------------------------
-*/
-int deflate_file (const char *source, const char *filename)
-{
-#ifdef _WIN32
- zlib_filefunc_def ffunc;
-#endif
- unzFile uf = NULL;
- int err = UNZ_OK;
- uInt size_buf = 8192;
- FILE *fout = NULL;
- void *buf;
-
-#ifdef _WIN32
- fill_win32_filefunc(&ffunc);
- uf = unzOpen2(source, &ffunc);
-#else
- uf = unzOpen(source);
-#endif
-
- if (uf == NULL) {
- //printf("Cannot open %s\n", source);
- return 0;
- }
- //printf("%s opened\n", source);
-
- if (unzLocateFile(uf, filename, 0) != UNZ_OK) {
- //printf("file %s not found in the zipfile\n", filename);
- return 0;
- }
-
- err = unzOpenCurrentFilePassword(uf, NULL);
- //if (err != UNZ_OK)
- // printf("error %d with zipfile in unzOpenCurrentFilePassword\n", err);
-
- fout = fopen(filename,"wb");
- if (fout == NULL) {
- //printf("error opening %s\n", filename);
- return 0;
- }
-
- buf = (void *)aMalloc(size_buf);
- do {
- err = unzReadCurrentFile(uf, buf, size_buf);
- if (err < 0) {
- //printf("error %d with zipfile in unzReadCurrentFile\n", err);
- break;
- }
- if (err > 0 &&
- fwrite(buf, err, 1, fout)!=1)
- {
- //printf("error in writing extracted file\n");
- err = UNZ_ERRNO;
- break;
- }
- } while (err > 0);
-
- if (fout) fclose(fout);
-
- if (err == UNZ_OK) {
- err = unzCloseCurrentFile (uf);
- //if (err != UNZ_OK)
- // printf("error %d with zipfile in unzCloseCurrentFile\n", err);
- aFree(buf);
- return (err == UNZ_OK);
- }
-
- unzCloseCurrentFile(uf); /* don't lose the error */
-
- return 0;
-}