David Rogers  committed a9a858b

Bug 525: Use intptr_t instead of long for _findnext and the emulation functions to resolve truncation on 64 bit systems.

  • Participants
  • Parent commits e4da798
  • Branches v1-8

Comments (0)

Files changed (3)

File OgreMain/include/OgreSearchOps.h

 #define _A_SUBDIR 0x10  /* Subdirectory */
 long _findfirst(const char *pattern, struct _finddata_t *data);
-int _findnext(long id, struct _finddata_t *data);
-int _findclose(long id);
+int _findnext(intptr_t id, struct _finddata_t *data);
+int _findclose(intptr_t id);

File OgreMain/src/OgreFileSystem.cpp

     void FileSystemArchive::findFiles(const String& pattern, bool recursive, 
         bool dirs, StringVector* simpleList, FileInfoList* detailList) const
-        long lHandle, res;
+        intptr_t lHandle, res;
         struct _finddata_t tagData;
         // pattern can contain a directory name, separate it from mask

File OgreMain/src/OgreSearchOps.cpp

     DIR *dirfd;
-long _findfirst(const char *pattern, struct _finddata_t *data)
+intptr_t _findfirst(const char *pattern, struct _finddata_t *data)
     _find_search_t *fs = new _find_search_t;
     fs->curfn = NULL;
     fs->dirfd = opendir (fs->directory);
     if (!fs->dirfd)
-        _findclose ((long)fs);
+        _findclose ((intptr_t)fs);
         return -1;
     fs->pattern = strdup (mask);
     /* Get the first entry */
-    if (_findnext ((long)fs, data) < 0)
+    if (_findnext ((intptr_t)fs, data) < 0)
-        _findclose ((long)fs);
+        _findclose ((intptr_t)fs);
         return -1;
-    return (long)fs;
+    return (intptr_t)fs;
-int _findnext(long id, struct _finddata_t *data)
+int _findnext(intptr_t id, struct _finddata_t *data)
     _find_search_t *fs = (_find_search_t *)id;
     return 0;
-int _findclose(long id)
+int _findclose(intptr_t id)
     int ret;
     _find_search_t *fs = (_find_search_t *)id;