git-svn-id: https://svn.eduke32.com/eduke32@1479 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2009-07-29 21:56:56 +00:00
parent b04b42be23
commit e5d6d9694f
3 changed files with 12 additions and 34 deletions

View file

@ -20,7 +20,7 @@
static intptr_t kzipopen(char *filnam)
{
uint32_t i;
char newst[BMAX_PATH];
char newst[BMAX_PATH+8];
newst[0] = '|';
for (i=0; filnam[i] && (i < sizeof(newst)-2); i++) newst[i+1] = filnam[i];
@ -979,7 +979,7 @@ CACHE1D_FIND_REC *klistpath(const char *_path, const char *mask, int32_t type)
if (!pathsearchmode) // next, zip files
{
char buf[BMAX_PATH];
char buf[BMAX_PATH+4];
int32_t i, j, ftype;
strcpy(buf,path);
if (*path) strcat(buf,"/");

View file

@ -54,7 +54,7 @@ static uint32_t LSWAPIL(uint32_t a) { return(((a>>8)&0xff00)+((a&0xff00)<<8)+(a<
static uint16_t SSWAPIL(uint16_t a) { return((a>>8)+(a<<8)); }
#endif
#if !defined(_WIN32) && !defined(__DOS__)
#if !defined(_WIN32)
#include <unistd.h>
#include <dirent.h>
typedef long long __int64;
@ -71,9 +71,7 @@ static __inline int32_t filelength(int h)
#include <io.h>
#endif
#if defined(__DOS__)
#include <dos.h>
#elif defined(_WIN32)
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
@ -2836,7 +2834,7 @@ intptr_t kzopen(const char *filnam)
j = strlen(tempbuf);
if (strlen(filnam)+1+j >= sizeof(tempbuf)) continue; //don't allow int32_t filenames to buffer overrun
if ((j) && (tempbuf[j-1] != '/') && (tempbuf[j-1] != '\\') && (filnam[0] != '/') && (filnam[0] != '\\'))
#if (defined(__DOS__) || defined(_WIN32))
#if defined(_WIN32)
strcat(tempbuf,"\\");
#else
strcat(tempbuf,"/");
@ -2859,10 +2857,7 @@ intptr_t kzopen(const char *filnam)
// --------------------------------------------------------------------------
#if defined(__DOS__)
#define MAX_PATH 260
static struct find_t findata;
#elif defined(_WIN32)
#if defined(_WIN32)
static HANDLE hfind = INVALID_HANDLE_VALUE;
static WIN32_FIND_DATA findata;
#else
@ -2883,8 +2878,7 @@ static char wildst[MAX_PATH] = "", newildst[MAX_PATH] = "";
void kzfindfilestart(const char *st)
{
#if defined(__DOS__)
#elif defined(_WIN32)
#if defined(_WIN32)
if (hfind != INVALID_HANDLE_VALUE)
{ FindClose(hfind); hfind = INVALID_HANDLE_VALUE; }
#else
@ -2915,15 +2909,7 @@ kzfindfile_beg:;
Bmemcpy(filnam,newildst,wildstpathleng);
#if defined(__DOS__)
if (_dos_findfirst(newildst,_A_SUBDIR,&findata))
{ if (!kzhashbuf) return(0); srchstat = 2; continue; }
i = wildstpathleng;
if (findata.attrib&16)
if ((findata.name[0] == '.') && (!findata.name[1])) continue;
strcpy(&filnam[i],findata.name);
if (findata.attrib&16) strcat(&filnam[i],"\\");
#elif defined(_WIN32)
#if defined(_WIN32)
hfind = FindFirstFile(newildst,&findata);
if (hfind == INVALID_HANDLE_VALUE)
{ if (!kzhashbuf) return(0); srchstat = 2; continue; }
@ -2956,17 +2942,9 @@ kzfindfile_beg:;
while (1)
{
Bmemcpy(filnam,newildst,wildstpathleng);
#if defined(__DOS__)
if (_dos_findnext(&findata))
{ if (!kzhashbuf) return(0); srchstat = 2; break; }
i = wildstpathleng;
if (findata.attrib&16)
if ((findata.name[0] == '.') && (!findata.name[1])) continue;
strcpy(&filnam[i],findata.name);
if (findata.attrib&16) strcat(&filnam[i],"\\");
#elif defined(_WIN32)
#if defined(_WIN32)
if (!FindNextFile(hfind,&findata))
{ FindClose(hfind); if (!kzhashbuf) return(0); srchstat = 2; break; }
{ FindClose(hfind); hfind = INVALID_HANDLE_VALUE; if (!kzhashbuf) return(0); srchstat = 2; break; }
if (findata.dwFileAttributes&FILE_ATTRIBUTE_HIDDEN) continue;
i = wildstpathleng;
if (findata.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
@ -3007,7 +2985,7 @@ kzfindfile_beg:;
strcpy(newildst,&kzhashbuf[srchdoff+4]);
i = strlen(newildst);
if ((i) && (newildst[i-1] != '/') && (newildst[i-1] != '\\') && (filnam[0] != '/') && (filnam[0] != '\\'))
#if (defined(__DOS__) || defined(_WIN32))
#if defined(_WIN32)
strcat(newildst,"\\");
#else
strcat(newildst,"/");

View file

@ -46,5 +46,5 @@ $(JFAUDIOLIB): $(OBJECTS)
lib $(flags_lib) /out:$@ /nologo $**
clean:
-del /Q $(OBJECTS) $(JFAUDIOLIB)
-del /Q $(OBJ)\* $(JFAUDIOLIB)