]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
ICC: support 64-bit environments dirent definitions
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 18 Apr 2011 11:50:50 +0000 (05:50 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 18 Apr 2011 11:50:50 +0000 (05:50 -0600)
struct dirent is not consistently defined for 32-bit and 64-bit enabled
environments. Provide a dirent_t type defined appropriate to the environment
for use instead.

compat/compat_shared.h
src/fs/ufs/store_dir_ufs.cc
src/fs/ufs/ufscommon.h

index 19ef83aaf400c3f7043900109fdb5a3dd0f6be18..556537b59d6539542ba01c402329aea22b10c451 100644 (file)
@@ -30,8 +30,7 @@
 
 /*
  * DIRENT functionality can apparently come from many places.
- * I believe these should really be done by OS-specific compat
- * files, but for now its left here.
+ * With various complaints by different compilers
  */
 #if HAVE_DIRENT_H
 #include <dirent.h>
 #endif /* HAVE_NDIR_H */
 #endif /* HAVE_DIRENT_H */
 
+/* The structure dirent also varies between 64-bit and 32-bit environments.
+ * Define our own dirent_t type for consistent simple internal use.
+ * NP: GCC seems not to care about the type naming differences.
+ */
+#if defined(__USE_FILE_OFFSET64) && !defined(__GNUC__)
+#define dirent_t struct dirent64
+#else
+#define dirent_t struct dirent
+#endif
 
 /*
  * Filedescriptor limits in the different select loops
index 99019ca477403490caa24fb254935487bb5d8ed8..092b2f552e02827370bbe1c3e79d77512c29ad5a 100644 (file)
@@ -1063,7 +1063,6 @@ UFSSwapDir::DirClean(int swap_index)
 {
     DIR *dir_pointer = NULL;
 
-    struct dirent *de = NULL;
     LOCAL_ARRAY(char, p1, MAXPATHLEN + 1);
     LOCAL_ARRAY(char, p2, MAXPATHLEN + 1);
 
@@ -1107,6 +1106,7 @@ UFSSwapDir::DirClean(int swap_index)
         return 0;
     }
 
+    dirent_t *de;
     while ((de = readdir(dir_pointer)) != NULL && k < 20) {
         if (sscanf(de->d_name, "%X", &swapfileno) != 1)
             continue;
index 815e3b2d641402220bf88a49f7abbd995089368c..cf701880e736a2c4612b8f5a1bf972fff3744ecb 100644 (file)
@@ -399,7 +399,7 @@ public:
     int done;
     int fn;
 
-    struct dirent *entry;
+    dirent_t *entry;
     DIR *td;
     char fullpath[SQUID_MAXPATHLEN];
     char fullfilename[SQUID_MAXPATHLEN];