[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer/src/Lib FindFirst.cpp codewiz.hpp 2D/...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer/src/Lib FindFirst.cpp codewiz.hpp 2D/... |
Date: |
Sat, 06 Sep 2003 12:06:18 -0400 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/09/06 12:06:18
Modified files:
src/Lib : FindFirst.cpp codewiz.hpp
src/Lib/2D : ColorTable.cpp
Log message:
some small fixes to ColorTable and my FindFirst unix implementation
Patches:
Index: netpanzer/src/Lib/2D/ColorTable.cpp
diff -u netpanzer/src/Lib/2D/ColorTable.cpp:1.5
netpanzer/src/Lib/2D/ColorTable.cpp:1.6
--- netpanzer/src/Lib/2D/ColorTable.cpp:1.5 Sat Sep 6 11:48:10 2003
+++ netpanzer/src/Lib/2D/ColorTable.cpp Sat Sep 6 12:06:18 2003
@@ -384,9 +384,6 @@
// Dump the colorTable data.
fwrite(colorArray, colorCount, sizeof(BYTE), fp);
-
- fclose(fp);
-
} // end ColorTable::saveTable
// isValid
Index: netpanzer/src/Lib/FindFirst.cpp
diff -u netpanzer/src/Lib/FindFirst.cpp:1.1 netpanzer/src/Lib/FindFirst.cpp:1.2
--- netpanzer/src/Lib/FindFirst.cpp:1.1 Sat Sep 6 09:12:39 2003
+++ netpanzer/src/Lib/FindFirst.cpp Sat Sep 6 12:06:18 2003
@@ -18,11 +18,13 @@
printf ("Start globbing for: %s\n", dir);
- if(!glob(dir, 0, 0, &handle->globbuf))
- return 0;
+ if(glob(dir, 0, 0, &handle->globbuf) != 0)
+ return (int*) -1;
+
+ printf ("Number: %d\n", handle->globbuf.gl_pathc);
if (_findnext((int*) handle, fileinfo) < 0)
- return 0;
+ return (int*) -1;
printf ("ok so far.\n");
return (int*) handle;
@@ -32,9 +34,15 @@
{
findhandle_t* handle = (findhandle_t*) ihandle;
if(handle->pos >= handle->globbuf.gl_pathc)
- return 1;
+ return -1;
- fileinfo->name = handle->globbuf.gl_pathv[handle->pos];
+ // we need to get the filename part only
+ char* lastslash = handle->globbuf.gl_pathv[handle->pos];
+ for(char* p = lastslash; *p != 0; p++) {
+ if(*p == '/')
+ lastslash = p+1;
+ }
+ fileinfo->name = lastslash;
handle->pos++;
printf ("matched: %s.\n", fileinfo->name);
Index: netpanzer/src/Lib/codewiz.hpp
diff -u netpanzer/src/Lib/codewiz.hpp:1.3 netpanzer/src/Lib/codewiz.hpp:1.4
--- netpanzer/src/Lib/codewiz.hpp:1.3 Sat Sep 6 11:18:18 2003
+++ netpanzer/src/Lib/codewiz.hpp Sat Sep 6 12:06:18 2003
@@ -42,8 +42,11 @@
void vQuitOK(const char *msg, va_list ap);
void vFUBAR(const char *msg, va_list ap);
+// XXX changed this, as it was stupid code (on unix this failed from time to
+// time
inline bool isValidPtr(const void *ptr) {
- return (ptr > 0) && (ptr < (void *)0x90000000);
+ //return (ptr > 0) && (ptr < (void *)0x90000000);
+ return ptr != 0;
}
//***************************************************************************
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer/src/Lib FindFirst.cpp codewiz.hpp 2D/...,
Matthias Braun <=