[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus contrib/msvc.zip src/include/iolib.h ...
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus contrib/msvc.zip src/include/iolib.h ... |
Date: |
10 Jan 2004 17:13:03 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/01/10 17:13:02
Modified files:
contrib : msvc.zip
src/include : iolib.h
src/stratagus : iolib.c stratagus.c
src/ui : icons.c menus.c
Log message:
Removed zziplib
Patches:
Index: stratagus/contrib/msvc.zip
Index: stratagus/src/include/iolib.h
diff -u stratagus/src/include/iolib.h:1.25 stratagus/src/include/iolib.h:1.26
--- stratagus/src/include/iolib.h:1.25 Mon Dec 22 15:09:46 2003
+++ stratagus/src/include/iolib.h Sat Jan 10 17:12:59 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: iolib.h,v 1.25 2003/12/22 04:09:46 wizzard Exp $
+// $Id: iolib.h,v 1.26 2004/01/10 06:12:59 jsalmon3 Exp $
#ifndef __IOLIB_H__
#define __IOLIB_H__
@@ -46,10 +46,6 @@
#ifdef USE_BZ2LIB
#include <bzlib.h>
#endif
-
-#ifdef USE_ZZIPLIB
-#include <zzip.h>
-#endif
#undef DrawIcon
#undef EndMenu
#undef FindResource
@@ -68,7 +64,7 @@
} FileList;
-#if 0 && !defined(USE_ZLIB) && !defined(USE_BZ2LIB) && !defined(USE_ZZIPLIB)
+#if 0 && !defined(USE_ZLIB) && !defined(USE_BZ2LIB)
// FIXME: This is broken, should write a CLopen for plain files
// FIXME: but we can avoid it anyway.
@@ -81,7 +77,7 @@
#define CLflush(file) fflush(file)
#define CLclose(file) fclose(file)
-#else // !USE_ZLIB && !USE_BZ2LIB && !defined(USE_ZZIPLIB)
+#else // !USE_ZLIB && !USE_BZ2LIB
/**
** Defines a library file
@@ -97,9 +93,6 @@
#ifdef USE_BZ2LIB
BZFILE* cl_bz; /// bzip2 file pointer
#endif // !USE_BZ2LIB
-#ifdef USE_ZZIPLIB
- ZZIP_FILE* cl_zz; /// zzip file pointer
-#endif // !USE_ZZIPLIB
} CLFile;
enum {
@@ -107,7 +100,6 @@
CLF_TYPE_PLAIN, /// plain text file handle
CLF_TYPE_GZIP, /// gzip file handle
CLF_TYPE_BZIP2, /// bzip2 file handle
- CLF_TYPE_ZZIP, /// zzip file handle
};
#define CL_OPEN_READ 0x1
@@ -133,7 +125,7 @@
extern int CLprintf(CLFile *file, char *format, ...);
-#endif // USE_ZLIB || USE_BZ2LIB || USE_ZZIPLIB
+#endif // USE_ZLIB || USE_BZ2LIB
/// Build libary path name
extern char* LibraryFileName(const char* file,char* buffer);
Index: stratagus/src/stratagus/iolib.c
diff -u stratagus/src/stratagus/iolib.c:1.55
stratagus/src/stratagus/iolib.c:1.56
--- stratagus/src/stratagus/iolib.c:1.55 Sat Dec 20 16:33:17 2003
+++ stratagus/src/stratagus/iolib.c Sat Jan 10 17:13:00 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: iolib.c,v 1.55 2003/12/20 05:33:17 jsalmon3 Exp $
+// $Id: iolib.c,v 1.56 2004/01/10 06:13:00 jsalmon3 Exp $
//@{
@@ -119,7 +119,7 @@
#endif // USE_BZ2LIB
-#if defined(USE_ZLIB) || defined(USE_BZ2LIB) || defined(USE_ZZIPLIB)
+#if defined(USE_ZLIB) || defined(USE_BZ2LIB)
/**
** CLopen Library file open
@@ -178,11 +178,6 @@
clf.cl_type = CLF_TYPE_BZIP2;
} else
#endif
-#ifdef USE_ZZIPLIB
- if ((clf.cl_zz = zzip_open(strcpy(buf, fn), O_RDONLY |
O_BINARY))) {
- clf.cl_type = CLF_TYPE_ZZIP;
- } else
-#endif
{ }
} else {
@@ -260,12 +255,6 @@
ret = 0;
}
#endif // USE_BZ2LIB
-#ifdef USE_ZZIPLIB
- if (tp == CLF_TYPE_ZZIP) {
- zzip_close(file->cl_zz);
- ret = 0;
- }
-#endif // USE_ZZIPLIB
free(file);
} else {
errno = EBADF;
@@ -301,11 +290,6 @@
ret = bzread(file->cl_bz, buf, len);
}
#endif // USE_BZ2LIB
-#ifdef USE_ZZIPLIB
- if (tp == CLF_TYPE_ZZIP) {
- ret = zzip_read(file->cl_zz, buf, len);
- }
-#endif // USE_ZZIPLIB
} else {
errno = EBADF;
}
@@ -379,13 +363,6 @@
ret = bzwrite(file->cl_bz, p, size);
}
#endif // USE_BZ2LIB
-#if defined(USE_ZZIPLIB) && 0
- // FIXME: Support Unknown and Unsupported
- if (tp == CLF_TYPE_ZZIP) {
- zzip_write(file->cl_zz, p, size);
- ret = 0;
- }
-#endif // USE_ZZIPLIB
} else {
errno = EBADF;
}
@@ -422,19 +399,13 @@
ret = 0;
}
#endif // USE_BZ2LIB
-#ifdef USE_ZZIPLIB
- if (tp == CLF_TYPE_ZZIP) {
- zzip_seek(file->cl_zz, offset, whence);
- ret = 0;
- }
-#endif // USE_ZZIPLIB
} else {
errno = EBADF;
}
return ret;
}
-#endif // USE_ZLIB || USE_BZ2LIB || USE_ZZIPLIB
+#endif // USE_ZLIB || USE_BZ2LIB
/**
** Generate a filename into library.
@@ -449,9 +420,6 @@
*/
global char* LibraryFileName(const char* file, char* buffer)
{
-#ifdef USE_ZZIPLIB
- ZZIP_FILE* zp;
-#endif
char* s;
//
@@ -473,13 +441,6 @@
return buffer;
}
#endif
-#ifdef USE_ZZIPLIB
- strcpy(buffer, file);
- if ((zp = zzip_open(buffer, O_RDONLY | O_BINARY))) {
- zzip_close(zp);
- return buffer;
- }
-#endif // USE_ZZIPLIB
//
// Try in map directory
@@ -521,12 +482,6 @@
}
*strrchr(buffer, '.') = '\0';
#endif
-#ifdef USE_ZZIPLIB
- if ((zp = zzip_open(buffer, O_RDONLY | O_BINARY))) {
- zzip_close(zp);
- return buffer;
- }
-#endif // USE_ZZIPLIB
}
if ((s = getenv("HOME"))) {
@@ -549,13 +504,6 @@
return buffer;
}
#endif
-#ifdef USE_ZZIPLIB
- sprintf(buffer, "%s/%s/%s/%s", s, STRATAGUS_HOME_PATH,
GameName, file);
- if ((zp = zzip_open(buffer, O_RDONLY | O_BINARY))) {
- zzip_close(zp);
- return buffer;
- }
-#endif // USE_ZZIPLIB
}
//
@@ -577,13 +525,6 @@
return buffer;
}
#endif
-#ifdef USE_ZZIPLIB
- sprintf(buffer, "%s/%s", StratagusLibPath, file);
- if ((zp = zzip_open(buffer, O_RDONLY | O_BINARY))) {
- zzip_close(zp);
- return buffer;
- }
-#endif // USE_ZZIPLIB
DebugLevel0Fn("File `%s' not found\n" _C_ file);
strcpy(buffer, file);
@@ -613,56 +554,6 @@
}
}
-#ifdef USE_ZZIPLIB
-/**
- * will attach a .zip extension and tries to open it
- * the with => open(2). This is a helper function for
- * => zzip_dir_open, => zzip_opendir and => zzip_open.
- *
- * copied from zzip_dir.c, as it is a private function
- * and won't be exported in shared lib / dll version!
- */
-local int
-__my_zzip_open_zip(const char* filename, int filemode)
-{
- auto char file[PATH_MAX];
- int fd;
- int len;
-#ifndef USE_WIN32
- static const char* my_zzip_default_fileext[] =
- {
- ".zip", ".ZIP", /* common extension */
- 0
- };
- const char** ext;
-#endif
-
- fd = -1;
- len = strlen(filename);
-#ifdef USE_WIN32
- if (len + 4 < PATH_MAX) {
- strcpy(file, filename);
- strcpy(file + len, ".zip");
- fd = open(file, filemode);
- }
-#else
- ext = my_zzip_default_fileext;
- if (len + 4 < PATH_MAX) {
- memcpy(file, filename, len + 1);
-
- for (; *ext ; ++ext) {
- strcpy(file + len, *ext);
- fd = open(file, filemode);
- if (fd != -1) {
- break;
- }
- }
- }
-#endif
- return fd;
-}
-#endif
-
/**
** Generate a list of files within a specified directory
**
@@ -674,24 +565,11 @@
*/
global int ReadDataDirectory(const char* dirname, int (*filter)(char*,
FileList*), FileList** flp)
{
-#ifdef USE_ZZIPLIB
- ZZIP_DIR* dirp = NULL;
- ZZIP_DIRENT* dp;
- // ATTENTION: valid until end of file!
- #define readdir zzip_readdir
- #define closedir zzip_closedir
- int i;
- int entvalid;
- char zzbasepath[PATH_MAX];
- struct stat st;
- char* cp;
-#else
#ifndef _MSC_VER
DIR* dirp;
struct dirent* dp;
#endif
struct stat st;
-#endif
#ifdef _MSC_VER
struct _finddata_t fileinfo;
long hFile;
@@ -713,100 +591,21 @@
np = buffer + n;
n = 0;
-#ifdef USE_ZZIPLIB
- strcpy(zzbasepath, dirname);
- /* per each slash in filename, check if it there is a zzip around */
- while ((cp = strrchr(zzbasepath, '/'))) {
- int fd;
- zzip_error_t e;
-
- *cp = '\0'; /* cut at path separator == possible zipfile
basename */
- fd = __my_zzip_open_zip(zzbasepath, O_RDONLY | O_BINARY);
- if (fd != -1) {
- /* found zip-file, now open it */
- dirp = zzip_dir_fdopen(fd, &e);
- if (e) {
- errno = zzip_errno(e);
- close(fd);
- dirp = NULL;
- }
- break;
- }
- }
- if (!dirp) {
- int fd;
- zzip_error_t e;
-
- // this is tricky - we used to simply zzip_opendir(dirname)
here, but
- // zziplib (correctly) prefers real directories over same named
zipfiles
- // and we want it vice versa in this special case. Otherwise it
would not
- // match the path separator backtrace above, which relies on
recursive
- // __zip_open_dir(). __zip_open_dir() only detects zipfiles,
not real dirs!
- fd = __my_zzip_open_zip(dirname, O_RDONLY | O_BINARY);
- if (fd == -1) {
- dirp = zzip_opendir(dirname);
- zzbasepath[0] = 0;
- } else {
- dirp = zzip_dir_fdopen(fd, &e);
- if (e) {
- errno = zzip_errno(e);
- close(fd);
- dirp = NULL;
- } else {
- strcpy(zzbasepath, dirname);
- }
- DebugLevel3Fn("zzbasepath `%s', dirname `%s'\n" _C_
- zzbasepath _C_ dirname);
- }
- }
-#if !defined(_MSC_VER) && defined(DEBUG)
- if (!dirp) {
- DebugLevel0Fn("Dir `%s' not found\n" _C_ dirname);
- }
-#endif
-#else
#ifndef _MSC_VER
dirp = opendir(dirname);
#endif
-#endif
#ifndef _MSC_VER
if (dirp) {
while ((dp = readdir(dirp)) != NULL) {
filename = dp->d_name;
#else
-#ifdef USE_ZZIPLIB
- if (!dirp) {
- strcat(buffer, "*.*");
- hFile = _findfirst(buffer, &fileinfo);
- }
- if (dirp || (!dirp && hFile != -1L)) {
- int first;
- first = 1;
- while (1) {
- if (!dirp) {
- if (first) {
- first = 0;
- } else {
- if (_findnext(hFile, &fileinfo) != 0) {
- break;
- }
- }
- filename = fileinfo.name;
- } else {
- if ((dp = readdir(dirp)) == NULL) {
- break;
- }
- filename = dp->d_name;
- }
-#else
strcat(buffer, "*.*");
hFile = _findfirst(buffer, &fileinfo);
if (hFile != -1L) {
do {
filename = fileinfo.name;
#endif
-#endif
if (strcmp(filename, ".") == 0) {
continue;
@@ -816,80 +615,9 @@
}
strcpy(np, filename);
-#ifdef USE_ZZIPLIB
- entvalid = 0;
- if (dirp && zzip_dir_real(dirp)) {
- if (stat(buffer, &st) == 0) {
- isdir = S_ISDIR(st.st_mode);
- if (isdir || S_ISREG(st.st_mode)) {
- entvalid = 1;
- if (!isdir) { // Find
out if we have a zip here ..
- cp = strrchr(buffer,
'.');
- if (cp) {
- *cp = 0;
- isdir =
__my_zzip_open_zip(buffer, O_RDONLY|O_BINARY);
- if (isdir !=
-1) {
-
close(isdir);
- isdir =
1;
- } else {
- isdir =
0;
- *cp =
'.';
- }
- }
- }
- }
- }
- } else if (dirp) {
- if (zzbasepath[0]) {
- size_t len;
- len = strlen(zzbasepath);
- isdir = 0;
- if (strlen(dirname) > len) {
- cp = (char*)dirname + len + 1;
- len = strlen(cp);
- if (strlen(filename) >= len &&
memcmp(filename, cp, len) == 0 &&
- filename[len]
== '/' && filename[len + 1]) {
- strcpy(np, filename +
len + 1);
- goto zzentry;
- }
- } else {
- strcpy(np, dp->d_name);
- goto zzentry;
- }
- } else {
-zzentry:
- DebugLevel3Fn("zzip-entry `%s', `%s'\n"
_C_ buffer _C_ np);
- entvalid = 1;
- cp = strchr(np, '/');
- if (cp) {
- isdir = 1;
- *cp = 0;
- for (i = 0; i < n; ++i) {
- if (fl[i].type == 0 &&
strcmp(fl[i].name, np) == 0) {
- entvalid = 0;
// already there
- break;
- }
- }
- }
- }
- }
-#ifdef _MSC_VER
- else {
- if (stat(buffer, &st) == 0) {
- isdir = S_ISDIR(st.st_mode);
- if (isdir || S_ISREG(st.st_mode)) {
- entvalid = 1;
- }
- }
- }
-#endif
- {
- if (entvalid) {
-#else // }}
if (stat(buffer, &st) == 0) {
isdir = S_ISDIR(st.st_mode);
if (isdir || S_ISREG(st.st_mode)) {
-#endif
if (n) {
nfl = realloc(fl,
sizeof(FileList) * (n + 1));
if (nfl) {
@@ -928,17 +656,8 @@
}
closedir(dirp);
#else
-#ifdef USE_ZZIPLIB
- }
- if (!dirp) {
- _findclose(hFile);
- } else {
- closedir(dirp);
- }
-#else
} while (_findnext(hFile, &fileinfo) == 0);
_findclose(hFile);
-#endif
#endif
}
if (n == 0) {
Index: stratagus/src/stratagus/stratagus.c
diff -u stratagus/src/stratagus/stratagus.c:1.242
stratagus/src/stratagus/stratagus.c:1.243
--- stratagus/src/stratagus/stratagus.c:1.242 Sat Jan 10 06:39:47 2004
+++ stratagus/src/stratagus/stratagus.c Sat Jan 10 17:13:00 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: stratagus.c,v 1.242 2004/01/09 19:39:47 jsalmon3 Exp $
+// $Id: stratagus.c,v 1.243 2004/01/10 06:13:00 jsalmon3 Exp $
//@{
@@ -754,9 +754,6 @@
#endif
#ifdef USE_BZ2LIB
"BZ2LIB "
-#endif
-#ifdef USE_ZZIPLIB
- "ZZIPLIB "
#endif
#ifdef USE_SDL
"SDL "
Index: stratagus/src/ui/icons.c
diff -u stratagus/src/ui/icons.c:1.62 stratagus/src/ui/icons.c:1.63
--- stratagus/src/ui/icons.c:1.62 Sat Jan 10 15:11:46 2004
+++ stratagus/src/ui/icons.c Sat Jan 10 17:13:01 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: icons.c,v 1.62 2004/01/10 04:11:46 jsalmon3 Exp $
+// $Id: icons.c,v 1.63 2004/01/10 06:13:01 jsalmon3 Exp $
//@{
@@ -433,7 +433,7 @@
int i;
CLprintf(file, "\n--- -----------------------------------------\n");
- CLprintf(file, "--- MODULE: icons $Id: icons.c,v 1.62 2004/01/10
04:11:46 jsalmon3 Exp $\n\n");
+ CLprintf(file, "--- MODULE: icons $Id: icons.c,v 1.63 2004/01/10
06:13:01 jsalmon3 Exp $\n\n");
//
// Mapping the original icon numbers in puds to our internal strings
@@ -604,7 +604,7 @@
/**
** Register CCL features for icons.
**
-** @todo Add more functions for CCL. (draw-icon)
+** @todo Add more functions for CCL. (DrawIcon)
*/
global void IconCclRegister(void)
{
Index: stratagus/src/ui/menus.c
diff -u stratagus/src/ui/menus.c:1.603 stratagus/src/ui/menus.c:1.604
--- stratagus/src/ui/menus.c:1.603 Sat Jan 10 06:58:47 2004
+++ stratagus/src/ui/menus.c Sat Jan 10 17:13:01 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: menus.c,v 1.603 2004/01/09 19:58:47 jsalmon3 Exp $
+// $Id: menus.c,v 1.604 2004/01/10 06:13:01 jsalmon3 Exp $
//@{
@@ -3423,9 +3423,6 @@
int sz;
static int szl[] = { -1, 32, 64, 96, 128, 256, 512, 1024 };
Menu *menu;
-#ifdef USE_ZZIPLIB
- ZZIP_FILE *zzf;
-#endif
menu = FindMenu("menu-select-scenario");
@@ -3448,15 +3445,6 @@
np = pathbuf;
}
fl->type = -1;
-#ifdef USE_ZZIPLIB
- if ((zzf = zzip_open(pathbuf, O_RDONLY|O_BINARY))) {
- sz = zzip_file_real(zzf);
- zzip_close(zzf);
- if (!sz) {
- goto usezzf;
- }
- }
-#endif
u = 0;
lcp = 0;
while (suf[u]) {
@@ -3488,9 +3476,6 @@
}
#endif
if (*cp == 0) {
-#ifdef USE_ZZIPLIB
-usezzf:
-#endif
if (curopt == 0) {
// info = GetCmInfo(pathbuf);
info = NULL;
@@ -5243,10 +5228,6 @@
char *cp;
char *lcp;
unsigned u;
-#ifdef USE_ZZIPLIB
- int sz;
- ZZIP_FILE *zzf;
-#endif
np = strrchr(pathbuf, '/');
if (np) {
@@ -5255,15 +5236,6 @@
np = pathbuf;
}
fl->type = -1;
-#ifdef USE_ZZIPLIB
- if ((zzf = zzip_open(pathbuf, O_RDONLY | O_BINARY))) {
- sz = zzip_file_real(zzf);
- zzip_close(zzf);
- if (!sz) {
- goto usezzf;
- }
- }
-#endif
suf[0] = ".pud";
suf[1] = ".scm";
suf[2] = ".chk";
@@ -5299,9 +5271,6 @@
}
#endif
if (*cp == 0) {
-#ifdef USE_ZZIPLIB
-usezzf:
-#endif
if (strcasestr(np, ".pud")) {
info = GetPudInfo(pathbuf);
if (info) {
@@ -6145,10 +6114,6 @@
char *np;
char *cp;
char *lcp;
-#ifdef USE_ZZIPLIB
- int sz;
- ZZIP_FILE *zzf;
-#endif
suf = ".pud";
np = strrchr(pathbuf, '/');
@@ -6160,15 +6125,6 @@
cp = np;
cp--;
fl->type = -1;
-#ifdef USE_ZZIPLIB
- if ((zzf = zzip_open(pathbuf, O_RDONLY|O_BINARY))) {
- sz = zzip_file_real(zzf);
- zzip_close(zzf);
- if (!sz) {
- goto usezzf;
- }
- }
-#endif
do {
lcp = cp++;
cp = strcasestr(cp, suf);
@@ -6186,9 +6142,6 @@
}
#endif
if (*cp == 0) {
-#ifdef USE_ZZIPLIB
-usezzf:
-#endif
if (strcasestr(pathbuf, ".pud")) {
fl->type = 1;
fl->name = strdup(np);
@@ -6617,10 +6570,6 @@
char *np;
char *cp;
char *lcp;
-#ifdef USE_ZZIPLIB
- int sz;
- ZZIP_FILE *zzf;
-#endif
suf = ".log";
np = strrchr(pathbuf, '/');
@@ -6632,15 +6581,6 @@
cp = np;
cp--;
fl->type = -1;
-#ifdef USE_ZZIPLIB
- if ((zzf = zzip_open(pathbuf, O_RDONLY | O_BINARY))) {
- sz = zzip_file_real(zzf);
- zzip_close(zzf);
- if (!sz) {
- goto usezzf;
- }
- }
-#endif
do {
lcp = cp++;
cp = strcasestr(cp, suf);
@@ -6658,9 +6598,6 @@
}
#endif
if (*cp == 0) {
-#ifdef USE_ZZIPLIB
-usezzf:
-#endif
if (strcasestr(pathbuf, ".log")) {
fl->type = 1;
fl->name = strdup(np);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus contrib/msvc.zip src/include/iolib.h ...,
address@hidden <=