summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>1998-12-08 22:08:01 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>1998-12-08 22:08:01 +0000
commit0da3a12e6c8663277cdbed95777d636f35548478 (patch)
treed9333009f6ca5096da74789a74916faf3235ee45 /src
parent3c9b0b9d95ce7bbacb0e7a3a87e638828f067ead (diff)
Updated scandir and pen stuff, plus got rid of ODBC libraries from
project files. git-svn-id: file:///fltk/svn/fltk/trunk@157 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/fl_color_win32.cxx6
-rw-r--r--src/scandir_win32.c50
2 files changed, 22 insertions, 34 deletions
diff --git a/src/fl_color_win32.cxx b/src/fl_color_win32.cxx
index 858e7faff..361d2eb57 100644
--- a/src/fl_color_win32.cxx
+++ b/src/fl_color_win32.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_color_win32.cxx,v 1.8 1998/12/07 13:36:24 mike Exp $"
+// "$Id: fl_color_win32.cxx,v 1.9 1998/12/08 22:07:30 mike Exp $"
//
// WIN32 color functions for the Fast Light Tool Kit (FLTK).
//
@@ -54,7 +54,7 @@ static void clear_xmap(Fl_XMap& xmap) {
if (xmap.pen) {
if(!tmppen) tmppen = CreatePen(PS_SOLID, 1, 0);
if(!tmpbrush) tmpbrush = CreateSolidBrush(0);
- HPEN oldpen = SelectObject(fl_gc, tmppen); // Push out the current pen of the gc
+ HPEN oldpen = (HPEN)SelectObject(fl_gc, tmppen); // Push out the current pen of the gc
if(oldpen != xmap.pen) SelectObject(fl_gc, oldpen); // Put it back if it is not the one we are about to delete
SelectObject(fl_gc, tmpbrush); // Push out the old pen of the gc
//fl_current_xmap = 0;
@@ -233,5 +233,5 @@ fl_select_palette(void)
#endif
//
-// End of "$Id: fl_color_win32.cxx,v 1.8 1998/12/07 13:36:24 mike Exp $".
+// End of "$Id: fl_color_win32.cxx,v 1.9 1998/12/08 22:07:30 mike Exp $".
//
diff --git a/src/scandir_win32.c b/src/scandir_win32.c
index ed0784afd..9280a76f1 100644
--- a/src/scandir_win32.c
+++ b/src/scandir_win32.c
@@ -1,5 +1,5 @@
//
-// "$Id: scandir_win32.c,v 1.8 1998/12/08 21:00:18 mike Exp $"
+// "$Id: scandir_win32.c,v 1.9 1998/12/08 22:07:30 mike Exp $"
//
// WIN32 scandir function for the Fast Light Tool Kit (FLTK).
//
@@ -29,37 +29,28 @@
#include <string.h>
#include <windows.h>
-struct dirent { char name[1]; };
+struct dirent { char d_name[1]; };
-#ifdef __cplusplus
-extern "C"
-#endif
int scandir(const char *dirname, struct dirent ***namelist,
int (*select)(struct dirent *),
int (*compar)(struct dirent **, struct dirent **)) {
-
- int len = strlen(dirname);
- char *findIn = new char[len+5]; strcpy(findIn, dirname);
- for (char *d = findIn; *d; d++) if (*d=='/') *d='\\';
- if ((len==0)) { strcpy(findIn, ".\\*"); }
- if ((len==1)&& (d[-1]=='.')) { strcpy(findIn, ".\\*"); }
- if ((len>0) && (d[-1]=='\\')) { *d++ = '*'; *d = 0; }
- if ((len>1) && (d[-1]=='.') && (d[-2]=='\\')) { d[-1] = '*'; }
-
+ int len;
+ char *findIn, *d;
WIN32_FIND_DATA find;
HANDLE h;
int nDir = 0, NDir = 0;
struct dirent **dir = 0, *selectDir;
- /*
- selectDir = (struct dirent*)new char[sizeof(dirent)+1];
- strcpy(selectDir->d_name, ".");
- dir[0] = selectDir;
- selectDir = (struct dirent*)new char[sizeof(dirent)+2];
- strcpy(selectDir->d_name, "..");
- dir[1] = selectDir;
- */
unsigned long ret;
+ len = strlen(dirname);
+ findIn = malloc(len+5);
+ strcpy(findIn, dirname);
+ for (d = findIn; *d; d++) if (*d=='/') *d='\\';
+ if ((len==0)) { strcpy(findIn, ".\\*"); }
+ if ((len==1)&& (d[-1]=='.')) { strcpy(findIn, ".\\*"); }
+ if ((len>0) && (d[-1]=='\\')) { *d++ = '*'; *d = 0; }
+ if ((len>1) && (d[-1]=='.') && (d[-2]=='\\')) { d[-1] = '*'; }
+
if ((h=FindFirstFile(findIn, &find))==INVALID_HANDLE_VALUE) {
ret = GetLastError();
if (ret != ERROR_NO_MORE_FILES) {
@@ -69,13 +60,13 @@ int scandir(const char *dirname, struct dirent ***namelist,
return nDir;
}
do {
- selectDir=(struct dirent*)new char[sizeof(dirent)+strlen(find.cFileName)];
+ selectDir=(struct dirent*)malloc(sizeof(struct dirent)+strlen(find.cFileName));
strcpy(selectDir->d_name, find.cFileName);
if (!select || (*select)(selectDir)) {
if (nDir==NDir) {
- struct dirent **tempDir = new struct dirent*[NDir+33];
+ struct dirent **tempDir = calloc(sizeof(struct dirent*), NDir+33);
if (NDir) memcpy(tempDir, dir, sizeof(struct dirent*)*NDir);
- if (dir) delete dir;
+ if (dir) free(dir);
dir = tempDir;
NDir += 32;
}
@@ -83,7 +74,7 @@ int scandir(const char *dirname, struct dirent ***namelist,
nDir++;
dir[nDir] = 0;
} else {
- delete selectDir;
+ free(selectDir);
}
} while (FindNextFile(h, &find));
ret = GetLastError();
@@ -92,7 +83,7 @@ int scandir(const char *dirname, struct dirent ***namelist,
}
FindClose(h);
- delete findIn;
+ free (findIn);
if (compar) qsort (dir, nDir, sizeof(*dir),
(int(*)(const void*, const void*))compar);
@@ -101,13 +92,10 @@ int scandir(const char *dirname, struct dirent ***namelist,
return nDir;
}
-#ifdef __cplusplus
-extern "C"
-#endif
int alphasort (struct dirent **a, struct dirent **b) {
return strcmp ((*a)->d_name, (*b)->d_name);
}
//
-// End of "$Id: scandir_win32.c,v 1.8 1998/12/08 21:00:18 mike Exp $".
+// End of "$Id: scandir_win32.c,v 1.9 1998/12/08 22:07:30 mike Exp $".
//