Fossil SCM
Upgrade dirent to latest version (1.23.2, May 8, 2018)
Commit
1eee6c70aa90b9939aee6baa738dd4c2de016ce6214327006c46fb063442477e
Parent
592c6725195e11f…
1 file changed
+12
-11
+12
-11
| --- win/include/dirent.h | ||
| +++ win/include/dirent.h | ||
| @@ -297,11 +297,11 @@ | ||
| 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 | |
| @@ -365,11 +365,11 @@ | ||
| 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); |
| @@ -383,11 +383,11 @@ | ||
| 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); |
| @@ -450,11 +450,11 @@ | ||
| 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) |
| @@ -641,11 +641,11 @@ | ||
| 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 | |
| @@ -740,11 +740,11 @@ | ||
| 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, |
| @@ -802,11 +802,11 @@ | ||
| 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'; |
| @@ -875,11 +875,11 @@ | ||
| 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; |
| @@ -935,11 +935,11 @@ | ||
| 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) { |
| @@ -963,11 +963,12 @@ | ||
| 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 { |
| @@ -1058,11 +1059,11 @@ | ||
| 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 |
| --- win/include/dirent.h | |
| +++ win/include/dirent.h | |
| @@ -297,11 +297,11 @@ | |
| 297 | static void rewinddir (DIR* dirp); |
| 298 | static void _wrewinddir (_WDIR* dirp); |
| 299 | |
| 300 | static int scandir (const char *dirname, struct dirent ***namelist, |
| 301 | int (*filter)(const struct dirent*), |
| 302 | int (*compare)(const void *, const void *)); |
| 303 | |
| 304 | static int alphasort (const struct dirent **a, const struct dirent **b); |
| 305 | |
| 306 | static int versionsort (const struct dirent **a, const struct dirent **b); |
| 307 | |
| @@ -365,11 +365,11 @@ | |
| 365 | dirp->cached = 0; |
| 366 | |
| 367 | /* Compute the length of full path plus zero terminator |
| 368 | * |
| 369 | * Note that on WinRT there's no way to convert relative paths |
| 370 | * into absolute paths, so just assume its an absolute path. |
| 371 | */ |
| 372 | # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) |
| 373 | n = wcslen(dirname); |
| 374 | # else |
| 375 | n = GetFullPathNameW (dirname, 0, NULL, NULL); |
| @@ -383,11 +383,11 @@ | |
| 383 | * Convert relative directory name to an absolute one. This |
| 384 | * allows rewinddir() to function correctly even when current |
| 385 | * working directory is changed between opendir() and rewinddir(). |
| 386 | * |
| 387 | * Note that on WinRT there's no way to convert relative paths |
| 388 | * into absolute paths, so just assume its an absolute path. |
| 389 | */ |
| 390 | # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) |
| 391 | wcsncpy_s(dirp->patt, n+1, dirname, n); |
| 392 | # else |
| 393 | n = GetFullPathNameW (dirname, n, dirp->patt, NULL); |
| @@ -450,11 +450,11 @@ | |
| 450 | } |
| 451 | |
| 452 | /* |
| 453 | * Read next directory entry. |
| 454 | * |
| 455 | * Returns pointer to static directory entry which may be overwritted by |
| 456 | * subsequent calls to _wreaddir(). |
| 457 | */ |
| 458 | static struct _wdirent* |
| 459 | _wreaddir( |
| 460 | _WDIR *dirp) |
| @@ -641,11 +641,11 @@ | |
| 641 | /* Get the next directory entry from stream */ |
| 642 | if (FindNextFileW (dirp->handle, &dirp->data) != FALSE) { |
| 643 | /* Got a file */ |
| 644 | p = &dirp->data; |
| 645 | } else { |
| 646 | /* The very last entry has been processed or an error occured */ |
| 647 | FindClose (dirp->handle); |
| 648 | dirp->handle = INVALID_HANDLE_VALUE; |
| 649 | p = NULL; |
| 650 | } |
| 651 | |
| @@ -740,11 +740,11 @@ | |
| 740 | } |
| 741 | |
| 742 | /* |
| 743 | * Read next directory entry into called-allocated buffer. |
| 744 | * |
| 745 | * Returns zero on sucess. If the end of directory stream is reached, then |
| 746 | * sets result to NULL and returns zero. |
| 747 | */ |
| 748 | static int |
| 749 | readdir_r( |
| 750 | DIR *dirp, |
| @@ -802,11 +802,11 @@ | |
| 802 | |
| 803 | } else { |
| 804 | |
| 805 | /* |
| 806 | * Cannot convert file name to multi-byte string so construct |
| 807 | * an errornous directory entry and return that. Note that |
| 808 | * we cannot return NULL as that would stop the processing |
| 809 | * of directory entries completely. |
| 810 | */ |
| 811 | entry->d_name[0] = '?'; |
| 812 | entry->d_name[1] = '\0'; |
| @@ -875,11 +875,11 @@ | |
| 875 | static int |
| 876 | scandir( |
| 877 | const char *dirname, |
| 878 | struct dirent ***namelist, |
| 879 | int (*filter)(const struct dirent*), |
| 880 | int (*compare)(const void*, const void*)) |
| 881 | { |
| 882 | struct dirent **files = NULL; |
| 883 | size_t size = 0; |
| 884 | size_t allocated = 0; |
| 885 | const size_t init_size = 1; |
| @@ -935,11 +935,11 @@ | |
| 935 | } |
| 936 | |
| 937 | /* Read directory entry to temporary area */ |
| 938 | if (readdir_r (dir, tmp, &entry) == /*OK*/0) { |
| 939 | |
| 940 | /* Did we got an entry? */ |
| 941 | if (entry != NULL) { |
| 942 | int pass; |
| 943 | |
| 944 | /* Determine whether to include the entry in result */ |
| 945 | if (filter) { |
| @@ -963,11 +963,12 @@ | |
| 963 | |
| 964 | /* |
| 965 | * End of directory stream reached => sort entries and |
| 966 | * exit. |
| 967 | */ |
| 968 | qsort (files, size, sizeof (void*), compare); |
| 969 | break; |
| 970 | |
| 971 | } |
| 972 | |
| 973 | } else { |
| @@ -1058,11 +1059,11 @@ | |
| 1058 | n = sizeInWords - 1; |
| 1059 | } |
| 1060 | wcstr[n] = 0; |
| 1061 | } |
| 1062 | |
| 1063 | /* Length of resuting multi-byte string WITH zero terminator */ |
| 1064 | if (pReturnValue) { |
| 1065 | *pReturnValue = n + 1; |
| 1066 | } |
| 1067 | |
| 1068 | /* Success */ |
| 1069 |
| --- win/include/dirent.h | |
| +++ win/include/dirent.h | |
| @@ -297,11 +297,11 @@ | |
| 297 | static void rewinddir (DIR* dirp); |
| 298 | static void _wrewinddir (_WDIR* dirp); |
| 299 | |
| 300 | static int scandir (const char *dirname, struct dirent ***namelist, |
| 301 | int (*filter)(const struct dirent*), |
| 302 | int (*compare)(const struct dirent**, const struct dirent**)); |
| 303 | |
| 304 | static int alphasort (const struct dirent **a, const struct dirent **b); |
| 305 | |
| 306 | static int versionsort (const struct dirent **a, const struct dirent **b); |
| 307 | |
| @@ -365,11 +365,11 @@ | |
| 365 | dirp->cached = 0; |
| 366 | |
| 367 | /* Compute the length of full path plus zero terminator |
| 368 | * |
| 369 | * Note that on WinRT there's no way to convert relative paths |
| 370 | * into absolute paths, so just assume it is an absolute path. |
| 371 | */ |
| 372 | # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) |
| 373 | n = wcslen(dirname); |
| 374 | # else |
| 375 | n = GetFullPathNameW (dirname, 0, NULL, NULL); |
| @@ -383,11 +383,11 @@ | |
| 383 | * Convert relative directory name to an absolute one. This |
| 384 | * allows rewinddir() to function correctly even when current |
| 385 | * working directory is changed between opendir() and rewinddir(). |
| 386 | * |
| 387 | * Note that on WinRT there's no way to convert relative paths |
| 388 | * into absolute paths, so just assume it is an absolute path. |
| 389 | */ |
| 390 | # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) |
| 391 | wcsncpy_s(dirp->patt, n+1, dirname, n); |
| 392 | # else |
| 393 | n = GetFullPathNameW (dirname, n, dirp->patt, NULL); |
| @@ -450,11 +450,11 @@ | |
| 450 | } |
| 451 | |
| 452 | /* |
| 453 | * Read next directory entry. |
| 454 | * |
| 455 | * Returns pointer to static directory entry which may be overwritten by |
| 456 | * subsequent calls to _wreaddir(). |
| 457 | */ |
| 458 | static struct _wdirent* |
| 459 | _wreaddir( |
| 460 | _WDIR *dirp) |
| @@ -641,11 +641,11 @@ | |
| 641 | /* Get the next directory entry from stream */ |
| 642 | if (FindNextFileW (dirp->handle, &dirp->data) != FALSE) { |
| 643 | /* Got a file */ |
| 644 | p = &dirp->data; |
| 645 | } else { |
| 646 | /* The very last entry has been processed or an error occurred */ |
| 647 | FindClose (dirp->handle); |
| 648 | dirp->handle = INVALID_HANDLE_VALUE; |
| 649 | p = NULL; |
| 650 | } |
| 651 | |
| @@ -740,11 +740,11 @@ | |
| 740 | } |
| 741 | |
| 742 | /* |
| 743 | * Read next directory entry into called-allocated buffer. |
| 744 | * |
| 745 | * Returns zero on success. If the end of directory stream is reached, then |
| 746 | * sets result to NULL and returns zero. |
| 747 | */ |
| 748 | static int |
| 749 | readdir_r( |
| 750 | DIR *dirp, |
| @@ -802,11 +802,11 @@ | |
| 802 | |
| 803 | } else { |
| 804 | |
| 805 | /* |
| 806 | * Cannot convert file name to multi-byte string so construct |
| 807 | * an erroneous directory entry and return that. Note that |
| 808 | * we cannot return NULL as that would stop the processing |
| 809 | * of directory entries completely. |
| 810 | */ |
| 811 | entry->d_name[0] = '?'; |
| 812 | entry->d_name[1] = '\0'; |
| @@ -875,11 +875,11 @@ | |
| 875 | static int |
| 876 | scandir( |
| 877 | const char *dirname, |
| 878 | struct dirent ***namelist, |
| 879 | int (*filter)(const struct dirent*), |
| 880 | int (*compare)(const struct dirent**, const struct dirent**)) |
| 881 | { |
| 882 | struct dirent **files = NULL; |
| 883 | size_t size = 0; |
| 884 | size_t allocated = 0; |
| 885 | const size_t init_size = 1; |
| @@ -935,11 +935,11 @@ | |
| 935 | } |
| 936 | |
| 937 | /* Read directory entry to temporary area */ |
| 938 | if (readdir_r (dir, tmp, &entry) == /*OK*/0) { |
| 939 | |
| 940 | /* Did we get an entry? */ |
| 941 | if (entry != NULL) { |
| 942 | int pass; |
| 943 | |
| 944 | /* Determine whether to include the entry in result */ |
| 945 | if (filter) { |
| @@ -963,11 +963,12 @@ | |
| 963 | |
| 964 | /* |
| 965 | * End of directory stream reached => sort entries and |
| 966 | * exit. |
| 967 | */ |
| 968 | qsort (files, size, sizeof (void*), |
| 969 | (int (*) (const void*, const void*)) compare); |
| 970 | break; |
| 971 | |
| 972 | } |
| 973 | |
| 974 | } else { |
| @@ -1058,11 +1059,11 @@ | |
| 1059 | n = sizeInWords - 1; |
| 1060 | } |
| 1061 | wcstr[n] = 0; |
| 1062 | } |
| 1063 | |
| 1064 | /* Length of resulting multi-byte string WITH zero terminator */ |
| 1065 | if (pReturnValue) { |
| 1066 | *pReturnValue = n + 1; |
| 1067 | } |
| 1068 | |
| 1069 | /* Success */ |
| 1070 |