Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Upgrade dirent to latest version (1.23.2, May 8, 2018) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
1eee6c70aa90b9939aee6baa738dd4c2 |
User & Date: | jan.nijtmans 2018-06-08 09:41:20 |
Context
2018-06-09
| ||
16:37 | Update secondary mention of SQLite compression ratio to match table check-in: b46141f4 user: andygoth tags: trunk | |
2018-06-08
| ||
09:41 | Upgrade dirent to latest version (1.23.2, May 8, 2018) check-in: 1eee6c70 user: jan.nijtmans tags: trunk | |
09:40 | Take over some latest bug-fixes (one security-related) from SQLite trunk's command-line shell check-in: 592c6725 user: jan.nijtmans tags: trunk | |
Changes
Changes to win/include/dirent.h.
295 295 static int _wclosedir (_WDIR *dirp); 296 296 297 297 static void rewinddir (DIR* dirp); 298 298 static void _wrewinddir (_WDIR* dirp); 299 299 300 300 static int scandir (const char *dirname, struct dirent ***namelist, 301 301 int (*filter)(const struct dirent*), 302 - int (*compare)(const void *, const void *)); 302 + int (*compare)(const struct dirent**, const struct dirent**)); 303 303 304 304 static int alphasort (const struct dirent **a, const struct dirent **b); 305 305 306 306 static int versionsort (const struct dirent **a, const struct dirent **b); 307 307 308 308 309 309 /* For compatibility with Symbian */ ................................................................................ 363 363 dirp->handle = INVALID_HANDLE_VALUE; 364 364 dirp->patt = NULL; 365 365 dirp->cached = 0; 366 366 367 367 /* Compute the length of full path plus zero terminator 368 368 * 369 369 * Note that on WinRT there's no way to convert relative paths 370 - * into absolute paths, so just assume its an absolute path. 370 + * into absolute paths, so just assume it is an absolute path. 371 371 */ 372 372 # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) 373 373 n = wcslen(dirname); 374 374 # else 375 375 n = GetFullPathNameW (dirname, 0, NULL, NULL); 376 376 # endif 377 377 ................................................................................ 381 381 382 382 /* 383 383 * Convert relative directory name to an absolute one. This 384 384 * allows rewinddir() to function correctly even when current 385 385 * working directory is changed between opendir() and rewinddir(). 386 386 * 387 387 * Note that on WinRT there's no way to convert relative paths 388 - * into absolute paths, so just assume its an absolute path. 388 + * into absolute paths, so just assume it is an absolute path. 389 389 */ 390 390 # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) 391 391 wcsncpy_s(dirp->patt, n+1, dirname, n); 392 392 # else 393 393 n = GetFullPathNameW (dirname, n, dirp->patt, NULL); 394 394 # endif 395 395 if (n > 0) { ................................................................................ 448 448 449 449 return dirp; 450 450 } 451 451 452 452 /* 453 453 * Read next directory entry. 454 454 * 455 - * Returns pointer to static directory entry which may be overwritted by 455 + * Returns pointer to static directory entry which may be overwritten by 456 456 * subsequent calls to _wreaddir(). 457 457 */ 458 458 static struct _wdirent* 459 459 _wreaddir( 460 460 _WDIR *dirp) 461 461 { 462 462 struct _wdirent *entry; ................................................................................ 639 639 } else if (dirp->handle != INVALID_HANDLE_VALUE) { 640 640 641 641 /* Get the next directory entry from stream */ 642 642 if (FindNextFileW (dirp->handle, &dirp->data) != FALSE) { 643 643 /* Got a file */ 644 644 p = &dirp->data; 645 645 } else { 646 - /* The very last entry has been processed or an error occured */ 646 + /* The very last entry has been processed or an error occurred */ 647 647 FindClose (dirp->handle); 648 648 dirp->handle = INVALID_HANDLE_VALUE; 649 649 p = NULL; 650 650 } 651 651 652 652 } else { 653 653 ................................................................................ 738 738 /* Return pointer to statically allocated directory entry */ 739 739 return entry; 740 740 } 741 741 742 742 /* 743 743 * Read next directory entry into called-allocated buffer. 744 744 * 745 - * Returns zero on sucess. If the end of directory stream is reached, then 745 + * Returns zero on success. If the end of directory stream is reached, then 746 746 * sets result to NULL and returns zero. 747 747 */ 748 748 static int 749 749 readdir_r( 750 750 DIR *dirp, 751 751 struct dirent *entry, 752 752 struct dirent **result) ................................................................................ 800 800 entry->d_off = 0; 801 801 entry->d_reclen = sizeof (struct dirent); 802 802 803 803 } else { 804 804 805 805 /* 806 806 * Cannot convert file name to multi-byte string so construct 807 - * an errornous directory entry and return that. Note that 807 + * an erroneous directory entry and return that. Note that 808 808 * we cannot return NULL as that would stop the processing 809 809 * of directory entries completely. 810 810 */ 811 811 entry->d_name[0] = '?'; 812 812 entry->d_name[1] = '\0'; 813 813 entry->d_namlen = 1; 814 814 entry->d_type = DT_UNKNOWN; ................................................................................ 873 873 * Scan directory for entries. 874 874 */ 875 875 static int 876 876 scandir( 877 877 const char *dirname, 878 878 struct dirent ***namelist, 879 879 int (*filter)(const struct dirent*), 880 - int (*compare)(const void*, const void*)) 880 + int (*compare)(const struct dirent**, const struct dirent**)) 881 881 { 882 882 struct dirent **files = NULL; 883 883 size_t size = 0; 884 884 size_t allocated = 0; 885 885 const size_t init_size = 1; 886 886 DIR *dir = NULL; 887 887 struct dirent *entry; ................................................................................ 933 933 break; 934 934 } 935 935 } 936 936 937 937 /* Read directory entry to temporary area */ 938 938 if (readdir_r (dir, tmp, &entry) == /*OK*/0) { 939 939 940 - /* Did we got an entry? */ 940 + /* Did we get an entry? */ 941 941 if (entry != NULL) { 942 942 int pass; 943 943 944 944 /* Determine whether to include the entry in result */ 945 945 if (filter) { 946 946 /* Let the filter function decide */ 947 947 pass = filter (tmp); ................................................................................ 961 961 962 962 } else { 963 963 964 964 /* 965 965 * End of directory stream reached => sort entries and 966 966 * exit. 967 967 */ 968 - qsort (files, size, sizeof (void*), compare); 968 + qsort (files, size, sizeof (void*), 969 + (int (*) (const void*, const void*)) compare); 969 970 break; 970 971 971 972 } 972 973 973 974 } else { 974 975 /* Error reading directory entry */ 975 976 result = /*Error*/ -1; ................................................................................ 1056 1057 if (wcstr && sizeInWords) { 1057 1058 if (n >= sizeInWords) { 1058 1059 n = sizeInWords - 1; 1059 1060 } 1060 1061 wcstr[n] = 0; 1061 1062 } 1062 1063 1063 - /* Length of resuting multi-byte string WITH zero terminator */ 1064 + /* Length of resulting multi-byte string WITH zero terminator */ 1064 1065 if (pReturnValue) { 1065 1066 *pReturnValue = n + 1; 1066 1067 } 1067 1068 1068 1069 /* Success */ 1069 1070 error = 0; 1070 1071