Fossil SCM

Upgrade dirent.h to version 1.22. Minor spacing changes.

jan.nijtmans 2017-01-06 15:28 trunk
Commit b66b99cde9ece41924bf35c313f3f22460407540
+1 -1
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -323,11 +323,11 @@
323323
return;
324324
}
325325
glob_free(pBinary);
326326
}
327327
}
328
-
328
+
329329
/* Construct a prefix for the temporary file names */
330330
blob_zero(&prefix1);
331331
blob_zero(&prefix2);
332332
blob_appendf(&prefix1, "%s-v1", zName);
333333
blob_appendf(&prefix2, "%s-v2", zName);
334334
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -323,11 +323,11 @@
323 return;
324 }
325 glob_free(pBinary);
326 }
327 }
328
329 /* Construct a prefix for the temporary file names */
330 blob_zero(&prefix1);
331 blob_zero(&prefix2);
332 blob_appendf(&prefix1, "%s-v1", zName);
333 blob_appendf(&prefix2, "%s-v2", zName);
334
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -323,11 +323,11 @@
323 return;
324 }
325 glob_free(pBinary);
326 }
327 }
328
329 /* Construct a prefix for the temporary file names */
330 blob_zero(&prefix1);
331 blob_zero(&prefix2);
332 blob_appendf(&prefix1, "%s-v1", zName);
333 blob_appendf(&prefix2, "%s-v2", zName);
334
+1 -1
--- src/export.c
+++ src/export.c
@@ -155,11 +155,11 @@
155155
if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){
156156
zName[j++] = zName[i];
157157
}
158158
}
159159
zName[j] = 0;
160
-
160
+
161161
printf(" %s <%s>", zName, zEmail);
162162
free(zName);
163163
free(zEmail);
164164
db_reset(&q);
165165
}
166166
--- src/export.c
+++ src/export.c
@@ -155,11 +155,11 @@
155 if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){
156 zName[j++] = zName[i];
157 }
158 }
159 zName[j] = 0;
160
161 printf(" %s <%s>", zName, zEmail);
162 free(zName);
163 free(zEmail);
164 db_reset(&q);
165 }
166
--- src/export.c
+++ src/export.c
@@ -155,11 +155,11 @@
155 if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){
156 zName[j++] = zName[i];
157 }
158 }
159 zName[j] = 0;
160
161 printf(" %s <%s>", zName, zEmail);
162 free(zName);
163 free(zEmail);
164 db_reset(&q);
165 }
166
+2 -2
--- src/info.c
+++ src/info.c
@@ -1876,11 +1876,11 @@
18761876
rid = artifact_from_ci_and_filename(&url);
18771877
if( rid==0 ){
18781878
url_add_parameter(&url, "name", zName);
18791879
if( isFile ){
18801880
if( zName==0 ) zName = "";
1881
- rid = db_int(0,
1881
+ rid = db_int(0,
18821882
"SELECT fid FROM filename, mlink, event"
18831883
" WHERE name=%Q"
18841884
" AND mlink.fnid=filename.fnid"
18851885
" AND event.objid=mlink.mid"
18861886
" ORDER BY event.mtime DESC LIMIT 1",
@@ -1932,11 +1932,11 @@
19321932
g.zTop, zUuid);
19331933
}else{
19341934
style_submenu_element("Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid);
19351935
}
19361936
}
1937
- style_header("%s", isFile ? "File Content" :
1937
+ style_header("%s", isFile ? "File Content" :
19381938
descOnly ? "Artifact Description" : "Artifact Content");
19391939
if( g.perm.Admin ){
19401940
Stmt q;
19411941
db_prepare(&q,
19421942
"SELECT coalesce(user.login,rcvfrom.uid),"
19431943
--- src/info.c
+++ src/info.c
@@ -1876,11 +1876,11 @@
1876 rid = artifact_from_ci_and_filename(&url);
1877 if( rid==0 ){
1878 url_add_parameter(&url, "name", zName);
1879 if( isFile ){
1880 if( zName==0 ) zName = "";
1881 rid = db_int(0,
1882 "SELECT fid FROM filename, mlink, event"
1883 " WHERE name=%Q"
1884 " AND mlink.fnid=filename.fnid"
1885 " AND event.objid=mlink.mid"
1886 " ORDER BY event.mtime DESC LIMIT 1",
@@ -1932,11 +1932,11 @@
1932 g.zTop, zUuid);
1933 }else{
1934 style_submenu_element("Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid);
1935 }
1936 }
1937 style_header("%s", isFile ? "File Content" :
1938 descOnly ? "Artifact Description" : "Artifact Content");
1939 if( g.perm.Admin ){
1940 Stmt q;
1941 db_prepare(&q,
1942 "SELECT coalesce(user.login,rcvfrom.uid),"
1943
--- src/info.c
+++ src/info.c
@@ -1876,11 +1876,11 @@
1876 rid = artifact_from_ci_and_filename(&url);
1877 if( rid==0 ){
1878 url_add_parameter(&url, "name", zName);
1879 if( isFile ){
1880 if( zName==0 ) zName = "";
1881 rid = db_int(0,
1882 "SELECT fid FROM filename, mlink, event"
1883 " WHERE name=%Q"
1884 " AND mlink.fnid=filename.fnid"
1885 " AND event.objid=mlink.mid"
1886 " ORDER BY event.mtime DESC LIMIT 1",
@@ -1932,11 +1932,11 @@
1932 g.zTop, zUuid);
1933 }else{
1934 style_submenu_element("Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid);
1935 }
1936 }
1937 style_header("%s", isFile ? "File Content" :
1938 descOnly ? "Artifact Description" : "Artifact Content");
1939 if( g.perm.Admin ){
1940 Stmt q;
1941 db_prepare(&q,
1942 "SELECT coalesce(user.login,rcvfrom.uid),"
1943
+1 -1
--- src/main.c
+++ src/main.c
@@ -1419,11 +1419,11 @@
14191419
** and check to see if there is a file or directory with the same
14201420
** name as the raw PATH_INFO text.
14211421
*/
14221422
if( szFile<0 && i>0 ){
14231423
const char *zMimetype;
1424
- assert( fossil_strcmp(&zRepo[j], ".fossil")==0 );
1424
+ assert( fossil_strcmp(&zRepo[j], ".fossil")==0 );
14251425
zRepo[j] = 0; /* Remove the ".fossil" suffix */
14261426
14271427
/* The PATH_INFO prefix seen so far is a valid directory.
14281428
** Continue the loop with the next element of the PATH_INFO */
14291429
if( zPathInfo[i]=='/' && file_isdir(zCleanRepo)==1 ){
14301430
--- src/main.c
+++ src/main.c
@@ -1419,11 +1419,11 @@
1419 ** and check to see if there is a file or directory with the same
1420 ** name as the raw PATH_INFO text.
1421 */
1422 if( szFile<0 && i>0 ){
1423 const char *zMimetype;
1424 assert( fossil_strcmp(&zRepo[j], ".fossil")==0 );
1425 zRepo[j] = 0; /* Remove the ".fossil" suffix */
1426
1427 /* The PATH_INFO prefix seen so far is a valid directory.
1428 ** Continue the loop with the next element of the PATH_INFO */
1429 if( zPathInfo[i]=='/' && file_isdir(zCleanRepo)==1 ){
1430
--- src/main.c
+++ src/main.c
@@ -1419,11 +1419,11 @@
1419 ** and check to see if there is a file or directory with the same
1420 ** name as the raw PATH_INFO text.
1421 */
1422 if( szFile<0 && i>0 ){
1423 const char *zMimetype;
1424 assert( fossil_strcmp(&zRepo[j], ".fossil")==0 );
1425 zRepo[j] = 0; /* Remove the ".fossil" suffix */
1426
1427 /* The PATH_INFO prefix seen so far is a valid directory.
1428 ** Continue the loop with the next element of the PATH_INFO */
1429 if( zPathInfo[i]=='/' && file_isdir(zCleanRepo)==1 ){
1430
--- win/include/dirent.h
+++ win/include/dirent.h
@@ -1,8 +1,8 @@
11
/*
22
* Dirent interface for Microsoft Visual Studio
3
- * Version 1.21
3
+ * Version 1.22
44
*
55
* Copyright (C) 2006-2012 Toni Ronkko
66
* This file is part of dirent. Dirent may be freely distributed
77
* under the MIT license. For all details and documentation, see
88
* https://github.com/tronkko/dirent
@@ -9,25 +9,20 @@
99
*/
1010
#ifndef DIRENT_H
1111
#define DIRENT_H
1212
1313
/*
14
- * Define architecture flags so we don't need to include windows.h.
15
- * Avoiding windows.h makes it simpler to use windows sockets in conjunction
16
- * with dirent.h.
14
+ * Include windows.h without Windows Sockets 1.1 to prevent conflicts with
15
+ * Windows Sockets 2.0.
1716
*/
18
-#if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(_M_IX86)
19
-# define _X86_
17
+#ifndef WIN32_LEAN_AND_MEAN
18
+# define WIN32_LEAN_AND_MEAN
2019
#endif
21
-#if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(_M_AMD64)
22
-#define _AMD64_
23
-#endif
20
+#include <windows.h>
2421
2522
#include <stdio.h>
2623
#include <stdarg.h>
27
-#include <windef.h>
28
-#include <winbase.h>
2924
#include <wchar.h>
3025
#include <string.h>
3126
#include <stdlib.h>
3227
#include <malloc.h>
3328
#include <sys/types.h>
@@ -344,23 +339,38 @@
344339
/* Reset _WDIR structure */
345340
dirp->handle = INVALID_HANDLE_VALUE;
346341
dirp->patt = NULL;
347342
dirp->cached = 0;
348343
349
- /* Compute the length of full path plus zero terminator */
350
- n = GetFullPathNameW (dirname, 0, NULL, NULL);
344
+ /* Compute the length of full path plus zero terminator
345
+ *
346
+ * Note that on WinRT there's no way to convert relative paths
347
+ * into absolute paths, so just assume its an absolute path.
348
+ */
349
+# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
350
+ n = wcslen(dirname);
351
+# else
352
+ n = GetFullPathNameW (dirname, 0, NULL, NULL);
353
+# endif
351354
352355
/* Allocate room for absolute directory name and search pattern */
353356
dirp->patt = (wchar_t*) malloc (sizeof (wchar_t) * n + 16);
354357
if (dirp->patt) {
355358
356359
/*
357360
* Convert relative directory name to an absolute one. This
358361
* allows rewinddir() to function correctly even when current
359362
* working directory is changed between opendir() and rewinddir().
363
+ *
364
+ * Note that on WinRT there's no way to convert relative paths
365
+ * into absolute paths, so just assume its an absolute path.
360366
*/
361
- n = GetFullPathNameW (dirname, n, dirp->patt, NULL);
367
+# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
368
+ wcsncpy_s(dirp->patt, n+1, dirname, n);
369
+# else
370
+ n = GetFullPathNameW (dirname, n, dirp->patt, NULL);
371
+# endif
362372
if (n > 0) {
363373
wchar_t *p;
364374
365375
/* Append search pattern \* to the directory name */
366376
p = dirp->patt + n;
@@ -538,11 +548,13 @@
538548
_WDIR *dirp)
539549
{
540550
WIN32_FIND_DATAW *datap;
541551
542552
/* Open directory and retrieve the first entry */
543
- dirp->handle = FindFirstFileW (dirp->patt, &dirp->data);
553
+ dirp->handle = FindFirstFileExW(
554
+ dirp->patt, FindExInfoStandard, &dirp->data,
555
+ FindExSearchNameMatch, NULL, 0);
544556
if (dirp->handle != INVALID_HANDLE_VALUE) {
545557
546558
/* a directory entry is now waiting in memory */
547559
datap = &dirp->data;
548560
dirp->cached = 1;
@@ -869,11 +881,11 @@
869881
n = sizeInBytes - 1;
870882
}
871883
mbstr[n] = '\0';
872884
}
873885
874
- /* Lenght of resulting multi-bytes string WITH zero-terminator */
886
+ /* Length of resulting multi-bytes string WITH zero-terminator */
875887
if (pReturnValue) {
876888
*pReturnValue = n + 1;
877889
}
878890
879891
/* Success */
880892
--- win/include/dirent.h
+++ win/include/dirent.h
@@ -1,8 +1,8 @@
1 /*
2 * Dirent interface for Microsoft Visual Studio
3 * Version 1.21
4 *
5 * Copyright (C) 2006-2012 Toni Ronkko
6 * This file is part of dirent. Dirent may be freely distributed
7 * under the MIT license. For all details and documentation, see
8 * https://github.com/tronkko/dirent
@@ -9,25 +9,20 @@
9 */
10 #ifndef DIRENT_H
11 #define DIRENT_H
12
13 /*
14 * Define architecture flags so we don't need to include windows.h.
15 * Avoiding windows.h makes it simpler to use windows sockets in conjunction
16 * with dirent.h.
17 */
18 #if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(_M_IX86)
19 # define _X86_
20 #endif
21 #if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(_M_AMD64)
22 #define _AMD64_
23 #endif
24
25 #include <stdio.h>
26 #include <stdarg.h>
27 #include <windef.h>
28 #include <winbase.h>
29 #include <wchar.h>
30 #include <string.h>
31 #include <stdlib.h>
32 #include <malloc.h>
33 #include <sys/types.h>
@@ -344,23 +339,38 @@
344 /* Reset _WDIR structure */
345 dirp->handle = INVALID_HANDLE_VALUE;
346 dirp->patt = NULL;
347 dirp->cached = 0;
348
349 /* Compute the length of full path plus zero terminator */
350 n = GetFullPathNameW (dirname, 0, NULL, NULL);
 
 
 
 
 
 
 
 
351
352 /* Allocate room for absolute directory name and search pattern */
353 dirp->patt = (wchar_t*) malloc (sizeof (wchar_t) * n + 16);
354 if (dirp->patt) {
355
356 /*
357 * Convert relative directory name to an absolute one. This
358 * allows rewinddir() to function correctly even when current
359 * working directory is changed between opendir() and rewinddir().
 
 
 
360 */
361 n = GetFullPathNameW (dirname, n, dirp->patt, NULL);
 
 
 
 
362 if (n > 0) {
363 wchar_t *p;
364
365 /* Append search pattern \* to the directory name */
366 p = dirp->patt + n;
@@ -538,11 +548,13 @@
538 _WDIR *dirp)
539 {
540 WIN32_FIND_DATAW *datap;
541
542 /* Open directory and retrieve the first entry */
543 dirp->handle = FindFirstFileW (dirp->patt, &dirp->data);
 
 
544 if (dirp->handle != INVALID_HANDLE_VALUE) {
545
546 /* a directory entry is now waiting in memory */
547 datap = &dirp->data;
548 dirp->cached = 1;
@@ -869,11 +881,11 @@
869 n = sizeInBytes - 1;
870 }
871 mbstr[n] = '\0';
872 }
873
874 /* Lenght of resulting multi-bytes string WITH zero-terminator */
875 if (pReturnValue) {
876 *pReturnValue = n + 1;
877 }
878
879 /* Success */
880
--- win/include/dirent.h
+++ win/include/dirent.h
@@ -1,8 +1,8 @@
1 /*
2 * Dirent interface for Microsoft Visual Studio
3 * Version 1.22
4 *
5 * Copyright (C) 2006-2012 Toni Ronkko
6 * This file is part of dirent. Dirent may be freely distributed
7 * under the MIT license. For all details and documentation, see
8 * https://github.com/tronkko/dirent
@@ -9,25 +9,20 @@
9 */
10 #ifndef DIRENT_H
11 #define DIRENT_H
12
13 /*
14 * Include windows.h without Windows Sockets 1.1 to prevent conflicts with
15 * Windows Sockets 2.0.
 
16 */
17 #ifndef WIN32_LEAN_AND_MEAN
18 # define WIN32_LEAN_AND_MEAN
19 #endif
20 #include <windows.h>
 
 
21
22 #include <stdio.h>
23 #include <stdarg.h>
 
 
24 #include <wchar.h>
25 #include <string.h>
26 #include <stdlib.h>
27 #include <malloc.h>
28 #include <sys/types.h>
@@ -344,23 +339,38 @@
339 /* Reset _WDIR structure */
340 dirp->handle = INVALID_HANDLE_VALUE;
341 dirp->patt = NULL;
342 dirp->cached = 0;
343
344 /* Compute the length of full path plus zero terminator
345 *
346 * Note that on WinRT there's no way to convert relative paths
347 * into absolute paths, so just assume its an absolute path.
348 */
349 # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
350 n = wcslen(dirname);
351 # else
352 n = GetFullPathNameW (dirname, 0, NULL, NULL);
353 # endif
354
355 /* Allocate room for absolute directory name and search pattern */
356 dirp->patt = (wchar_t*) malloc (sizeof (wchar_t) * n + 16);
357 if (dirp->patt) {
358
359 /*
360 * Convert relative directory name to an absolute one. This
361 * allows rewinddir() to function correctly even when current
362 * working directory is changed between opendir() and rewinddir().
363 *
364 * Note that on WinRT there's no way to convert relative paths
365 * into absolute paths, so just assume its an absolute path.
366 */
367 # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
368 wcsncpy_s(dirp->patt, n+1, dirname, n);
369 # else
370 n = GetFullPathNameW (dirname, n, dirp->patt, NULL);
371 # endif
372 if (n > 0) {
373 wchar_t *p;
374
375 /* Append search pattern \* to the directory name */
376 p = dirp->patt + n;
@@ -538,11 +548,13 @@
548 _WDIR *dirp)
549 {
550 WIN32_FIND_DATAW *datap;
551
552 /* Open directory and retrieve the first entry */
553 dirp->handle = FindFirstFileExW(
554 dirp->patt, FindExInfoStandard, &dirp->data,
555 FindExSearchNameMatch, NULL, 0);
556 if (dirp->handle != INVALID_HANDLE_VALUE) {
557
558 /* a directory entry is now waiting in memory */
559 datap = &dirp->data;
560 dirp->cached = 1;
@@ -869,11 +881,11 @@
881 n = sizeInBytes - 1;
882 }
883 mbstr[n] = '\0';
884 }
885
886 /* Length of resulting multi-bytes string WITH zero-terminator */
887 if (pReturnValue) {
888 *pReturnValue = n + 1;
889 }
890
891 /* Success */
892

Keyboard Shortcuts

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