Fossil SCM

Upgrade dirent to latest version (1.23.2, May 8, 2018)

jan.nijtmans 2018-06-08 09:41 trunk
Commit 1eee6c70aa90b9939aee6baa738dd4c2de016ce6214327006c46fb063442477e
1 file changed +12 -11
--- win/include/dirent.h
+++ win/include/dirent.h
@@ -297,11 +297,11 @@
297297
static void rewinddir (DIR* dirp);
298298
static void _wrewinddir (_WDIR* dirp);
299299
300300
static int scandir (const char *dirname, struct dirent ***namelist,
301301
int (*filter)(const struct dirent*),
302
- int (*compare)(const void *, const void *));
302
+ int (*compare)(const struct dirent**, const struct dirent**));
303303
304304
static int alphasort (const struct dirent **a, const struct dirent **b);
305305
306306
static int versionsort (const struct dirent **a, const struct dirent **b);
307307
@@ -365,11 +365,11 @@
365365
dirp->cached = 0;
366366
367367
/* Compute the length of full path plus zero terminator
368368
*
369369
* 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.
371371
*/
372372
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
373373
n = wcslen(dirname);
374374
# else
375375
n = GetFullPathNameW (dirname, 0, NULL, NULL);
@@ -383,11 +383,11 @@
383383
* Convert relative directory name to an absolute one. This
384384
* allows rewinddir() to function correctly even when current
385385
* working directory is changed between opendir() and rewinddir().
386386
*
387387
* 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.
389389
*/
390390
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
391391
wcsncpy_s(dirp->patt, n+1, dirname, n);
392392
# else
393393
n = GetFullPathNameW (dirname, n, dirp->patt, NULL);
@@ -450,11 +450,11 @@
450450
}
451451
452452
/*
453453
* Read next directory entry.
454454
*
455
- * Returns pointer to static directory entry which may be overwritted by
455
+ * Returns pointer to static directory entry which may be overwritten by
456456
* subsequent calls to _wreaddir().
457457
*/
458458
static struct _wdirent*
459459
_wreaddir(
460460
_WDIR *dirp)
@@ -641,11 +641,11 @@
641641
/* Get the next directory entry from stream */
642642
if (FindNextFileW (dirp->handle, &dirp->data) != FALSE) {
643643
/* Got a file */
644644
p = &dirp->data;
645645
} 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 */
647647
FindClose (dirp->handle);
648648
dirp->handle = INVALID_HANDLE_VALUE;
649649
p = NULL;
650650
}
651651
@@ -740,11 +740,11 @@
740740
}
741741
742742
/*
743743
* Read next directory entry into called-allocated buffer.
744744
*
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
746746
* sets result to NULL and returns zero.
747747
*/
748748
static int
749749
readdir_r(
750750
DIR *dirp,
@@ -802,11 +802,11 @@
802802
803803
} else {
804804
805805
/*
806806
* 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
808808
* we cannot return NULL as that would stop the processing
809809
* of directory entries completely.
810810
*/
811811
entry->d_name[0] = '?';
812812
entry->d_name[1] = '\0';
@@ -875,11 +875,11 @@
875875
static int
876876
scandir(
877877
const char *dirname,
878878
struct dirent ***namelist,
879879
int (*filter)(const struct dirent*),
880
- int (*compare)(const void*, const void*))
880
+ int (*compare)(const struct dirent**, const struct dirent**))
881881
{
882882
struct dirent **files = NULL;
883883
size_t size = 0;
884884
size_t allocated = 0;
885885
const size_t init_size = 1;
@@ -935,11 +935,11 @@
935935
}
936936
937937
/* Read directory entry to temporary area */
938938
if (readdir_r (dir, tmp, &entry) == /*OK*/0) {
939939
940
- /* Did we got an entry? */
940
+ /* Did we get an entry? */
941941
if (entry != NULL) {
942942
int pass;
943943
944944
/* Determine whether to include the entry in result */
945945
if (filter) {
@@ -963,11 +963,12 @@
963963
964964
/*
965965
* End of directory stream reached => sort entries and
966966
* exit.
967967
*/
968
- qsort (files, size, sizeof (void*), compare);
968
+ qsort (files, size, sizeof (void*),
969
+ (int (*) (const void*, const void*)) compare);
969970
break;
970971
971972
}
972973
973974
} else {
@@ -1058,11 +1059,11 @@
10581059
n = sizeInWords - 1;
10591060
}
10601061
wcstr[n] = 0;
10611062
}
10621063
1063
- /* Length of resuting multi-byte string WITH zero terminator */
1064
+ /* Length of resulting multi-byte string WITH zero terminator */
10641065
if (pReturnValue) {
10651066
*pReturnValue = n + 1;
10661067
}
10671068
10681069
/* Success */
10691070
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button