DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L1903
Version: 1.3-feature





Link: http://www.fltk.org/str.php?L1903
Version: 1.3-feature
Index: src/Fl_BMP_Image.cxx
===================================================================
--- src/Fl_BMP_Image.cxx        (revision 6655)
+++ src/Fl_BMP_Image.cxx        (working copy)
@@ -35,6 +35,7 @@
 //
 
 #include <FL/Fl_BMP_Image.H>
+#include <FL/fl_utf8.H>
 #include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -93,7 +94,7 @@
 
 
   // Open the file...
-  if ((fp = fopen(bmp, "rb")) == NULL) return;
+  if ((fp = fl_fopen(bmp, "rb")) == NULL) return;
 
   // Get the header...
   byte = (uchar)getc(fp);      // Check "BM" sync chars
Index: src/Fl_Text_Editor.cxx
===================================================================
--- src/Fl_Text_Editor.cxx      (revision 6655)
+++ src/Fl_Text_Editor.cxx      (working copy)
@@ -488,6 +488,7 @@
 
   switch (event) {
     case FL_FOCUS:
+      fl_set_spot(textfont(), textsize(), x(), y(), w(), h(), window());
       show_cursor(mCursorOn); // redraws the cursor
       if (buffer()->selected()) redraw(); // Redraw selections...
       Fl::focus(this);
@@ -497,6 +498,7 @@
       show_cursor(mCursorOn); // redraws the cursor
       if (buffer()->selected()) redraw(); // Redraw selections...
     case FL_HIDE:
+      fl_reset_spot();
       if (when() & FL_WHEN_RELEASE) maybe_do_callback();
       return 1;
 
Index: src/Fl_get_system_colors.cxx
===================================================================
--- src/Fl_get_system_colors.cxx        (revision 6655)
+++ src/Fl_get_system_colors.cxx        (working copy)
@@ -291,7 +291,7 @@
 */
 int Fl::scheme(const char *s) {
   if (!s) {
-    if ((s = getenv("FLTK_SCHEME")) == NULL) {
+    if ((s = fl_getenv("FLTK_SCHEME")) == NULL) {
 #if !defined(WIN32) && !defined(__APPLE__)
       const char* key = 0;
       if (Fl::first_window()) key = Fl::first_window()->xclass();
Index: src/fl_utf8.cxx
===================================================================
--- src/fl_utf8.cxx     (revision 6655)
+++ src/fl_utf8.cxx     (working copy)
@@ -764,6 +764,23 @@
 #endif
 }
 
+
+int fl_chdir(const char* f)
+{
+#if defined (WIN32) && !defined(__CYGWIN__)
+               int l = strlen(f);
+//             wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
+//             wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
+               unsigned wn = fl_utf8toUtf16(f, l, NULL, 0) + 1; // Query length
+               wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
+               wn = fl_utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // 
Convert string
+               wbuf[wn] = 0;
+               return _wchdir(wbuf);
+#else
+       return chdir(f);
+#endif
+}
+
 // recursively create a path in the file system
 char fl_make_path( const char *path ) {
   if (fl_access(path, 0)) {
Index: src/Fl_File_Icon2.cxx
===================================================================
--- src/Fl_File_Icon2.cxx       (revision 6655)
+++ src/Fl_File_Icon2.cxx       (working copy)
@@ -54,9 +54,6 @@
 #if defined(WIN32) && !defined(__CYGWIN__)
 #  include <io.h>
 #  define F_OK 0
-// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
-// on Windows, which is supposed to be POSIX compliant...
-#  define access _access
 #else
 #  include <unistd.h>
 #endif // WIN32
@@ -680,16 +677,16 @@
 
     if (!kdedir) {
       // Figure out where KDE is installed...
-      if ((kdedir = getenv("KDEDIR")) == NULL) {
-        if (!access("/opt/kde", F_OK)) kdedir = "/opt/kde";
-       else if (!access("/usr/local/share/mimelnk", F_OK)) kdedir = 
"/usr/local";
+      if ((kdedir = fl_getenv("KDEDIR")) == NULL) {
+        if (!fl_access("/opt/kde", F_OK)) kdedir = "/opt/kde";
+       else if (!fl_access("/usr/local/share/mimelnk", F_OK)) kdedir = 
"/usr/local";
         else kdedir = "/usr";
       }
     }
 
     snprintf(filename, sizeof(filename), "%s/share/mimelnk", kdedir);
 
-    if (!access(filename, F_OK)) {
+    if (!fl_access(filename, F_OK)) {
       // Load KDE icons...
       icon = new Fl_File_Icon("*", Fl_File_Icon::PLAIN);
 
@@ -697,7 +694,7 @@
        snprintf(icondir, sizeof(icondir), "%s/share/icons/%s", kdedir,
                 icondirs[i]);
 
-        if (!access(icondir, F_OK)) break;
+        if (!fl_access(icondir, F_OK)) break;
       }
 
       if (icondirs[i]) {
@@ -708,25 +705,25 @@
                 kdedir);
       }
 
-      if (!access(filename, F_OK)) icon->load_image(filename);
+      if (!fl_access(filename, F_OK)) icon->load_image(filename);
 
       icon = new Fl_File_Icon("*", Fl_File_Icon::LINK);
 
       snprintf(filename, sizeof(filename), "%s/16x16/filesystems/link.png",
                icondir);
 
-      if (!access(filename, F_OK)) icon->load_image(filename);
+      if (!fl_access(filename, F_OK)) icon->load_image(filename);
 
       snprintf(filename, sizeof(filename), "%s/share/mimelnk", kdedir);
       load_kde_icons(filename, icondir);
-    } else if (!access("/usr/share/icons/folder.xpm", F_OK)) {
+    } else if (!fl_access("/usr/share/icons/folder.xpm", F_OK)) {
       // Load GNOME icons...
       icon = new Fl_File_Icon("*", Fl_File_Icon::PLAIN);
       icon->load_image("/usr/share/icons/page.xpm");
 
       icon = new Fl_File_Icon("*", Fl_File_Icon::DIRECTORY);
       icon->load_image("/usr/share/icons/folder.xpm");
-    } else if (!access("/usr/dt/appconfig/icons", F_OK)) {
+    } else if (!fl_access("/usr/dt/appconfig/icons", F_OK)) {
       // Load CDE icons...
       icon = new Fl_File_Icon("*", Fl_File_Icon::PLAIN);
       icon->load_image("/usr/dt/appconfig/icons/C/Dtdata.m.pm");
@@ -745,7 +742,7 @@
 
       icon = new Fl_File_Icon("*.ppd", Fl_File_Icon::PLAIN);
       icon->load_image("/usr/dt/appconfig/icons/C/DtPrtpr.m.pm");
-    } else if (!access("/usr/lib/filetype", F_OK)) {
+    } else if (!fl_access("/usr/lib/filetype", F_OK)) {
       // Load SGI icons...
       icon = new Fl_File_Icon("*", Fl_File_Icon::PLAIN);
       icon->load_fti("/usr/lib/filetype/iconlib/generic.doc.fti");
@@ -759,7 +756,7 @@
       icon = new 
Fl_File_Icon("*.{bmp|bw|gif|jpg|pbm|pcd|pgm|ppm|png|ras|rgb|tif|xbm|xpm}", 
Fl_File_Icon::PLAIN);
       icon->load_fti("/usr/lib/filetype/system/iconlib/ImageFile.fti");
 
-      if (!access("/usr/lib/filetype/install/iconlib/acroread.doc.fti", F_OK)) 
{
+      if (!fl_access("/usr/lib/filetype/install/iconlib/acroread.doc.fti", 
F_OK)) {
        icon = new Fl_File_Icon("*.{eps|ps}", Fl_File_Icon::PLAIN);
        
icon->load_fti("/usr/lib/filetype/system/iconlib/PostScriptFile.closed.fti");
 
@@ -770,13 +767,13 @@
        
icon->load_fti("/usr/lib/filetype/system/iconlib/PostScriptFile.closed.fti");
       }
 
-      if (!access("/usr/lib/filetype/install/iconlib/html.fti", F_OK)) {
+      if (!fl_access("/usr/lib/filetype/install/iconlib/html.fti", F_OK)) {
        icon = new Fl_File_Icon("*.{htm|html|shtml}", Fl_File_Icon::PLAIN);
         icon->load_fti("/usr/lib/filetype/iconlib/generic.doc.fti");
        icon->load_fti("/usr/lib/filetype/install/iconlib/html.fti");
       }
 
-      if (!access("/usr/lib/filetype/install/iconlib/color.ps.idle.fti", 
F_OK)) {
+      if (!fl_access("/usr/lib/filetype/install/iconlib/color.ps.idle.fti", 
F_OK)) {
        icon = new Fl_File_Icon("*.ppd", Fl_File_Icon::PLAIN);
        icon->load_fti("/usr/lib/filetype/install/iconlib/color.ps.idle.fti");
       }
@@ -853,7 +850,7 @@
   pattern[0]      = '\0';
   iconfilename[0] = '\0';
 
-  if ((fp = fopen(filename, "rb")) != NULL) {
+  if ((fp = fl_fopen(filename, "rb")) != NULL) {
     while (fgets(tmp, sizeof(tmp), fp)) {
       if ((val = get_kde_val(tmp, "Icon")) != NULL)
        strlcpy(iconfilename, val, sizeof(iconfilename));
@@ -875,7 +872,7 @@
     if (iconfilename[0]) {
       if (iconfilename[0] == '/') {
         strlcpy(full_iconfilename, iconfilename, sizeof(full_iconfilename));
-      } else if (!access(icondir, F_OK)) {
+      } else if (!fl_access(icondir, F_OK)) {
         // KDE 3.x and 2.x icons
        int             i;              // Looping var
        static const char *paths[] = {  // Subdirs to look in...
@@ -938,7 +935,7 @@
           snprintf(full_iconfilename, sizeof(full_iconfilename),
                   "%s/%s/%s.png", icondir, paths[i], iconfilename);
 
-          if (!access(full_iconfilename, F_OK)) break;
+          if (!fl_access(full_iconfilename, F_OK)) break;
        }
 
         if (i >= (int)(sizeof(paths) / sizeof(paths[0]))) return;
@@ -947,7 +944,7 @@
         snprintf(full_iconfilename, sizeof(full_iconfilename),
                 "%s/%s", tmp, iconfilename);
 
-        if (access(full_iconfilename, F_OK)) return;
+        if (fl_access(full_iconfilename, F_OK)) return;
       }
 
       if (strncmp(mimetype, "inode/", 6) == 0) {
Index: src/fl_open_uri.cxx
===================================================================
--- src/fl_open_uri.cxx (revision 6655)
+++ src/fl_open_uri.cxx (working copy)
@@ -30,6 +30,7 @@
 //
 
 #include <FL/filename.H>
+#include <FL/fl_utf8.H>
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -236,7 +237,7 @@
                *end;                   // End of filename buffer
 
 
-  if ((path = getenv("PATH")) == NULL) path = "/bin:/usr/bin";
+  if ((path = fl_getenv("PATH")) == NULL) path = "/bin:/usr/bin";
 
   for (ptr = filename, end = filename + filesize - 1; *path; path ++) {
     if (*path == ':') {
@@ -244,7 +245,7 @@
 
       strlcpy(ptr, program, end - ptr + 1);
 
-      if (!access(filename, X_OK)) return filename;
+      if (!fl_access(filename, X_OK)) return filename;
 
       ptr = filename;
     } else if (ptr < end) *ptr++ = *path;
@@ -255,7 +256,7 @@
 
     strlcpy(ptr, program, end - ptr + 1);
 
-    if (!access(filename, X_OK)) return filename;
+    if (!fl_access(filename, X_OK)) return filename;
   }
 
   return 0;
Index: src/Fl_JPEG_Image.cxx
===================================================================
--- src/Fl_JPEG_Image.cxx       (revision 6655)
+++ src/Fl_JPEG_Image.cxx       (working copy)
@@ -35,6 +35,7 @@
 //
 
 #include <FL/Fl_JPEG_Image.H>
+#include <FL/fl_utf8.H>
 #include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -110,7 +111,7 @@
   array = (uchar *)0;
 
   // Open the image file...
-  if ((fp = fopen(jpeg, "rb")) == NULL) return;
+  if ((fp = fl_fopen(jpeg, "rb")) == NULL) return;
 
   // Setup the decompressor info and read the header...
   dinfo.err                = jpeg_std_error((jpeg_error_mgr *)&jerr);
Index: src/Fl_Preferences.cxx
===================================================================
--- src/Fl_Preferences.cxx      (revision 6655)
+++ src/Fl_Preferences.cxx      (working copy)
@@ -40,10 +40,6 @@
 #if defined(WIN32) && !defined(__CYGWIN__)
 #  include <direct.h>
 #  include <io.h>
-// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
-// on Windows, which is supposed to be POSIX compliant...
-#  define access _access
-#  define mkdir _mkdir
 #elif defined (__APPLE__)
 #  include <Carbon/Carbon.h>
 #  include <unistd.h>
@@ -767,7 +763,7 @@
 
 // recursively create a path in the file system
 static char makePath( const char *path ) {
-  if (access(path, 0)) {
+  if (fl_access(path, 0)) {
     const char *s = strrchr( path, '/' );
     if ( !s ) return 0;
     int len = s-path;
@@ -776,11 +772,7 @@
     p[len] = 0;
     makePath( p );
     free( p );
-#if defined(WIN32) && !defined(__CYGWIN__)
-    return ( mkdir( path ) == 0 );
-#else
-    return ( mkdir( path, 0777 ) == 0 );
-#endif // WIN32 && !__CYGWIN__
+    return ( fl_mkdir( path, 0777 ) == 0 );
   }
   return 1;
 }
Index: src/Fl_File_Chooser2.cxx
===================================================================
--- src/Fl_File_Chooser2.cxx    (revision 6655)
+++ src/Fl_File_Chooser2.cxx    (working copy)
@@ -351,10 +351,6 @@
 #if defined(WIN32) && ! defined (__CYGWIN__)
 #  include <direct.h>
 #  include <io.h>
-// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
-// on Windows, which is supposed to be POSIX compliant...
-#  define access _access
-#  define mkdir _mkdir
 // Apparently Borland C++ defines DIRECTORY in <direct.h>, which
 // interfers with the Fl_File_Icon enumeration of the same name.
 #  ifdef DIRECTORY
@@ -529,7 +525,7 @@
 
   if (!v) {
     // Add current directory to favorites...
-    if (getenv("HOME")) v = favoritesButton->size() - 5;
+    if (fl_getenv("HOME")) v = favoritesButton->size() - 5;
     else v = favoritesButton->size() - 4;
 
     sprintf(menuname, "favorite%02d", v);
@@ -845,7 +841,7 @@
        compare_dirnames(pathname, directory_)) {
 #endif /* WIN32 || __EMX__ */
       directory(pathname);
-    } else if ((type_ & CREATE) || access(pathname, 0) == 0) {
+    } else if ((type_ & CREATE) || fl_access(pathname, 0) == 0) {
       if (!_fl_filename_isdir_quick(pathname) || (type_ & DIRECTORY)) {
        // Update the preview box...
        update_preview();
@@ -966,7 +962,7 @@
     }
 
     // See if we need to enable the OK button...
-    if (((type_ & CREATE) || !access(fileName->value(), 0)) &&
+    if (((type_ & CREATE) || !fl_access(fileName->value(), 0)) &&
         (!fl_filename_isdir(fileName->value()) || (type_ & DIRECTORY))) {
       okButton->activate();
     } else {
@@ -976,7 +972,7 @@
     // FL_Delete or FL_BackSpace
     fileList->deselect(0);
     fileList->redraw();
-    if (((type_ & CREATE) || !access(fileName->value(), 0)) &&
+    if (((type_ & CREATE) || !fl_access(fileName->value(), 0)) &&
         (!fl_filename_isdir(fileName->value()) || (type_ & DIRECTORY))) {
       okButton->activate();
     } else {
@@ -1060,16 +1056,14 @@
     strlcpy(pathname, dir, sizeof(pathname));
 
   // Create the directory; ignore EEXIST errors...
-#if defined(WIN32) && ! defined (__CYGWIN__)
-  if (mkdir(pathname))
-#else
-  if (mkdir(pathname, 0777))
-#endif /* WIN32 */
+  if (fl_mkdir(pathname, 0777))
     if (errno != EEXIST)
     {
+      if (fl_access(pathname, 0)) {
       fl_alert("%s", strerror(errno));
       return;
     }
+    }
 
   // Show the new directory...
   directory(pathname);
@@ -1256,7 +1250,7 @@
   favoritesButton->add(manage_favorites_label, FL_ALT + 'm', 0, 0, 
FL_MENU_DIVIDER);
   favoritesButton->add(filesystems_label, FL_ALT + 'f', 0);
     
-  if ((home = getenv("HOME")) != NULL) {
+  if ((home = fl_getenv("HOME")) != NULL) {
     quote_pathname(menuname, home, sizeof(menuname));
     favoritesButton->add(menuname, FL_ALT + 'h', 0);
   }
@@ -1316,7 +1310,7 @@
     int                bytes;
     char       *ptr;
 
-    if (filename) fp = fopen(filename, "rb");
+    if (filename) fp = fl_fopen(filename, "rb");
     else fp = NULL;
 
     if (fp != NULL) {
@@ -1359,6 +1353,7 @@
     pbw = previewBox->w() - 20;
     pbh = previewBox->h() - 20;
 
+    if (image->w() < 1 || image->h() < 1) return;
     if (image->w() > pbw || image->h() > pbh) {
       w   = pbw;
       h   = w * image->h() / image->w();
Index: FL/fl_utf8.h
===================================================================
--- FL/fl_utf8.h        (revision 6655)
+++ FL/fl_utf8.h        (working copy)
@@ -213,6 +213,9 @@
 /* OD: Portable UTF8 aware rename wrapper */
 FL_EXPORT int fl_rename(const char* f, const char *t);
 
+/* OD: Portable UTF8 aware chdir wrapper */
+FL_EXPORT int fl_chdir(const char* f);
+
 
 /* OD: Given a full pathname, this will create the directory path needed to 
hold the file named */
 FL_EXPORT void fl_make_path_for_file( const char *path );
Index: test/demo.cxx
===================================================================
--- test/demo.cxx       (revision 6655)
+++ test/demo.cxx       (working copy)
@@ -281,7 +281,7 @@
     char* command = new char[icommand_length+24]; // extraspace for  'open 
../../(name).app &\0' 
     
     sprintf(command, "open ../../../%s.app &", menus[men].icommand[bn]);
-    system(command);
+    fl_system(command);
     
     delete[] command;
 
@@ -291,7 +291,7 @@
     char* command = new char[icommand_length+5]; // 5 for extra './' and ' 
&\0' 
 
     sprintf(command, "./%s &", menus[men].icommand[bn]);
-    system(command);
+    fl_system(command);
 
     delete[] command;
 #endif // WIN32
@@ -308,7 +308,7 @@
   FILE *fin;
   char line[256], mname[64],iname[64],cname[64];
   int i,j;
-  fin = fopen(fname,"r");
+  fin = fl_fopen(fname,"r");
   if (fin == NULL)
   {
 #if defined ( __APPLE__ )
@@ -319,7 +319,7 @@
          pos = strrchr(fname,'/');
          if (!pos) return 0;
          strcpy(pos,"/Resources/demo.menu");
-         fin  = fopen(fname,"r");
+         fin  = fl_fopen(fname,"r");
          if (fin == NULL)
 #endif
          return 0;
@@ -385,7 +385,7 @@
   if (buf!=fname)
     strcpy(buf,fname);
   const char *c = fl_filename_name(buf);
-  if (c > buf) {buf[c-buf] = 0; chdir(buf);}
+  if (c > buf) {buf[c-buf] = 0; fl_chdir(buf);}
   push_menu("@main");
   form->show(argc,argv);
   Fl::run();
Index: test/checkers.cxx
===================================================================
--- test/checkers.cxx   (revision 6655)
+++ test/checkers.cxx   (working copy)
@@ -1347,7 +1347,7 @@
     fprintf(stderr," -t : use VT100 display\n", Fl::help);
     exit(1);
   }
-  if (!getenv("DISPLAY")) terminal = 1;
+  if (!fl_getenv("DISPLAY")) terminal = 1;
   if (!terminal)
 #endif
 #ifdef FLTK
Index: test/fl_jpeg_image.cxx
===================================================================
--- test/fl_jpeg_image.cxx      (revision 6655)
+++ test/fl_jpeg_image.cxx      (working copy)
@@ -138,7 +138,7 @@
 void readtheimage(const char *name) {
   struct jpeg_decompress_struct cinfo;
   struct jpeg_error_mgr jerr;
-  FILE * infile = fopen(name, "rb");
+  FILE * infile = fl_fopen(name, "rb");
   if (!infile) {
     fprintf(stderr, "can't open %s\n", name);
     exit(1);
Index: test/file_chooser.cxx
===================================================================
--- test/file_chooser.cxx       (revision 6655)
+++ test/file_chooser.cxx       (working copy)
@@ -259,7 +259,7 @@
   if (memcmp(header, "%PDF", 4) != 0)
     return 0;
 
-  home = getenv("HOME");
+  home = fl_getenv("HOME");
   sprintf(preview, "%s/.preview.ppm", home ? home : "");
 
   sprintf(command,
@@ -267,7 +267,7 @@
          "-sstdout=\"%%stderr\" -sOUTPUTFILE=\'%s\' "
          "-dFirstPage=1 -dLastPage=1 \'%s\' 2>/dev/null", preview, name);
 
-  if (system(command)) return 0;
+  if (fl_system(command)) return 0;
 
   return new Fl_PNM_Image(preview);
 }
@@ -295,7 +295,7 @@
   if (memcmp(header, "%!", 2) != 0)
     return 0;
 
-  home = getenv("HOME");
+  home = fl_getenv("HOME");
   sprintf(preview, "%s/.preview.ppm", home ? home : "");
 
   if (memcmp(header, "%!PS", 4) == 0) {
@@ -303,8 +303,8 @@
     sprintf(outname, "%s/.preview.ps", home ? home : "");
 
     if (strcmp(name, outname) != 0) {
-      in   = fopen(name, "rb");
-      out  = fopen(outname, "wb");
+      in   = fl_fopen(name, "rb");
+      out  = fl_fopen(outname, "wb");
       page = 0;
 
       while (fgets(line, sizeof(line), in) != NULL) {
@@ -330,7 +330,7 @@
          "-sstdout=\"%%stderr\" -sOUTPUTFILE=\'%s\' \'%s\' 2>/dev/null",
          preview, outname);
 
-  if (system(command)) return 0;
+  if (fl_system(command)) return 0;
 
   return new Fl_PNM_Image(preview);
 }
Index: test/colbrowser.cxx
===================================================================
--- test/colbrowser.cxx (revision 6655)
+++ test/colbrowser.cxx (working copy)
@@ -146,9 +146,9 @@
     int r, g, b,  lr  = -1 , lg = -1, lb = -1;
     char name[256], buf[256];
 #ifdef __EMX__
-    if (!(fp = fopen(__XOS2RedirRoot(fname), "r")))
+    if (!(fp = fl_fopen(__XOS2RedirRoot(fname), "r")))
 #else
-    if (!(fp = fopen(fname, "r")))
+    if (!(fp = fl_fopen(fname, "r")))
 #endif
     {
        fl_alert("%s\n%s\n%s","Load", fname, "Can't open");
Index: fluid/template_panel.cxx
===================================================================
--- fluid/template_panel.cxx    (revision 6655)
+++ fluid/template_panel.cxx    (working copy)
@@ -211,7 +211,7 @@
 if (!fl_choice("Are you sure you want to delete the template \"%s\"?",
                "Cancel", "Delete", 0, name)) return;
 
-if (unlink(flfile)) {
+if (fl_unlink(flfile)) {
   fl_alert("Unable to delete template \"%s\":\n%s", name, strerror(errno));
   return;
 }
Index: fluid/undo.cxx
===================================================================
--- fluid/undo.cxx      (revision 6655)
+++ fluid/undo.cxx      (working copy)
@@ -34,11 +34,6 @@
 #  include <io.h>
 #  include <windows.h>
 #  define getpid (int)GetCurrentProcessId
-#  ifndef __WATCOMC__
-// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
-// on Windows, which is supposed to be POSIX compliant...
-#    define unlink _unlink
-#  endif // !__WATCOMC__
 #else
 #  include <unistd.h>
 #endif // WIN32 && !__CYGWIN__
@@ -167,7 +162,7 @@
 
   // Remove old checkpoint files...
   for (int i = 0; i <= undo_max; i ++) {
-    unlink(undo_filename(i, filename, sizeof(filename)));
+    fl_unlink(undo_filename(i, filename, sizeof(filename)));
   }
 
   // Reset current, last, and save indices...
Index: fluid/file.cxx
===================================================================
--- fluid/file.cxx      (revision 6655)
+++ fluid/file.cxx      (working copy)
@@ -43,7 +43,7 @@
 
 int open_write(const char *s) {
   if (!s) {fout = stdout; return 1;}
-  FILE *f = fopen(s,"w");
+  FILE *f = fl_fopen(s,"w");
   if (!f) return 0;
   fout = f;
   return 1;
@@ -135,7 +135,7 @@
 int open_read(const char *s) {
   lineno = 1;
   if (!s) {fin = stdin; fname = "stdin"; return 1;}
-  FILE *f = fopen(s,"r");
+  FILE *f = fl_fopen(s,"r");
   if (!f) return 0;
   fin = f;
   fname = s;
Index: fluid/template_panel.fl
===================================================================
--- fluid/template_panel.fl     (revision 6655)
+++ fluid/template_panel.fl     (working copy)
@@ -193,7 +193,7 @@
 if (!fl_choice("Are you sure you want to delete the template \\"%s\\"?",
                "Cancel", "Delete", 0, name)) return;
 
-if (unlink(flfile)) {
+if (fl_unlink(flfile)) {
   fl_alert("Unable to delete template \\"%s\\":\\n%s", name, strerror(errno));
   return;
 }
Index: fluid/fluid.cxx
===================================================================
--- fluid/fluid.cxx     (revision 6655)
+++ fluid/fluid.cxx     (working copy)
@@ -60,13 +60,6 @@
 #  include <fcntl.h>
 #  include <commdlg.h>
 #  include <FL/x.H>
-#  ifndef __WATCOMC__
-// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
-// on Windows, which is supposed to be POSIX compliant...
-#    define access _access
-#    define chdir _chdir
-#    define getcwd _getcwd
-#  endif // !__WATCOMC__
 #else
 #  include <unistd.h>
 #endif
@@ -128,17 +121,17 @@
   strlcpy(buffer, filename, sizeof(buffer));
   int n = p-filename; if (n>1) n--; buffer[n] = 0;
   if (!pwd) {
-    pwd = getcwd(0,1024);
+    pwd = fl_getcwd(0,1024);
     if (!pwd) {fprintf(stderr,"getwd : %s\n",strerror(errno)); return;}
   }
-  if (chdir(buffer)<0) {fprintf(stderr, "Can't chdir to %s : %s\n",
+  if (fl_chdir(buffer)<0) {fprintf(stderr, "Can't chdir to %s : %s\n",
                                buffer, strerror(errno)); return;}
   in_source_dir = 1;
 }
 
 void leave_source_dir() {
   if (!in_source_dir) return;
-  if (chdir(pwd)<0) {fprintf(stderr, "Can't chdir to %s : %s\n",
+  if (fl_chdir(pwd)<0) {fprintf(stderr, "Can't chdir to %s : %s\n",
                             pwd, strerror(errno));}
   in_source_dir = 0;
 }
@@ -195,7 +188,7 @@
     fl_file_chooser_ok_label(NULL);
     if (!c) return;
 
-    if (!access(c, 0)) {
+    if (!fl_access(c, 0)) {
       const char *basename;
       if ((basename = strrchr(c, '/')) != NULL)
         basename ++;
@@ -265,11 +258,7 @@
   fluid_prefs.getUserdataPath(filename, sizeof(filename));
 
   strlcat(filename, "templates", sizeof(filename));
-#if defined(WIN32) && !defined(__CYGWIN__)
-  if (access(filename, 0)) mkdir(filename);
-#else
-  if (access(filename, 0)) mkdir(filename, 0777);
-#endif // WIN32 && !__CYGWIN__
+  if (fl_access(filename, 0)) fl_mkdir(filename, 0777);
 
   strlcat(filename, "/", sizeof(filename));
   strlcat(filename, safename, sizeof(filename));
@@ -283,7 +272,7 @@
   // Save the .fl file...
   strcpy(ext, ".fl");
 
-  if (!access(filename, 0)) {
+  if (!fl_access(filename, 0)) {
     if (fl_choice("The template \"%s\" already exists.\n"
                   "Do you want to replace it?", "Cancel",
                  "Replace", NULL, c) == 0) return;
@@ -317,7 +306,7 @@
 
   FILE *fp;
 
-  if ((fp = fopen(filename, "wb")) == NULL) {
+  if ((fp = fl_fopen(filename, "wb")) == NULL) {
     delete[] pixels;
     fl_alert("Error writing %s: %s", filename, strerror(errno));
     return;
@@ -586,7 +575,7 @@
       char line[1024], *ptr, *next;
       FILE *infile, *outfile;
 
-      if ((infile = fopen(tname, "r")) == NULL) {
+      if ((infile = fl_fopen(tname, "r")) == NULL) {
        fl_alert("Error reading template file \"%s\":\n%s", tname,
                 strerror(errno));
        set_modflag(0);
@@ -594,7 +583,7 @@
        return;
       }
 
-      if ((outfile = fopen(cutfname(1), "w")) == NULL) {
+      if ((outfile = fl_fopen(cutfname(1), "w")) == NULL) {
        fl_alert("Error writing buffer file \"%s\":\n%s", cutfname(1),
                 strerror(errno));
        fclose(infile);
@@ -618,7 +607,7 @@
 
       undo_suspend();
       read_file(cutfname(1), 0);
-      unlink(cutfname(1));
+      fl_unlink(cutfname(1));
       undo_resume();
     } else {
       // No instance name, so read the template without replacements...
@@ -808,7 +797,7 @@
   if (!read_file(cutfname(1), 1)) {
     fl_message("Can't read %s: %s", cutfname(1), strerror(errno));
   }
-  unlink(cutfname(1));
+  fl_unlink(cutfname(1));
   undo_resume();
 
   force_parent = 0;
@@ -842,7 +831,7 @@
 
   if (!help_dialog) help_dialog = new Fl_Help_Dialog();
 
-  if ((docdir = getenv("FLTK_DOCDIR")) == NULL) {
+  if ((docdir = fl_getenv("FLTK_DOCDIR")) == NULL) {
 #ifdef __EMX__
     // Doesn't make sense to have a hardcoded fallback
     static char fltk_docdir[1024];
@@ -1228,13 +1217,13 @@
     const char *outname = fl_file_chooser("Print To", "PostScript (*.ps)", 
NULL, 1);
     fl_file_chooser_ok_label(NULL);
 
-    if (outname && !access(outname, 0)) {
+    if (outname && !fl_access(outname, 0)) {
       if (fl_choice("The file \"%s\" already exists.\n"
                     "Do you want to replace it?", "Cancel",
                    "Replace", NULL, outname) == 0) outname = NULL;
     }
 
-    if (outname) outfile = fopen(outname, "w");
+    if (outname) outfile = fl_fopen(outname, "w");
     else outfile = NULL;
   }
 
@@ -2055,7 +2044,7 @@
 
   if (!prepare_shell_command(command)) return;
 
-  if ((status = system(command)) != 0) {
+  if ((status = fl_system(command)) != 0) {
     fl_alert("Shell command returned status %d!", status);
   } else if (completion_button->value()) {
     fl_message("Shell command completed successfully!");
Index: fluid/Fluid_Image.cxx
===================================================================
--- fluid/Fluid_Image.cxx       (revision 6655)
+++ fluid/Fluid_Image.cxx       (working copy)
@@ -148,7 +148,7 @@
   // no, so now see if the file exists:
 
   goto_source_dir();
-  FILE *f = fopen(iname,"rb");
+  FILE *f = fl_fopen(iname,"rb");
   if (!f) {
     read_error("%s : %s",iname,strerror(errno));
     leave_source_dir();
Index: fluid/code.cxx
===================================================================
--- fluid/code.cxx      (revision 6655)
+++ fluid/code.cxx      (working copy)
@@ -180,7 +180,7 @@
     case '\'':
     case '\\':
     QUOTED:
-      if (linelength >= 77) {fputs("\\\n",code_file); linelength = 0;}
+      if (linelength >= 77) {fputs("\"\n\"",code_file); linelength = 0;}
       putc('\\', code_file);
       putc(c, code_file);
       linelength += 2;
@@ -191,7 +191,7 @@
     default:
       if (c >= ' ' && c < 127) {
        // a legal ASCII character
-       if (linelength >= 78) {fputs("\\\n",code_file); linelength = 0;}
+       if (linelength >= 78) {fputs("\"\n\"",code_file); linelength = 0;}
        putc(c, code_file);
        linelength++;
        break;
@@ -199,15 +199,15 @@
       // otherwise we must print it as an octal constant:
       c &= 255;
       if (c < 8) {
-       if (linelength >= 76) {fputs("\\\n",code_file); linelength = 0;}
+       if (linelength >= 76) {fputs("\"\n\"",code_file); linelength = 0;}
        fprintf(code_file, "\\%o",c);
        linelength += 2;
       } else if (c < 64) {
-       if (linelength >= 75) {fputs("\\\n",code_file); linelength = 0;}
+       if (linelength >= 75) {fputs("\"\n\"",code_file); linelength = 0;}
        fprintf(code_file, "\\%o",c);
        linelength += 3;
       } else {
-       if (linelength >= 74) {fputs("\\\n",code_file); linelength = 0;}
+       if (linelength >= 74) {fputs("\"\n\"",code_file); linelength = 0;}
        fprintf(code_file, "\\%o",c);
        linelength += 4;
       }
@@ -343,13 +343,13 @@
   current_widget_class = 0L;
   if (!s) code_file = stdout;
   else {
-    FILE *f = fopen(s, filemode);
+    FILE *f = fl_fopen(s, filemode);
     if (!f) return 0;
     code_file = f;
   }
   if (!t) header_file = stdout;
   else {
-    FILE *f = fopen(t, filemode);
+    FILE *f = fl_fopen(t, filemode);
     if (!f) {fclose(code_file); return 0;}
     header_file = f;
   }
@@ -457,7 +457,7 @@
 }
 
 int write_strings(const char *sfile) {
-  FILE *fp = fopen(sfile, "w");
+  FILE *fp = fl_fopen(sfile, "w");
   Fl_Type *p;
   Fl_Widget_Type *w;
   int i;
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to