Changeset 13601
- Timestamp:
- 01/26/08 11:25:51 (4 months ago)
- Files:
-
- branches/1.5/gdal/port/cpl_vsil_unix_stdio_64.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.5/gdal/port/cpl_vsil_unix_stdio_64.cpp
r11304 r13601 287 287 if ( (hDir = opendir(pszPath)) != NULL ) 288 288 { 289 /* In case of really big number of files in the directory, CSLAddString */ 290 /* can be slow (see #2158). We then directly build the list. */ 291 int nItems=0; 292 int nAllocatedItems=0; 289 293 while( (psDirEntry = readdir(hDir)) != NULL ) 290 294 { 291 papszDir = CSLAddString(papszDir, psDirEntry->d_name); 295 if (nItems == 0) 296 { 297 papszDir = (char**) CPLCalloc(2,sizeof(char*)); 298 nAllocatedItems = 1; 299 } 300 else if (nItems >= nAllocatedItems) 301 { 302 nAllocatedItems = nAllocatedItems * 2; 303 papszDir = (char**)CPLRealloc(papszDir, 304 (nAllocatedItems+2)*sizeof(char*)); 305 } 306 307 papszDir[nItems] = CPLStrdup(psDirEntry->d_name); 308 papszDir[nItems+1] = NULL; 309 310 nItems++; 292 311 } 293 312
