Fossil SCM

merge from trunk

wolfgang 2010-10-15 16:11 wolfgangHelpCmd merge
Commit c1271793624224d2bc7df2a7f8f98b9f6daa0158
+4 -6
--- Makefile
+++ Makefile
@@ -41,16 +41,14 @@
4141
# other dependencies. We sometimes add the -static option here
4242
# so that we can build a static executable that will run in a
4343
# chroot jail.
4444
#
4545
LIB = -lz $(LDFLAGS)
46
-# If you're on OpenSolaris:
47
-# LIB += lsocket
48
-# Solaris 10 needs:
49
-# LIB += -lsocket -lnsl
50
-# My assumption is that the Sol10 flags will work for Sol8/9 and possibly 11.
51
-#
46
+HOST_OS!= uname -s
47
+LIB.SunOS= -lsocket -lnsl
48
+LIB += $(LIB.$(HOST_OS))
49
+
5250
# If using HTTPS:
5351
LIB += -lcrypto -lssl
5452
5553
#### Tcl shell for use in running the fossil testsuite.
5654
#
5755
--- Makefile
+++ Makefile
@@ -41,16 +41,14 @@
41 # other dependencies. We sometimes add the -static option here
42 # so that we can build a static executable that will run in a
43 # chroot jail.
44 #
45 LIB = -lz $(LDFLAGS)
46 # If you're on OpenSolaris:
47 # LIB += lsocket
48 # Solaris 10 needs:
49 # LIB += -lsocket -lnsl
50 # My assumption is that the Sol10 flags will work for Sol8/9 and possibly 11.
51 #
52 # If using HTTPS:
53 LIB += -lcrypto -lssl
54
55 #### Tcl shell for use in running the fossil testsuite.
56 #
57
--- Makefile
+++ Makefile
@@ -41,16 +41,14 @@
41 # other dependencies. We sometimes add the -static option here
42 # so that we can build a static executable that will run in a
43 # chroot jail.
44 #
45 LIB = -lz $(LDFLAGS)
46 HOST_OS!= uname -s
47 LIB.SunOS= -lsocket -lnsl
48 LIB += $(LIB.$(HOST_OS))
49
 
 
50 # If using HTTPS:
51 LIB += -lcrypto -lssl
52
53 #### Tcl shell for use in running the fossil testsuite.
54 #
55
+1 -1
--- src/allrepo.c
+++ src/allrepo.c
@@ -34,11 +34,11 @@
3434
static char *quoteFilename(const char *zFilename){
3535
int i, c;
3636
int needQuote = 0;
3737
for(i=0; (c = zFilename[i])!=0; i++){
3838
if( c=='"' ) return 0;
39
- if( isspace(c) ) needQuote = 1;
39
+ if( fossil_isspace(c) ) needQuote = 1;
4040
if( c=='\\' && zFilename[i+1]==0 ) return 0;
4141
if( c=='$' ) return 0;
4242
}
4343
if( needQuote ){
4444
return mprintf("\"%s\"", zFilename);
4545
--- src/allrepo.c
+++ src/allrepo.c
@@ -34,11 +34,11 @@
34 static char *quoteFilename(const char *zFilename){
35 int i, c;
36 int needQuote = 0;
37 for(i=0; (c = zFilename[i])!=0; i++){
38 if( c=='"' ) return 0;
39 if( isspace(c) ) needQuote = 1;
40 if( c=='\\' && zFilename[i+1]==0 ) return 0;
41 if( c=='$' ) return 0;
42 }
43 if( needQuote ){
44 return mprintf("\"%s\"", zFilename);
45
--- src/allrepo.c
+++ src/allrepo.c
@@ -34,11 +34,11 @@
34 static char *quoteFilename(const char *zFilename){
35 int i, c;
36 int needQuote = 0;
37 for(i=0; (c = zFilename[i])!=0; i++){
38 if( c=='"' ) return 0;
39 if( fossil_isspace(c) ) needQuote = 1;
40 if( c=='\\' && zFilename[i+1]==0 ) return 0;
41 if( c=='$' ) return 0;
42 }
43 if( needQuote ){
44 return mprintf("\"%s\"", zFilename);
45
+1 -1
--- src/allrepo.c
+++ src/allrepo.c
@@ -34,11 +34,11 @@
3434
static char *quoteFilename(const char *zFilename){
3535
int i, c;
3636
int needQuote = 0;
3737
for(i=0; (c = zFilename[i])!=0; i++){
3838
if( c=='"' ) return 0;
39
- if( isspace(c) ) needQuote = 1;
39
+ if( fossil_isspace(c) ) needQuote = 1;
4040
if( c=='\\' && zFilename[i+1]==0 ) return 0;
4141
if( c=='$' ) return 0;
4242
}
4343
if( needQuote ){
4444
return mprintf("\"%s\"", zFilename);
4545
--- src/allrepo.c
+++ src/allrepo.c
@@ -34,11 +34,11 @@
34 static char *quoteFilename(const char *zFilename){
35 int i, c;
36 int needQuote = 0;
37 for(i=0; (c = zFilename[i])!=0; i++){
38 if( c=='"' ) return 0;
39 if( isspace(c) ) needQuote = 1;
40 if( c=='\\' && zFilename[i+1]==0 ) return 0;
41 if( c=='$' ) return 0;
42 }
43 if( needQuote ){
44 return mprintf("\"%s\"", zFilename);
45
--- src/allrepo.c
+++ src/allrepo.c
@@ -34,11 +34,11 @@
34 static char *quoteFilename(const char *zFilename){
35 int i, c;
36 int needQuote = 0;
37 for(i=0; (c = zFilename[i])!=0; i++){
38 if( c=='"' ) return 0;
39 if( fossil_isspace(c) ) needQuote = 1;
40 if( c=='\\' && zFilename[i+1]==0 ) return 0;
41 if( c=='$' ) return 0;
42 }
43 if( needQuote ){
44 return mprintf("\"%s\"", zFilename);
45
+3 -3
--- src/attach.c
+++ src/attach.c
@@ -82,11 +82,11 @@
8282
zUrlTail = mprintf("page=%t&file=%t", zTarget, zFilename);
8383
}
8484
@
8585
@ <p><a href="/attachview?%s(zUrlTail)">%h(zFilename)</a>
8686
@ [<a href="/attachdownload/%t(zFilename)?%s(zUrlTail)">download</a>]<br />
87
- if( zComment ) while( isspace(zComment[0]) ) zComment++;
87
+ if( zComment ) while( fossil_isspace(zComment[0]) ) zComment++;
8888
if( zComment && zComment[0] ){
8989
@ %w(zComment)<br />
9090
}
9191
if( zPage==0 && zTkt==0 ){
9292
if( zSrc==0 || zSrc[0]==0 ){
@@ -251,13 +251,13 @@
251251
}
252252
zName += n;
253253
if( zName[0]==0 ) zName = "unknown";
254254
blob_appendf(&manifest, "A %F %F %s\n", zName, zTarget, zUUID);
255255
zComment = PD("comment", "");
256
- while( isspace(zComment[0]) ) zComment++;
256
+ while( fossil_isspace(zComment[0]) ) zComment++;
257257
n = strlen(zComment);
258
- while( n>0 && isspace(zComment[n-1]) ){ n--; }
258
+ while( n>0 && fossil_isspace(zComment[n-1]) ){ n--; }
259259
if( n>0 ){
260260
blob_appendf(&manifest, "C %F\n", zComment);
261261
}
262262
zDate = db_text(0, "SELECT datetime('now')");
263263
zDate[10] = 'T';
264264
--- src/attach.c
+++ src/attach.c
@@ -82,11 +82,11 @@
82 zUrlTail = mprintf("page=%t&amp;file=%t", zTarget, zFilename);
83 }
84 @
85 @ <p><a href="/attachview?%s(zUrlTail)">%h(zFilename)</a>
86 @ [<a href="/attachdownload/%t(zFilename)?%s(zUrlTail)">download</a>]<br />
87 if( zComment ) while( isspace(zComment[0]) ) zComment++;
88 if( zComment && zComment[0] ){
89 @ %w(zComment)<br />
90 }
91 if( zPage==0 && zTkt==0 ){
92 if( zSrc==0 || zSrc[0]==0 ){
@@ -251,13 +251,13 @@
251 }
252 zName += n;
253 if( zName[0]==0 ) zName = "unknown";
254 blob_appendf(&manifest, "A %F %F %s\n", zName, zTarget, zUUID);
255 zComment = PD("comment", "");
256 while( isspace(zComment[0]) ) zComment++;
257 n = strlen(zComment);
258 while( n>0 && isspace(zComment[n-1]) ){ n--; }
259 if( n>0 ){
260 blob_appendf(&manifest, "C %F\n", zComment);
261 }
262 zDate = db_text(0, "SELECT datetime('now')");
263 zDate[10] = 'T';
264
--- src/attach.c
+++ src/attach.c
@@ -82,11 +82,11 @@
82 zUrlTail = mprintf("page=%t&amp;file=%t", zTarget, zFilename);
83 }
84 @
85 @ <p><a href="/attachview?%s(zUrlTail)">%h(zFilename)</a>
86 @ [<a href="/attachdownload/%t(zFilename)?%s(zUrlTail)">download</a>]<br />
87 if( zComment ) while( fossil_isspace(zComment[0]) ) zComment++;
88 if( zComment && zComment[0] ){
89 @ %w(zComment)<br />
90 }
91 if( zPage==0 && zTkt==0 ){
92 if( zSrc==0 || zSrc[0]==0 ){
@@ -251,13 +251,13 @@
251 }
252 zName += n;
253 if( zName[0]==0 ) zName = "unknown";
254 blob_appendf(&manifest, "A %F %F %s\n", zName, zTarget, zUUID);
255 zComment = PD("comment", "");
256 while( fossil_isspace(zComment[0]) ) zComment++;
257 n = strlen(zComment);
258 while( n>0 && fossil_isspace(zComment[n-1]) ){ n--; }
259 if( n>0 ){
260 blob_appendf(&manifest, "C %F\n", zComment);
261 }
262 zDate = db_text(0, "SELECT datetime('now')");
263 zDate[10] = 'T';
264
+27 -10
--- src/blob.c
+++ src/blob.c
@@ -72,25 +72,42 @@
7272
7373
/*
7474
** We find that the built-in isspace() function does not work for
7575
** some international character sets. So here is a substitute.
7676
*/
77
-int blob_isspace(char c){
77
+int fossil_isspace(char c){
7878
return c==' ' || (c<='\r' && c>='\t');
7979
}
80
+
81
+/*
82
+** Other replacements for ctype.h functions.
83
+*/
84
+int fossil_islower(char c){ return c>='a' && c<='z'; }
85
+int fossil_isupper(char c){ return c>='A' && c<='Z'; }
86
+int fossil_isdigit(char c){ return c>='0' && c<='9'; }
87
+int fossil_tolower(char c){
88
+ return fossil_isupper(c) ? c - 'A' + 'a' : c;
89
+}
90
+int fossil_isalpha(char c){
91
+ return (c>='a' && c<='z') || (c>='A' && c<='Z');
92
+}
93
+int fossil_isalnum(char c){
94
+ return (c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9');
95
+}
96
+
8097
8198
/*
8299
** COMMAND: test-isspace
83100
*/
84101
void isspace_cmd(void){
85102
int i;
86103
for(i=0; i<=255; i++){
87104
if( i==' ' || i=='\n' || i=='\t' || i=='\v'
88105
|| i=='\f' || i=='\r' ){
89
- assert( blob_isspace((char)i) );
106
+ assert( fossil_isspace((char)i) );
90107
}else{
91
- assert( !blob_isspace((char)i) );
108
+ assert( !fossil_isspace((char)i) );
92109
}
93110
}
94111
printf("All 256 characters OK\n");
95112
}
96113
@@ -429,11 +446,11 @@
429446
** not insert a new zero terminator.
430447
*/
431448
int blob_trim(Blob *p){
432449
char *z = p->aData;
433450
int n = p->nUsed;
434
- while( n>0 && blob_isspace(z[n-1]) ){ n--; }
451
+ while( n>0 && fossil_isspace(z[n-1]) ){ n--; }
435452
p->nUsed = n;
436453
return n;
437454
}
438455
439456
/*
@@ -452,15 +469,15 @@
452469
*/
453470
int blob_token(Blob *pFrom, Blob *pTo){
454471
char *aData = pFrom->aData;
455472
int n = pFrom->nUsed;
456473
int i = pFrom->iCursor;
457
- while( i<n && blob_isspace(aData[i]) ){ i++; }
474
+ while( i<n && fossil_isspace(aData[i]) ){ i++; }
458475
pFrom->iCursor = i;
459
- while( i<n && !blob_isspace(aData[i]) ){ i++; }
476
+ while( i<n && !fossil_isspace(aData[i]) ){ i++; }
460477
blob_extract(pFrom, i-pFrom->iCursor, pTo);
461
- while( i<n && blob_isspace(aData[i]) ){ i++; }
478
+ while( i<n && fossil_isspace(aData[i]) ){ i++; }
462479
pFrom->iCursor = i;
463480
return pTo->nUsed;
464481
}
465482
466483
/*
@@ -523,11 +540,11 @@
523540
int blob_is_int(Blob *pBlob, int *pValue){
524541
const char *z = blob_buffer(pBlob);
525542
int i, n, c, v;
526543
n = blob_size(pBlob);
527544
v = 0;
528
- for(i=0; i<n && (c = z[i])!=0 && isdigit(c); i++){
545
+ for(i=0; i<n && (c = z[i])!=0 && c>='0' && c<='9'; i++){
529546
v = v*10 + c - '0';
530547
}
531548
if( i==n ){
532549
*pValue = v;
533550
return 1;
@@ -612,11 +629,11 @@
612629
return blob_read_from_channel(pBlob, stdin, -1);
613630
}
614631
size = file_size(zFilename);
615632
blob_zero(pBlob);
616633
if( size<0 ){
617
- fossil_panic("no such file: %s", zFilename);
634
+ fossil_fatal("no such file: %s", zFilename);
618635
}
619636
if( size==0 ){
620637
return 0;
621638
}
622639
blob_resize(pBlob, size);
@@ -906,11 +923,11 @@
906923
int n = blob_size(pBlob);
907924
int k = strlen(zIn);
908925
int i, c;
909926
char *z;
910927
for(i=0; (c = zIn[i])!=0; i++){
911
- if( isspace(c) || c=='"' || (c=='\\' && zIn[i+1]!=0) ){
928
+ if( fossil_isspace(c) || c=='"' || (c=='\\' && zIn[i+1]!=0) ){
912929
blob_appendf(pBlob, "\"%s\"", zIn);
913930
z = blob_buffer(pBlob);
914931
for(i=n+1; i<=n+k; i++){
915932
if( z[i]=='"' ) z[i] = '_';
916933
}
917934
--- src/blob.c
+++ src/blob.c
@@ -72,25 +72,42 @@
72
73 /*
74 ** We find that the built-in isspace() function does not work for
75 ** some international character sets. So here is a substitute.
76 */
77 int blob_isspace(char c){
78 return c==' ' || (c<='\r' && c>='\t');
79 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
81 /*
82 ** COMMAND: test-isspace
83 */
84 void isspace_cmd(void){
85 int i;
86 for(i=0; i<=255; i++){
87 if( i==' ' || i=='\n' || i=='\t' || i=='\v'
88 || i=='\f' || i=='\r' ){
89 assert( blob_isspace((char)i) );
90 }else{
91 assert( !blob_isspace((char)i) );
92 }
93 }
94 printf("All 256 characters OK\n");
95 }
96
@@ -429,11 +446,11 @@
429 ** not insert a new zero terminator.
430 */
431 int blob_trim(Blob *p){
432 char *z = p->aData;
433 int n = p->nUsed;
434 while( n>0 && blob_isspace(z[n-1]) ){ n--; }
435 p->nUsed = n;
436 return n;
437 }
438
439 /*
@@ -452,15 +469,15 @@
452 */
453 int blob_token(Blob *pFrom, Blob *pTo){
454 char *aData = pFrom->aData;
455 int n = pFrom->nUsed;
456 int i = pFrom->iCursor;
457 while( i<n && blob_isspace(aData[i]) ){ i++; }
458 pFrom->iCursor = i;
459 while( i<n && !blob_isspace(aData[i]) ){ i++; }
460 blob_extract(pFrom, i-pFrom->iCursor, pTo);
461 while( i<n && blob_isspace(aData[i]) ){ i++; }
462 pFrom->iCursor = i;
463 return pTo->nUsed;
464 }
465
466 /*
@@ -523,11 +540,11 @@
523 int blob_is_int(Blob *pBlob, int *pValue){
524 const char *z = blob_buffer(pBlob);
525 int i, n, c, v;
526 n = blob_size(pBlob);
527 v = 0;
528 for(i=0; i<n && (c = z[i])!=0 && isdigit(c); i++){
529 v = v*10 + c - '0';
530 }
531 if( i==n ){
532 *pValue = v;
533 return 1;
@@ -612,11 +629,11 @@
612 return blob_read_from_channel(pBlob, stdin, -1);
613 }
614 size = file_size(zFilename);
615 blob_zero(pBlob);
616 if( size<0 ){
617 fossil_panic("no such file: %s", zFilename);
618 }
619 if( size==0 ){
620 return 0;
621 }
622 blob_resize(pBlob, size);
@@ -906,11 +923,11 @@
906 int n = blob_size(pBlob);
907 int k = strlen(zIn);
908 int i, c;
909 char *z;
910 for(i=0; (c = zIn[i])!=0; i++){
911 if( isspace(c) || c=='"' || (c=='\\' && zIn[i+1]!=0) ){
912 blob_appendf(pBlob, "\"%s\"", zIn);
913 z = blob_buffer(pBlob);
914 for(i=n+1; i<=n+k; i++){
915 if( z[i]=='"' ) z[i] = '_';
916 }
917
--- src/blob.c
+++ src/blob.c
@@ -72,25 +72,42 @@
72
73 /*
74 ** We find that the built-in isspace() function does not work for
75 ** some international character sets. So here is a substitute.
76 */
77 int fossil_isspace(char c){
78 return c==' ' || (c<='\r' && c>='\t');
79 }
80
81 /*
82 ** Other replacements for ctype.h functions.
83 */
84 int fossil_islower(char c){ return c>='a' && c<='z'; }
85 int fossil_isupper(char c){ return c>='A' && c<='Z'; }
86 int fossil_isdigit(char c){ return c>='0' && c<='9'; }
87 int fossil_tolower(char c){
88 return fossil_isupper(c) ? c - 'A' + 'a' : c;
89 }
90 int fossil_isalpha(char c){
91 return (c>='a' && c<='z') || (c>='A' && c<='Z');
92 }
93 int fossil_isalnum(char c){
94 return (c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9');
95 }
96
97
98 /*
99 ** COMMAND: test-isspace
100 */
101 void isspace_cmd(void){
102 int i;
103 for(i=0; i<=255; i++){
104 if( i==' ' || i=='\n' || i=='\t' || i=='\v'
105 || i=='\f' || i=='\r' ){
106 assert( fossil_isspace((char)i) );
107 }else{
108 assert( !fossil_isspace((char)i) );
109 }
110 }
111 printf("All 256 characters OK\n");
112 }
113
@@ -429,11 +446,11 @@
446 ** not insert a new zero terminator.
447 */
448 int blob_trim(Blob *p){
449 char *z = p->aData;
450 int n = p->nUsed;
451 while( n>0 && fossil_isspace(z[n-1]) ){ n--; }
452 p->nUsed = n;
453 return n;
454 }
455
456 /*
@@ -452,15 +469,15 @@
469 */
470 int blob_token(Blob *pFrom, Blob *pTo){
471 char *aData = pFrom->aData;
472 int n = pFrom->nUsed;
473 int i = pFrom->iCursor;
474 while( i<n && fossil_isspace(aData[i]) ){ i++; }
475 pFrom->iCursor = i;
476 while( i<n && !fossil_isspace(aData[i]) ){ i++; }
477 blob_extract(pFrom, i-pFrom->iCursor, pTo);
478 while( i<n && fossil_isspace(aData[i]) ){ i++; }
479 pFrom->iCursor = i;
480 return pTo->nUsed;
481 }
482
483 /*
@@ -523,11 +540,11 @@
540 int blob_is_int(Blob *pBlob, int *pValue){
541 const char *z = blob_buffer(pBlob);
542 int i, n, c, v;
543 n = blob_size(pBlob);
544 v = 0;
545 for(i=0; i<n && (c = z[i])!=0 && c>='0' && c<='9'; i++){
546 v = v*10 + c - '0';
547 }
548 if( i==n ){
549 *pValue = v;
550 return 1;
@@ -612,11 +629,11 @@
629 return blob_read_from_channel(pBlob, stdin, -1);
630 }
631 size = file_size(zFilename);
632 blob_zero(pBlob);
633 if( size<0 ){
634 fossil_fatal("no such file: %s", zFilename);
635 }
636 if( size==0 ){
637 return 0;
638 }
639 blob_resize(pBlob, size);
@@ -906,11 +923,11 @@
923 int n = blob_size(pBlob);
924 int k = strlen(zIn);
925 int i, c;
926 char *z;
927 for(i=0; (c = zIn[i])!=0; i++){
928 if( fossil_isspace(c) || c=='"' || (c=='\\' && zIn[i+1]!=0) ){
929 blob_appendf(pBlob, "\"%s\"", zIn);
930 z = blob_buffer(pBlob);
931 for(i=n+1; i<=n+k; i++){
932 if( z[i]=='"' ) z[i] = '_';
933 }
934
+21 -20
--- src/cgi.c
+++ src/cgi.c
@@ -463,11 +463,11 @@
463463
*/
464464
static void add_param_list(char *z, int terminator){
465465
while( *z ){
466466
char *zName;
467467
char *zValue;
468
- while( isspace(*z) ){ z++; }
468
+ while( fossil_isspace(*z) ){ z++; }
469469
zName = z;
470470
while( *z && *z!='=' && *z!=terminator ){ z++; }
471471
if( *z=='=' ){
472472
*z = 0;
473473
z++;
@@ -480,11 +480,11 @@
480480
dehttpize(zValue);
481481
}else{
482482
if( *z ){ *z++ = 0; }
483483
zValue = "";
484484
}
485
- if( islower(zName[0]) ){
485
+ if( fossil_islower(zName[0]) ){
486486
cgi_set_parameter_nocopy(zName, zValue);
487487
}
488488
}
489489
}
490490
@@ -575,11 +575,11 @@
575575
** in the example above.
576576
*/
577577
static int tokenize_line(char *z, int mxArg, char **azArg){
578578
int i = 0;
579579
while( *z ){
580
- while( isspace(*z) || *z==';' ){ z++; }
580
+ while( fossil_isspace(*z) || *z==';' ){ z++; }
581581
if( *z=='"' && z[1] ){
582582
*z = 0;
583583
z++;
584584
if( i<mxArg-1 ){ azArg[i++] = z; }
585585
while( *z && *z!='"' ){ z++; }
@@ -586,11 +586,11 @@
586586
if( *z==0 ) break;
587587
*z = 0;
588588
z++;
589589
}else{
590590
if( i<mxArg-1 ){ azArg[i++] = z; }
591
- while( *z && !isspace(*z) && *z!=';' && *z!='"' ){ z++; }
591
+ while( *z && !fossil_isspace(*z) && *z!=';' && *z!='"' ){ z++; }
592592
if( *z && *z!='"' ){
593593
*z = 0;
594594
z++;
595595
}
596596
}
@@ -621,11 +621,11 @@
621621
if( zBoundry==0 ) return;
622622
while( (zLine = get_line_from_string(&z, &len))!=0 ){
623623
if( zLine[0]==0 ){
624624
int nContent = 0;
625625
zValue = get_bounded_content(&z, &len, zBoundry, &nContent);
626
- if( zName && zValue && islower(zName[0]) ){
626
+ if( zName && zValue && fossil_islower(zName[0]) ){
627627
cgi_set_parameter_nocopy(zName, zValue);
628628
if( showBytes ){
629629
cgi_set_parameter_nocopy(mprintf("%s:bytes", zName),
630630
mprintf("%d",nContent));
631631
}
@@ -633,25 +633,25 @@
633633
zName = 0;
634634
showBytes = 0;
635635
}else{
636636
nArg = tokenize_line(zLine, sizeof(azArg)/sizeof(azArg[0]), azArg);
637637
for(i=0; i<nArg; i++){
638
- int c = tolower(azArg[i][0]);
638
+ int c = fossil_tolower(azArg[i][0]);
639639
int n = strlen(azArg[i]);
640640
if( c=='c' && sqlite3_strnicmp(azArg[i],"content-disposition:",n)==0 ){
641641
i++;
642642
}else if( c=='n' && sqlite3_strnicmp(azArg[i],"name=",n)==0 ){
643643
zName = azArg[++i];
644644
}else if( c=='f' && sqlite3_strnicmp(azArg[i],"filename=",n)==0 ){
645645
char *z = azArg[++i];
646
- if( zName && z && islower(zName[0]) ){
646
+ if( zName && z && fossil_islower(zName[0]) ){
647647
cgi_set_parameter_nocopy(mprintf("%s:filename",zName), z);
648648
}
649649
showBytes = 1;
650650
}else if( c=='c' && sqlite3_strnicmp(azArg[i],"content-type:",n)==0 ){
651651
char *z = azArg[++i];
652
- if( zName && z && islower(zName[0]) ){
652
+ if( zName && z && fossil_islower(zName[0]) ){
653653
cgi_set_parameter_nocopy(mprintf("%s:mimetype",zName), z);
654654
}
655655
}
656656
}
657657
}
@@ -773,11 +773,11 @@
773773
774774
/* If no match is found and the name begins with an upper-case
775775
** letter, then check to see if there is an environment variable
776776
** with the given name.
777777
*/
778
- if( isupper(zName[0]) ){
778
+ if( fossil_isupper(zName[0]) ){
779779
const char *zValue = getenv(zName);
780780
if( zValue ){
781781
cgi_set_parameter_nocopy(zName, zValue);
782782
CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue));
783783
return zValue;
@@ -916,17 +916,17 @@
916916
char *zResult = 0;
917917
if( zInput==0 ){
918918
if( zLeftOver ) *zLeftOver = 0;
919919
return 0;
920920
}
921
- while( isspace(*zInput) ){ zInput++; }
921
+ while( fossil_isspace(*zInput) ){ zInput++; }
922922
zResult = zInput;
923
- while( *zInput && !isspace(*zInput) ){ zInput++; }
923
+ while( *zInput && !fossil_isspace(*zInput) ){ zInput++; }
924924
if( *zInput ){
925925
*zInput = 0;
926926
zInput++;
927
- while( isspace(*zInput) ){ zInput++; }
927
+ while( fossil_isspace(*zInput) ){ zInput++; }
928928
}
929929
if( zLeftOver ){ *zLeftOver = zInput; }
930930
return zResult;
931931
}
932932
@@ -941,11 +941,11 @@
941941
*/
942942
void cgi_handle_http_request(const char *zIpAddr){
943943
char *z, *zToken;
944944
int i;
945945
struct sockaddr_in remoteName;
946
- size_t size = sizeof(struct sockaddr_in);
946
+ socklen_t size = sizeof(struct sockaddr_in);
947947
char zLine[2000]; /* A single line of input. */
948948
949949
g.fullHttpReply = 1;
950950
if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){
951951
malformed_request();
@@ -969,11 +969,11 @@
969969
if( zToken[i] ) zToken[i++] = 0;
970970
cgi_setenv("PATH_INFO", zToken);
971971
cgi_setenv("QUERY_STRING", &zToken[i]);
972972
if( zIpAddr==0 &&
973973
getpeername(fileno(g.httpIn), (struct sockaddr*)&remoteName,
974
- (socklen_t*)&size)>=0
974
+ &size)>=0
975975
){
976976
zIpAddr = inet_ntoa(remoteName.sin_addr);
977977
}
978978
if( zIpAddr ){
979979
cgi_setenv("REMOTE_ADDR", zIpAddr);
@@ -986,15 +986,17 @@
986986
char *zFieldName;
987987
char *zVal;
988988
989989
zFieldName = extract_token(zLine,&zVal);
990990
if( zFieldName==0 || *zFieldName==0 ) break;
991
- while( isspace(*zVal) ){ zVal++; }
991
+ while( fossil_isspace(*zVal) ){ zVal++; }
992992
i = strlen(zVal);
993
- while( i>0 && isspace(zVal[i-1]) ){ i--; }
993
+ while( i>0 && fossil_isspace(zVal[i-1]) ){ i--; }
994994
zVal[i] = 0;
995
- for(i=0; zFieldName[i]; i++){ zFieldName[i] = tolower(zFieldName[i]); }
995
+ for(i=0; zFieldName[i]; i++){
996
+ zFieldName[i] = fossil_tolower(zFieldName[i]);
997
+ }
996998
if( strcmp(zFieldName,"content-length:")==0 ){
997999
cgi_setenv("CONTENT_LENGTH", zVal);
9981000
}else if( strcmp(zFieldName,"content-type:")==0 ){
9991001
cgi_setenv("CONTENT_TYPE", zVal);
10001002
}else if( strcmp(zFieldName,"cookie:")==0 ){
@@ -1050,11 +1052,11 @@
10501052
fossil_exit(1);
10511053
#else
10521054
int listener = -1; /* The server socket */
10531055
int connection; /* A socket for each individual connection */
10541056
fd_set readfds; /* Set of file descriptors for select() */
1055
- size_t lenaddr; /* Length of the inaddr structure */
1057
+ socklen_t lenaddr; /* Length of the inaddr structure */
10561058
int child; /* PID of the child process */
10571059
int nchildren = 0; /* Number of child processes */
10581060
struct timeval delay; /* How long to wait inside select() */
10591061
struct sockaddr_in inaddr; /* The socket address */
10601062
int opt = 1; /* setsockopt flag */
@@ -1113,12 +1115,11 @@
11131115
FD_ZERO(&readfds);
11141116
FD_SET( listener, &readfds);
11151117
select( listener+1, &readfds, 0, 0, &delay);
11161118
if( FD_ISSET(listener, &readfds) ){
11171119
lenaddr = sizeof(inaddr);
1118
- connection = accept(listener, (struct sockaddr*)&inaddr,
1119
- (socklen_t*) &lenaddr);
1120
+ connection = accept(listener, (struct sockaddr*)&inaddr, &lenaddr);
11201121
if( connection>=0 ){
11211122
child = fork();
11221123
if( child!=0 ){
11231124
if( child>0 ) nchildren++;
11241125
close(connection);
11251126
--- src/cgi.c
+++ src/cgi.c
@@ -463,11 +463,11 @@
463 */
464 static void add_param_list(char *z, int terminator){
465 while( *z ){
466 char *zName;
467 char *zValue;
468 while( isspace(*z) ){ z++; }
469 zName = z;
470 while( *z && *z!='=' && *z!=terminator ){ z++; }
471 if( *z=='=' ){
472 *z = 0;
473 z++;
@@ -480,11 +480,11 @@
480 dehttpize(zValue);
481 }else{
482 if( *z ){ *z++ = 0; }
483 zValue = "";
484 }
485 if( islower(zName[0]) ){
486 cgi_set_parameter_nocopy(zName, zValue);
487 }
488 }
489 }
490
@@ -575,11 +575,11 @@
575 ** in the example above.
576 */
577 static int tokenize_line(char *z, int mxArg, char **azArg){
578 int i = 0;
579 while( *z ){
580 while( isspace(*z) || *z==';' ){ z++; }
581 if( *z=='"' && z[1] ){
582 *z = 0;
583 z++;
584 if( i<mxArg-1 ){ azArg[i++] = z; }
585 while( *z && *z!='"' ){ z++; }
@@ -586,11 +586,11 @@
586 if( *z==0 ) break;
587 *z = 0;
588 z++;
589 }else{
590 if( i<mxArg-1 ){ azArg[i++] = z; }
591 while( *z && !isspace(*z) && *z!=';' && *z!='"' ){ z++; }
592 if( *z && *z!='"' ){
593 *z = 0;
594 z++;
595 }
596 }
@@ -621,11 +621,11 @@
621 if( zBoundry==0 ) return;
622 while( (zLine = get_line_from_string(&z, &len))!=0 ){
623 if( zLine[0]==0 ){
624 int nContent = 0;
625 zValue = get_bounded_content(&z, &len, zBoundry, &nContent);
626 if( zName && zValue && islower(zName[0]) ){
627 cgi_set_parameter_nocopy(zName, zValue);
628 if( showBytes ){
629 cgi_set_parameter_nocopy(mprintf("%s:bytes", zName),
630 mprintf("%d",nContent));
631 }
@@ -633,25 +633,25 @@
633 zName = 0;
634 showBytes = 0;
635 }else{
636 nArg = tokenize_line(zLine, sizeof(azArg)/sizeof(azArg[0]), azArg);
637 for(i=0; i<nArg; i++){
638 int c = tolower(azArg[i][0]);
639 int n = strlen(azArg[i]);
640 if( c=='c' && sqlite3_strnicmp(azArg[i],"content-disposition:",n)==0 ){
641 i++;
642 }else if( c=='n' && sqlite3_strnicmp(azArg[i],"name=",n)==0 ){
643 zName = azArg[++i];
644 }else if( c=='f' && sqlite3_strnicmp(azArg[i],"filename=",n)==0 ){
645 char *z = azArg[++i];
646 if( zName && z && islower(zName[0]) ){
647 cgi_set_parameter_nocopy(mprintf("%s:filename",zName), z);
648 }
649 showBytes = 1;
650 }else if( c=='c' && sqlite3_strnicmp(azArg[i],"content-type:",n)==0 ){
651 char *z = azArg[++i];
652 if( zName && z && islower(zName[0]) ){
653 cgi_set_parameter_nocopy(mprintf("%s:mimetype",zName), z);
654 }
655 }
656 }
657 }
@@ -773,11 +773,11 @@
773
774 /* If no match is found and the name begins with an upper-case
775 ** letter, then check to see if there is an environment variable
776 ** with the given name.
777 */
778 if( isupper(zName[0]) ){
779 const char *zValue = getenv(zName);
780 if( zValue ){
781 cgi_set_parameter_nocopy(zName, zValue);
782 CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue));
783 return zValue;
@@ -916,17 +916,17 @@
916 char *zResult = 0;
917 if( zInput==0 ){
918 if( zLeftOver ) *zLeftOver = 0;
919 return 0;
920 }
921 while( isspace(*zInput) ){ zInput++; }
922 zResult = zInput;
923 while( *zInput && !isspace(*zInput) ){ zInput++; }
924 if( *zInput ){
925 *zInput = 0;
926 zInput++;
927 while( isspace(*zInput) ){ zInput++; }
928 }
929 if( zLeftOver ){ *zLeftOver = zInput; }
930 return zResult;
931 }
932
@@ -941,11 +941,11 @@
941 */
942 void cgi_handle_http_request(const char *zIpAddr){
943 char *z, *zToken;
944 int i;
945 struct sockaddr_in remoteName;
946 size_t size = sizeof(struct sockaddr_in);
947 char zLine[2000]; /* A single line of input. */
948
949 g.fullHttpReply = 1;
950 if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){
951 malformed_request();
@@ -969,11 +969,11 @@
969 if( zToken[i] ) zToken[i++] = 0;
970 cgi_setenv("PATH_INFO", zToken);
971 cgi_setenv("QUERY_STRING", &zToken[i]);
972 if( zIpAddr==0 &&
973 getpeername(fileno(g.httpIn), (struct sockaddr*)&remoteName,
974 (socklen_t*)&size)>=0
975 ){
976 zIpAddr = inet_ntoa(remoteName.sin_addr);
977 }
978 if( zIpAddr ){
979 cgi_setenv("REMOTE_ADDR", zIpAddr);
@@ -986,15 +986,17 @@
986 char *zFieldName;
987 char *zVal;
988
989 zFieldName = extract_token(zLine,&zVal);
990 if( zFieldName==0 || *zFieldName==0 ) break;
991 while( isspace(*zVal) ){ zVal++; }
992 i = strlen(zVal);
993 while( i>0 && isspace(zVal[i-1]) ){ i--; }
994 zVal[i] = 0;
995 for(i=0; zFieldName[i]; i++){ zFieldName[i] = tolower(zFieldName[i]); }
 
 
996 if( strcmp(zFieldName,"content-length:")==0 ){
997 cgi_setenv("CONTENT_LENGTH", zVal);
998 }else if( strcmp(zFieldName,"content-type:")==0 ){
999 cgi_setenv("CONTENT_TYPE", zVal);
1000 }else if( strcmp(zFieldName,"cookie:")==0 ){
@@ -1050,11 +1052,11 @@
1050 fossil_exit(1);
1051 #else
1052 int listener = -1; /* The server socket */
1053 int connection; /* A socket for each individual connection */
1054 fd_set readfds; /* Set of file descriptors for select() */
1055 size_t lenaddr; /* Length of the inaddr structure */
1056 int child; /* PID of the child process */
1057 int nchildren = 0; /* Number of child processes */
1058 struct timeval delay; /* How long to wait inside select() */
1059 struct sockaddr_in inaddr; /* The socket address */
1060 int opt = 1; /* setsockopt flag */
@@ -1113,12 +1115,11 @@
1113 FD_ZERO(&readfds);
1114 FD_SET( listener, &readfds);
1115 select( listener+1, &readfds, 0, 0, &delay);
1116 if( FD_ISSET(listener, &readfds) ){
1117 lenaddr = sizeof(inaddr);
1118 connection = accept(listener, (struct sockaddr*)&inaddr,
1119 (socklen_t*) &lenaddr);
1120 if( connection>=0 ){
1121 child = fork();
1122 if( child!=0 ){
1123 if( child>0 ) nchildren++;
1124 close(connection);
1125
--- src/cgi.c
+++ src/cgi.c
@@ -463,11 +463,11 @@
463 */
464 static void add_param_list(char *z, int terminator){
465 while( *z ){
466 char *zName;
467 char *zValue;
468 while( fossil_isspace(*z) ){ z++; }
469 zName = z;
470 while( *z && *z!='=' && *z!=terminator ){ z++; }
471 if( *z=='=' ){
472 *z = 0;
473 z++;
@@ -480,11 +480,11 @@
480 dehttpize(zValue);
481 }else{
482 if( *z ){ *z++ = 0; }
483 zValue = "";
484 }
485 if( fossil_islower(zName[0]) ){
486 cgi_set_parameter_nocopy(zName, zValue);
487 }
488 }
489 }
490
@@ -575,11 +575,11 @@
575 ** in the example above.
576 */
577 static int tokenize_line(char *z, int mxArg, char **azArg){
578 int i = 0;
579 while( *z ){
580 while( fossil_isspace(*z) || *z==';' ){ z++; }
581 if( *z=='"' && z[1] ){
582 *z = 0;
583 z++;
584 if( i<mxArg-1 ){ azArg[i++] = z; }
585 while( *z && *z!='"' ){ z++; }
@@ -586,11 +586,11 @@
586 if( *z==0 ) break;
587 *z = 0;
588 z++;
589 }else{
590 if( i<mxArg-1 ){ azArg[i++] = z; }
591 while( *z && !fossil_isspace(*z) && *z!=';' && *z!='"' ){ z++; }
592 if( *z && *z!='"' ){
593 *z = 0;
594 z++;
595 }
596 }
@@ -621,11 +621,11 @@
621 if( zBoundry==0 ) return;
622 while( (zLine = get_line_from_string(&z, &len))!=0 ){
623 if( zLine[0]==0 ){
624 int nContent = 0;
625 zValue = get_bounded_content(&z, &len, zBoundry, &nContent);
626 if( zName && zValue && fossil_islower(zName[0]) ){
627 cgi_set_parameter_nocopy(zName, zValue);
628 if( showBytes ){
629 cgi_set_parameter_nocopy(mprintf("%s:bytes", zName),
630 mprintf("%d",nContent));
631 }
@@ -633,25 +633,25 @@
633 zName = 0;
634 showBytes = 0;
635 }else{
636 nArg = tokenize_line(zLine, sizeof(azArg)/sizeof(azArg[0]), azArg);
637 for(i=0; i<nArg; i++){
638 int c = fossil_tolower(azArg[i][0]);
639 int n = strlen(azArg[i]);
640 if( c=='c' && sqlite3_strnicmp(azArg[i],"content-disposition:",n)==0 ){
641 i++;
642 }else if( c=='n' && sqlite3_strnicmp(azArg[i],"name=",n)==0 ){
643 zName = azArg[++i];
644 }else if( c=='f' && sqlite3_strnicmp(azArg[i],"filename=",n)==0 ){
645 char *z = azArg[++i];
646 if( zName && z && fossil_islower(zName[0]) ){
647 cgi_set_parameter_nocopy(mprintf("%s:filename",zName), z);
648 }
649 showBytes = 1;
650 }else if( c=='c' && sqlite3_strnicmp(azArg[i],"content-type:",n)==0 ){
651 char *z = azArg[++i];
652 if( zName && z && fossil_islower(zName[0]) ){
653 cgi_set_parameter_nocopy(mprintf("%s:mimetype",zName), z);
654 }
655 }
656 }
657 }
@@ -773,11 +773,11 @@
773
774 /* If no match is found and the name begins with an upper-case
775 ** letter, then check to see if there is an environment variable
776 ** with the given name.
777 */
778 if( fossil_isupper(zName[0]) ){
779 const char *zValue = getenv(zName);
780 if( zValue ){
781 cgi_set_parameter_nocopy(zName, zValue);
782 CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue));
783 return zValue;
@@ -916,17 +916,17 @@
916 char *zResult = 0;
917 if( zInput==0 ){
918 if( zLeftOver ) *zLeftOver = 0;
919 return 0;
920 }
921 while( fossil_isspace(*zInput) ){ zInput++; }
922 zResult = zInput;
923 while( *zInput && !fossil_isspace(*zInput) ){ zInput++; }
924 if( *zInput ){
925 *zInput = 0;
926 zInput++;
927 while( fossil_isspace(*zInput) ){ zInput++; }
928 }
929 if( zLeftOver ){ *zLeftOver = zInput; }
930 return zResult;
931 }
932
@@ -941,11 +941,11 @@
941 */
942 void cgi_handle_http_request(const char *zIpAddr){
943 char *z, *zToken;
944 int i;
945 struct sockaddr_in remoteName;
946 socklen_t size = sizeof(struct sockaddr_in);
947 char zLine[2000]; /* A single line of input. */
948
949 g.fullHttpReply = 1;
950 if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){
951 malformed_request();
@@ -969,11 +969,11 @@
969 if( zToken[i] ) zToken[i++] = 0;
970 cgi_setenv("PATH_INFO", zToken);
971 cgi_setenv("QUERY_STRING", &zToken[i]);
972 if( zIpAddr==0 &&
973 getpeername(fileno(g.httpIn), (struct sockaddr*)&remoteName,
974 &size)>=0
975 ){
976 zIpAddr = inet_ntoa(remoteName.sin_addr);
977 }
978 if( zIpAddr ){
979 cgi_setenv("REMOTE_ADDR", zIpAddr);
@@ -986,15 +986,17 @@
986 char *zFieldName;
987 char *zVal;
988
989 zFieldName = extract_token(zLine,&zVal);
990 if( zFieldName==0 || *zFieldName==0 ) break;
991 while( fossil_isspace(*zVal) ){ zVal++; }
992 i = strlen(zVal);
993 while( i>0 && fossil_isspace(zVal[i-1]) ){ i--; }
994 zVal[i] = 0;
995 for(i=0; zFieldName[i]; i++){
996 zFieldName[i] = fossil_tolower(zFieldName[i]);
997 }
998 if( strcmp(zFieldName,"content-length:")==0 ){
999 cgi_setenv("CONTENT_LENGTH", zVal);
1000 }else if( strcmp(zFieldName,"content-type:")==0 ){
1001 cgi_setenv("CONTENT_TYPE", zVal);
1002 }else if( strcmp(zFieldName,"cookie:")==0 ){
@@ -1050,11 +1052,11 @@
1052 fossil_exit(1);
1053 #else
1054 int listener = -1; /* The server socket */
1055 int connection; /* A socket for each individual connection */
1056 fd_set readfds; /* Set of file descriptors for select() */
1057 socklen_t lenaddr; /* Length of the inaddr structure */
1058 int child; /* PID of the child process */
1059 int nchildren = 0; /* Number of child processes */
1060 struct timeval delay; /* How long to wait inside select() */
1061 struct sockaddr_in inaddr; /* The socket address */
1062 int opt = 1; /* setsockopt flag */
@@ -1113,12 +1115,11 @@
1115 FD_ZERO(&readfds);
1116 FD_SET( listener, &readfds);
1117 select( listener+1, &readfds, 0, 0, &delay);
1118 if( FD_ISSET(listener, &readfds) ){
1119 lenaddr = sizeof(inaddr);
1120 connection = accept(listener, (struct sockaddr*)&inaddr, &lenaddr);
 
1121 if( connection>=0 ){
1122 child = fork();
1123 if( child!=0 ){
1124 if( child>0 ) nchildren++;
1125 close(connection);
1126
+6 -6
--- src/checkin.c
+++ src/checkin.c
@@ -218,21 +218,21 @@
218218
int cTerm;
219219
220220
if( zGlobList==0 || zGlobList[0]==0 ) return "0";
221221
blob_zero(&expr);
222222
while( zGlobList[0] ){
223
- while( isspace(zGlobList[0]) || zGlobList[0]==',' ) zGlobList++;
223
+ while( fossil_isspace(zGlobList[0]) || zGlobList[0]==',' ) zGlobList++;
224224
if( zGlobList[0]==0 ) break;
225225
if( zGlobList[0]=='\'' || zGlobList[0]=='"' ){
226226
cTerm = zGlobList[0];
227227
zGlobList++;
228228
}else{
229229
cTerm = ',';
230230
}
231231
for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){}
232232
if( cTerm==',' ){
233
- while( i>0 && isspace(zGlobList[i-1]) ){ i--; }
233
+ while( i>0 && fossil_isspace(zGlobList[i-1]) ){ i--; }
234234
}
235235
blob_appendf(&expr, "%s%s GLOB '%.*q'", zSep, zVal, i, zGlobList);
236236
zSep = " OR ";
237237
if( cTerm!=',' && zGlobList[i] ) i++;
238238
zGlobList += i;
@@ -433,20 +433,20 @@
433433
while( blob_line(&text, &line) ){
434434
int i, n;
435435
char *z;
436436
n = blob_size(&line);
437437
z = blob_buffer(&line);
438
- for(i=0; i<n && isspace(z[i]); i++){}
438
+ for(i=0; i<n && fossil_isspace(z[i]); i++){}
439439
if( i<n && z[i]=='#' ) continue;
440440
if( i<n || blob_size(pComment)>0 ){
441441
blob_appendf(pComment, "%b", &line);
442442
}
443443
}
444444
blob_reset(&text);
445445
zComment = blob_str(pComment);
446446
i = strlen(zComment);
447
- while( i>0 && isspace(zComment[i-1]) ){ i--; }
447
+ while( i>0 && fossil_isspace(zComment[i-1]) ){ i--; }
448448
blob_resize(pComment, i);
449449
}
450450
451451
/*
452452
** Populate the Global.aCommitFile[] based on the command line arguments
@@ -685,15 +685,15 @@
685685
*/
686686
if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
687687
fossil_fatal("no such user: %s", g.zLogin);
688688
}
689689
690
+ rc = unsaved_changes();
690691
db_begin_transaction();
691692
db_record_repository_filename(0);
692
- rc = unsaved_changes();
693693
if( rc==0 && !isAMerge && !forceFlag ){
694
- fossil_panic("nothing has changed");
694
+ fossil_fatal("nothing has changed");
695695
}
696696
697697
/* If one or more files that were named on the command line have not
698698
** been modified, bail out now.
699699
*/
700700
--- src/checkin.c
+++ src/checkin.c
@@ -218,21 +218,21 @@
218 int cTerm;
219
220 if( zGlobList==0 || zGlobList[0]==0 ) return "0";
221 blob_zero(&expr);
222 while( zGlobList[0] ){
223 while( isspace(zGlobList[0]) || zGlobList[0]==',' ) zGlobList++;
224 if( zGlobList[0]==0 ) break;
225 if( zGlobList[0]=='\'' || zGlobList[0]=='"' ){
226 cTerm = zGlobList[0];
227 zGlobList++;
228 }else{
229 cTerm = ',';
230 }
231 for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){}
232 if( cTerm==',' ){
233 while( i>0 && isspace(zGlobList[i-1]) ){ i--; }
234 }
235 blob_appendf(&expr, "%s%s GLOB '%.*q'", zSep, zVal, i, zGlobList);
236 zSep = " OR ";
237 if( cTerm!=',' && zGlobList[i] ) i++;
238 zGlobList += i;
@@ -433,20 +433,20 @@
433 while( blob_line(&text, &line) ){
434 int i, n;
435 char *z;
436 n = blob_size(&line);
437 z = blob_buffer(&line);
438 for(i=0; i<n && isspace(z[i]); i++){}
439 if( i<n && z[i]=='#' ) continue;
440 if( i<n || blob_size(pComment)>0 ){
441 blob_appendf(pComment, "%b", &line);
442 }
443 }
444 blob_reset(&text);
445 zComment = blob_str(pComment);
446 i = strlen(zComment);
447 while( i>0 && isspace(zComment[i-1]) ){ i--; }
448 blob_resize(pComment, i);
449 }
450
451 /*
452 ** Populate the Global.aCommitFile[] based on the command line arguments
@@ -685,15 +685,15 @@
685 */
686 if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
687 fossil_fatal("no such user: %s", g.zLogin);
688 }
689
 
690 db_begin_transaction();
691 db_record_repository_filename(0);
692 rc = unsaved_changes();
693 if( rc==0 && !isAMerge && !forceFlag ){
694 fossil_panic("nothing has changed");
695 }
696
697 /* If one or more files that were named on the command line have not
698 ** been modified, bail out now.
699 */
700
--- src/checkin.c
+++ src/checkin.c
@@ -218,21 +218,21 @@
218 int cTerm;
219
220 if( zGlobList==0 || zGlobList[0]==0 ) return "0";
221 blob_zero(&expr);
222 while( zGlobList[0] ){
223 while( fossil_isspace(zGlobList[0]) || zGlobList[0]==',' ) zGlobList++;
224 if( zGlobList[0]==0 ) break;
225 if( zGlobList[0]=='\'' || zGlobList[0]=='"' ){
226 cTerm = zGlobList[0];
227 zGlobList++;
228 }else{
229 cTerm = ',';
230 }
231 for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){}
232 if( cTerm==',' ){
233 while( i>0 && fossil_isspace(zGlobList[i-1]) ){ i--; }
234 }
235 blob_appendf(&expr, "%s%s GLOB '%.*q'", zSep, zVal, i, zGlobList);
236 zSep = " OR ";
237 if( cTerm!=',' && zGlobList[i] ) i++;
238 zGlobList += i;
@@ -433,20 +433,20 @@
433 while( blob_line(&text, &line) ){
434 int i, n;
435 char *z;
436 n = blob_size(&line);
437 z = blob_buffer(&line);
438 for(i=0; i<n && fossil_isspace(z[i]); i++){}
439 if( i<n && z[i]=='#' ) continue;
440 if( i<n || blob_size(pComment)>0 ){
441 blob_appendf(pComment, "%b", &line);
442 }
443 }
444 blob_reset(&text);
445 zComment = blob_str(pComment);
446 i = strlen(zComment);
447 while( i>0 && fossil_isspace(zComment[i-1]) ){ i--; }
448 blob_resize(pComment, i);
449 }
450
451 /*
452 ** Populate the Global.aCommitFile[] based on the command line arguments
@@ -685,15 +685,15 @@
685 */
686 if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
687 fossil_fatal("no such user: %s", g.zLogin);
688 }
689
690 rc = unsaved_changes();
691 db_begin_transaction();
692 db_record_repository_filename(0);
 
693 if( rc==0 && !isAMerge && !forceFlag ){
694 fossil_fatal("nothing has changed");
695 }
696
697 /* If one or more files that were named on the command line have not
698 ** been modified, bail out now.
699 */
700
+6 -6
--- src/checkin.c
+++ src/checkin.c
@@ -218,21 +218,21 @@
218218
int cTerm;
219219
220220
if( zGlobList==0 || zGlobList[0]==0 ) return "0";
221221
blob_zero(&expr);
222222
while( zGlobList[0] ){
223
- while( isspace(zGlobList[0]) || zGlobList[0]==',' ) zGlobList++;
223
+ while( fossil_isspace(zGlobList[0]) || zGlobList[0]==',' ) zGlobList++;
224224
if( zGlobList[0]==0 ) break;
225225
if( zGlobList[0]=='\'' || zGlobList[0]=='"' ){
226226
cTerm = zGlobList[0];
227227
zGlobList++;
228228
}else{
229229
cTerm = ',';
230230
}
231231
for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){}
232232
if( cTerm==',' ){
233
- while( i>0 && isspace(zGlobList[i-1]) ){ i--; }
233
+ while( i>0 && fossil_isspace(zGlobList[i-1]) ){ i--; }
234234
}
235235
blob_appendf(&expr, "%s%s GLOB '%.*q'", zSep, zVal, i, zGlobList);
236236
zSep = " OR ";
237237
if( cTerm!=',' && zGlobList[i] ) i++;
238238
zGlobList += i;
@@ -433,20 +433,20 @@
433433
while( blob_line(&text, &line) ){
434434
int i, n;
435435
char *z;
436436
n = blob_size(&line);
437437
z = blob_buffer(&line);
438
- for(i=0; i<n && isspace(z[i]); i++){}
438
+ for(i=0; i<n && fossil_isspace(z[i]); i++){}
439439
if( i<n && z[i]=='#' ) continue;
440440
if( i<n || blob_size(pComment)>0 ){
441441
blob_appendf(pComment, "%b", &line);
442442
}
443443
}
444444
blob_reset(&text);
445445
zComment = blob_str(pComment);
446446
i = strlen(zComment);
447
- while( i>0 && isspace(zComment[i-1]) ){ i--; }
447
+ while( i>0 && fossil_isspace(zComment[i-1]) ){ i--; }
448448
blob_resize(pComment, i);
449449
}
450450
451451
/*
452452
** Populate the Global.aCommitFile[] based on the command line arguments
@@ -685,15 +685,15 @@
685685
*/
686686
if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
687687
fossil_fatal("no such user: %s", g.zLogin);
688688
}
689689
690
+ rc = unsaved_changes();
690691
db_begin_transaction();
691692
db_record_repository_filename(0);
692
- rc = unsaved_changes();
693693
if( rc==0 && !isAMerge && !forceFlag ){
694
- fossil_panic("nothing has changed");
694
+ fossil_fatal("nothing has changed");
695695
}
696696
697697
/* If one or more files that were named on the command line have not
698698
** been modified, bail out now.
699699
*/
700700
--- src/checkin.c
+++ src/checkin.c
@@ -218,21 +218,21 @@
218 int cTerm;
219
220 if( zGlobList==0 || zGlobList[0]==0 ) return "0";
221 blob_zero(&expr);
222 while( zGlobList[0] ){
223 while( isspace(zGlobList[0]) || zGlobList[0]==',' ) zGlobList++;
224 if( zGlobList[0]==0 ) break;
225 if( zGlobList[0]=='\'' || zGlobList[0]=='"' ){
226 cTerm = zGlobList[0];
227 zGlobList++;
228 }else{
229 cTerm = ',';
230 }
231 for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){}
232 if( cTerm==',' ){
233 while( i>0 && isspace(zGlobList[i-1]) ){ i--; }
234 }
235 blob_appendf(&expr, "%s%s GLOB '%.*q'", zSep, zVal, i, zGlobList);
236 zSep = " OR ";
237 if( cTerm!=',' && zGlobList[i] ) i++;
238 zGlobList += i;
@@ -433,20 +433,20 @@
433 while( blob_line(&text, &line) ){
434 int i, n;
435 char *z;
436 n = blob_size(&line);
437 z = blob_buffer(&line);
438 for(i=0; i<n && isspace(z[i]); i++){}
439 if( i<n && z[i]=='#' ) continue;
440 if( i<n || blob_size(pComment)>0 ){
441 blob_appendf(pComment, "%b", &line);
442 }
443 }
444 blob_reset(&text);
445 zComment = blob_str(pComment);
446 i = strlen(zComment);
447 while( i>0 && isspace(zComment[i-1]) ){ i--; }
448 blob_resize(pComment, i);
449 }
450
451 /*
452 ** Populate the Global.aCommitFile[] based on the command line arguments
@@ -685,15 +685,15 @@
685 */
686 if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
687 fossil_fatal("no such user: %s", g.zLogin);
688 }
689
 
690 db_begin_transaction();
691 db_record_repository_filename(0);
692 rc = unsaved_changes();
693 if( rc==0 && !isAMerge && !forceFlag ){
694 fossil_panic("nothing has changed");
695 }
696
697 /* If one or more files that were named on the command line have not
698 ** been modified, bail out now.
699 */
700
--- src/checkin.c
+++ src/checkin.c
@@ -218,21 +218,21 @@
218 int cTerm;
219
220 if( zGlobList==0 || zGlobList[0]==0 ) return "0";
221 blob_zero(&expr);
222 while( zGlobList[0] ){
223 while( fossil_isspace(zGlobList[0]) || zGlobList[0]==',' ) zGlobList++;
224 if( zGlobList[0]==0 ) break;
225 if( zGlobList[0]=='\'' || zGlobList[0]=='"' ){
226 cTerm = zGlobList[0];
227 zGlobList++;
228 }else{
229 cTerm = ',';
230 }
231 for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){}
232 if( cTerm==',' ){
233 while( i>0 && fossil_isspace(zGlobList[i-1]) ){ i--; }
234 }
235 blob_appendf(&expr, "%s%s GLOB '%.*q'", zSep, zVal, i, zGlobList);
236 zSep = " OR ";
237 if( cTerm!=',' && zGlobList[i] ) i++;
238 zGlobList += i;
@@ -433,20 +433,20 @@
433 while( blob_line(&text, &line) ){
434 int i, n;
435 char *z;
436 n = blob_size(&line);
437 z = blob_buffer(&line);
438 for(i=0; i<n && fossil_isspace(z[i]); i++){}
439 if( i<n && z[i]=='#' ) continue;
440 if( i<n || blob_size(pComment)>0 ){
441 blob_appendf(pComment, "%b", &line);
442 }
443 }
444 blob_reset(&text);
445 zComment = blob_str(pComment);
446 i = strlen(zComment);
447 while( i>0 && fossil_isspace(zComment[i-1]) ){ i--; }
448 blob_resize(pComment, i);
449 }
450
451 /*
452 ** Populate the Global.aCommitFile[] based on the command line arguments
@@ -685,15 +685,15 @@
685 */
686 if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
687 fossil_fatal("no such user: %s", g.zLogin);
688 }
689
690 rc = unsaved_changes();
691 db_begin_transaction();
692 db_record_repository_filename(0);
 
693 if( rc==0 && !isAMerge && !forceFlag ){
694 fossil_fatal("nothing has changed");
695 }
696
697 /* If one or more files that were named on the command line have not
698 ** been modified, bail out now.
699 */
700
+3 -3
--- src/comformat.c
+++ src/comformat.c
@@ -38,29 +38,29 @@
3838
int doIndent = 0;
3939
char zBuf[400];
4040
int lineCnt = 0;
4141
4242
for(;;){
43
- while( isspace(zText[0]) ){ zText++; }
43
+ while( fossil_isspace(zText[0]) ){ zText++; }
4444
if( zText[0]==0 ){
4545
if( doIndent==0 ){
4646
printf("\n");
4747
lineCnt = 1;
4848
}
4949
return lineCnt;
5050
}
5151
for(sk=si=i=k=0; zText[i] && k<tlen; i++){
5252
char c = zText[i];
53
- if( isspace(c) ){
53
+ if( fossil_isspace(c) ){
5454
si = i;
5555
sk = k;
5656
if( k==0 || zBuf[k-1]!=' ' ){
5757
zBuf[k++] = ' ';
5858
}
5959
}else{
6060
zBuf[k] = c;
61
- if( c=='-' && k>0 && isalpha(zBuf[k-1]) ){
61
+ if( c=='-' && k>0 && fossil_isalpha(zBuf[k-1]) ){
6262
si = i+1;
6363
sk = k+1;
6464
}
6565
k++;
6666
}
6767
--- src/comformat.c
+++ src/comformat.c
@@ -38,29 +38,29 @@
38 int doIndent = 0;
39 char zBuf[400];
40 int lineCnt = 0;
41
42 for(;;){
43 while( isspace(zText[0]) ){ zText++; }
44 if( zText[0]==0 ){
45 if( doIndent==0 ){
46 printf("\n");
47 lineCnt = 1;
48 }
49 return lineCnt;
50 }
51 for(sk=si=i=k=0; zText[i] && k<tlen; i++){
52 char c = zText[i];
53 if( isspace(c) ){
54 si = i;
55 sk = k;
56 if( k==0 || zBuf[k-1]!=' ' ){
57 zBuf[k++] = ' ';
58 }
59 }else{
60 zBuf[k] = c;
61 if( c=='-' && k>0 && isalpha(zBuf[k-1]) ){
62 si = i+1;
63 sk = k+1;
64 }
65 k++;
66 }
67
--- src/comformat.c
+++ src/comformat.c
@@ -38,29 +38,29 @@
38 int doIndent = 0;
39 char zBuf[400];
40 int lineCnt = 0;
41
42 for(;;){
43 while( fossil_isspace(zText[0]) ){ zText++; }
44 if( zText[0]==0 ){
45 if( doIndent==0 ){
46 printf("\n");
47 lineCnt = 1;
48 }
49 return lineCnt;
50 }
51 for(sk=si=i=k=0; zText[i] && k<tlen; i++){
52 char c = zText[i];
53 if( fossil_isspace(c) ){
54 si = i;
55 sk = k;
56 if( k==0 || zBuf[k-1]!=' ' ){
57 zBuf[k++] = ' ';
58 }
59 }else{
60 zBuf[k] = c;
61 if( c=='-' && k>0 && fossil_isalpha(zBuf[k-1]) ){
62 si = i+1;
63 sk = k+1;
64 }
65 k++;
66 }
67
+26 -45
--- src/config.h
+++ src/config.h
@@ -33,11 +33,11 @@
3333
** System header files used by all modules
3434
*/
3535
#include <unistd.h>
3636
#include <stdio.h>
3737
#include <stdlib.h>
38
-#include <ctype.h>
38
+/* #include <ctype.h> // do not use - causes problems */
3939
#include <string.h>
4040
#include <stdarg.h>
4141
#include <assert.h>
4242
4343
#endif
@@ -85,66 +85,47 @@
8585
#include "sqlite3.h"
8686
8787
/*
8888
** Typedef for a 64-bit integer
8989
*/
90
-typedef sqlite_int64 i64;
91
-typedef sqlite_uint64 u64;
90
+typedef sqlite3_int64 i64;
91
+typedef sqlite3_uint64 u64;
9292
9393
/*
9494
** Unsigned character type
9595
*/
9696
typedef unsigned char u8;
9797
98
-/*
99
-** Standard colors. These colors can also be changed using a stylesheet.
100
-*/
101
-
102
-/* A blue border and background. Used for the title bar and for dates
103
-** in a timeline.
104
-*/
105
-#define BORDER1 "#a0b5f4" /* Stylesheet class: border1 */
106
-#define BG1 "#d0d9f4" /* Stylesheet class: bkgnd1 */
107
-
108
-/* A red border and background. Use for releases in the timeline.
109
-*/
110
-#define BORDER2 "#ec9898" /* Stylesheet class: border2 */
111
-#define BG2 "#f7c0c0" /* Stylesheet class: bkgnd2 */
112
-
113
-/* A gray background. Used for column headers in the Wiki Table of Contents
114
-** and to highlight ticket properties.
115
-*/
116
-#define BG3 "#d0d0d0" /* Stylesheet class: bkgnd3 */
117
-
118
-/* A light-gray background. Used for title bar, menus, and rlog alternation
119
-*/
120
-#define BG4 "#f0f0f0" /* Stylesheet class: bkgnd4 */
121
-
122
-/* A deeper gray background. Used for branches
123
-*/
124
-#define BG5 "#dddddd" /* Stylesheet class: bkgnd5 */
125
-
126
-/* Default HTML page header */
127
-#define HEADER "<html>\n" \
128
- "<head>\n" \
129
- "<link rel=\"alternate\" type=\"application/rss+xml\"\n" \
130
- " title=\"%N Timeline Feed\" href=\"%B/timeline.rss\">\n" \
131
- "<title>%N: %T</title>\n</head>\n" \
132
- "<body bgcolor=\"white\">"
133
-
134
-/* Default HTML page footer */
135
-#define FOOTER "<div id=\"footer\"><small><small>\n" \
136
- "<a href=\"about\">Fossil version %V</a>\n" \
137
- "</small></small></div>\n" \
138
- "</body></html>\n"
139
-
14098
/* In the timeline, check-in messages are truncated at the first space
14199
** that is more than MX_CKIN_MSG from the beginning, or at the first
142100
** paragraph break that is more than MN_CKIN_MSG from the beginning.
143101
*/
144102
#define MN_CKIN_MSG 100
145103
#define MX_CKIN_MSG 300
104
+
105
+/*
106
+** The following macros are used to cast pointers to integers and
107
+** integers to pointers. The way you do this varies from one compiler
108
+** to the next, so we have developed the following set of #if statements
109
+** to generate appropriate macros for a wide range of compilers.
110
+**
111
+** The correct "ANSI" way to do this is to use the intptr_t type.
112
+** Unfortunately, that typedef is not available on all compilers, or
113
+** if it is available, it requires an #include of specific headers
114
+** that vary from one machine to the next.
115
+*/
116
+#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
117
+# define FOSSIL_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X))
118
+# define FOSSIL_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X))
119
+#elif !defined(__GNUC__) /* Works for compilers other than LLVM */
120
+# define FOSSIL_INT_TO_PTR(X) ((void*)&((char*)0)[X])
121
+# define FOSSIL_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))
122
+#else /* Generates a warning - but it always works */
123
+# define FOSSIL_INT_TO_PTR(X) ((void*)(X))
124
+# define FOSSIL_PTR_TO_INT(X) ((int)(X))
125
+#endif
126
+
146127
147128
/* Unset the following to disable internationalization code. */
148129
#ifndef FOSSIL_I18N
149130
# define FOSSIL_I18N 1
150131
#endif
151132
--- src/config.h
+++ src/config.h
@@ -33,11 +33,11 @@
33 ** System header files used by all modules
34 */
35 #include <unistd.h>
36 #include <stdio.h>
37 #include <stdlib.h>
38 #include <ctype.h>
39 #include <string.h>
40 #include <stdarg.h>
41 #include <assert.h>
42
43 #endif
@@ -85,66 +85,47 @@
85 #include "sqlite3.h"
86
87 /*
88 ** Typedef for a 64-bit integer
89 */
90 typedef sqlite_int64 i64;
91 typedef sqlite_uint64 u64;
92
93 /*
94 ** Unsigned character type
95 */
96 typedef unsigned char u8;
97
98 /*
99 ** Standard colors. These colors can also be changed using a stylesheet.
100 */
101
102 /* A blue border and background. Used for the title bar and for dates
103 ** in a timeline.
104 */
105 #define BORDER1 "#a0b5f4" /* Stylesheet class: border1 */
106 #define BG1 "#d0d9f4" /* Stylesheet class: bkgnd1 */
107
108 /* A red border and background. Use for releases in the timeline.
109 */
110 #define BORDER2 "#ec9898" /* Stylesheet class: border2 */
111 #define BG2 "#f7c0c0" /* Stylesheet class: bkgnd2 */
112
113 /* A gray background. Used for column headers in the Wiki Table of Contents
114 ** and to highlight ticket properties.
115 */
116 #define BG3 "#d0d0d0" /* Stylesheet class: bkgnd3 */
117
118 /* A light-gray background. Used for title bar, menus, and rlog alternation
119 */
120 #define BG4 "#f0f0f0" /* Stylesheet class: bkgnd4 */
121
122 /* A deeper gray background. Used for branches
123 */
124 #define BG5 "#dddddd" /* Stylesheet class: bkgnd5 */
125
126 /* Default HTML page header */
127 #define HEADER "<html>\n" \
128 "<head>\n" \
129 "<link rel=\"alternate\" type=\"application/rss+xml\"\n" \
130 " title=\"%N Timeline Feed\" href=\"%B/timeline.rss\">\n" \
131 "<title>%N: %T</title>\n</head>\n" \
132 "<body bgcolor=\"white\">"
133
134 /* Default HTML page footer */
135 #define FOOTER "<div id=\"footer\"><small><small>\n" \
136 "<a href=\"about\">Fossil version %V</a>\n" \
137 "</small></small></div>\n" \
138 "</body></html>\n"
139
140 /* In the timeline, check-in messages are truncated at the first space
141 ** that is more than MX_CKIN_MSG from the beginning, or at the first
142 ** paragraph break that is more than MN_CKIN_MSG from the beginning.
143 */
144 #define MN_CKIN_MSG 100
145 #define MX_CKIN_MSG 300
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
147 /* Unset the following to disable internationalization code. */
148 #ifndef FOSSIL_I18N
149 # define FOSSIL_I18N 1
150 #endif
151
--- src/config.h
+++ src/config.h
@@ -33,11 +33,11 @@
33 ** System header files used by all modules
34 */
35 #include <unistd.h>
36 #include <stdio.h>
37 #include <stdlib.h>
38 /* #include <ctype.h> // do not use - causes problems */
39 #include <string.h>
40 #include <stdarg.h>
41 #include <assert.h>
42
43 #endif
@@ -85,66 +85,47 @@
85 #include "sqlite3.h"
86
87 /*
88 ** Typedef for a 64-bit integer
89 */
90 typedef sqlite3_int64 i64;
91 typedef sqlite3_uint64 u64;
92
93 /*
94 ** Unsigned character type
95 */
96 typedef unsigned char u8;
97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98 /* In the timeline, check-in messages are truncated at the first space
99 ** that is more than MX_CKIN_MSG from the beginning, or at the first
100 ** paragraph break that is more than MN_CKIN_MSG from the beginning.
101 */
102 #define MN_CKIN_MSG 100
103 #define MX_CKIN_MSG 300
104
105 /*
106 ** The following macros are used to cast pointers to integers and
107 ** integers to pointers. The way you do this varies from one compiler
108 ** to the next, so we have developed the following set of #if statements
109 ** to generate appropriate macros for a wide range of compilers.
110 **
111 ** The correct "ANSI" way to do this is to use the intptr_t type.
112 ** Unfortunately, that typedef is not available on all compilers, or
113 ** if it is available, it requires an #include of specific headers
114 ** that vary from one machine to the next.
115 */
116 #if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
117 # define FOSSIL_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X))
118 # define FOSSIL_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X))
119 #elif !defined(__GNUC__) /* Works for compilers other than LLVM */
120 # define FOSSIL_INT_TO_PTR(X) ((void*)&((char*)0)[X])
121 # define FOSSIL_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))
122 #else /* Generates a warning - but it always works */
123 # define FOSSIL_INT_TO_PTR(X) ((void*)(X))
124 # define FOSSIL_PTR_TO_INT(X) ((int)(X))
125 #endif
126
127
128 /* Unset the following to disable internationalization code. */
129 #ifndef FOSSIL_I18N
130 # define FOSSIL_I18N 1
131 #endif
132
+5 -1
--- src/diff.c
+++ src/diff.c
@@ -99,17 +99,21 @@
9999
return 0;
100100
}
101101
a = malloc( nLine*sizeof(a[0]) );
102102
if( a==0 ) fossil_panic("out of memory");
103103
memset(a, 0, nLine*sizeof(a[0]) );
104
+ if( n==0 ){
105
+ *pnLine = 0;
106
+ return a;
107
+ }
104108
105109
/* Fill in the array */
106110
for(i=0; i<nLine; i++){
107111
a[i].z = z;
108112
for(j=0; z[j] && z[j]!='\n'; j++){}
109113
k = j;
110
- while( ignoreWS && k>0 && isspace(z[k-1]) ){ k--; }
114
+ while( ignoreWS && k>0 && fossil_isspace(z[k-1]) ){ k--; }
111115
for(h=0, x=0; x<k; x++){
112116
h = h ^ (h<<2) ^ z[x];
113117
}
114118
a[i].h = h = (h<<LENGTH_MASK_SZ) | k;;
115119
h2 = h % nLine;
116120
--- src/diff.c
+++ src/diff.c
@@ -99,17 +99,21 @@
99 return 0;
100 }
101 a = malloc( nLine*sizeof(a[0]) );
102 if( a==0 ) fossil_panic("out of memory");
103 memset(a, 0, nLine*sizeof(a[0]) );
 
 
 
 
104
105 /* Fill in the array */
106 for(i=0; i<nLine; i++){
107 a[i].z = z;
108 for(j=0; z[j] && z[j]!='\n'; j++){}
109 k = j;
110 while( ignoreWS && k>0 && isspace(z[k-1]) ){ k--; }
111 for(h=0, x=0; x<k; x++){
112 h = h ^ (h<<2) ^ z[x];
113 }
114 a[i].h = h = (h<<LENGTH_MASK_SZ) | k;;
115 h2 = h % nLine;
116
--- src/diff.c
+++ src/diff.c
@@ -99,17 +99,21 @@
99 return 0;
100 }
101 a = malloc( nLine*sizeof(a[0]) );
102 if( a==0 ) fossil_panic("out of memory");
103 memset(a, 0, nLine*sizeof(a[0]) );
104 if( n==0 ){
105 *pnLine = 0;
106 return a;
107 }
108
109 /* Fill in the array */
110 for(i=0; i<nLine; i++){
111 a[i].z = z;
112 for(j=0; z[j] && z[j]!='\n'; j++){}
113 k = j;
114 while( ignoreWS && k>0 && fossil_isspace(z[k-1]) ){ k--; }
115 for(h=0, x=0; x<k; x++){
116 h = h ^ (h<<2) ^ z[x];
117 }
118 a[i].h = h = (h<<LENGTH_MASK_SZ) | k;;
119 h2 = h % nLine;
120
+5 -1
--- src/diff.c
+++ src/diff.c
@@ -99,17 +99,21 @@
9999
return 0;
100100
}
101101
a = malloc( nLine*sizeof(a[0]) );
102102
if( a==0 ) fossil_panic("out of memory");
103103
memset(a, 0, nLine*sizeof(a[0]) );
104
+ if( n==0 ){
105
+ *pnLine = 0;
106
+ return a;
107
+ }
104108
105109
/* Fill in the array */
106110
for(i=0; i<nLine; i++){
107111
a[i].z = z;
108112
for(j=0; z[j] && z[j]!='\n'; j++){}
109113
k = j;
110
- while( ignoreWS && k>0 && isspace(z[k-1]) ){ k--; }
114
+ while( ignoreWS && k>0 && fossil_isspace(z[k-1]) ){ k--; }
111115
for(h=0, x=0; x<k; x++){
112116
h = h ^ (h<<2) ^ z[x];
113117
}
114118
a[i].h = h = (h<<LENGTH_MASK_SZ) | k;;
115119
h2 = h % nLine;
116120
--- src/diff.c
+++ src/diff.c
@@ -99,17 +99,21 @@
99 return 0;
100 }
101 a = malloc( nLine*sizeof(a[0]) );
102 if( a==0 ) fossil_panic("out of memory");
103 memset(a, 0, nLine*sizeof(a[0]) );
 
 
 
 
104
105 /* Fill in the array */
106 for(i=0; i<nLine; i++){
107 a[i].z = z;
108 for(j=0; z[j] && z[j]!='\n'; j++){}
109 k = j;
110 while( ignoreWS && k>0 && isspace(z[k-1]) ){ k--; }
111 for(h=0, x=0; x<k; x++){
112 h = h ^ (h<<2) ^ z[x];
113 }
114 a[i].h = h = (h<<LENGTH_MASK_SZ) | k;;
115 h2 = h % nLine;
116
--- src/diff.c
+++ src/diff.c
@@ -99,17 +99,21 @@
99 return 0;
100 }
101 a = malloc( nLine*sizeof(a[0]) );
102 if( a==0 ) fossil_panic("out of memory");
103 memset(a, 0, nLine*sizeof(a[0]) );
104 if( n==0 ){
105 *pnLine = 0;
106 return a;
107 }
108
109 /* Fill in the array */
110 for(i=0; i<nLine; i++){
111 a[i].z = z;
112 for(j=0; z[j] && z[j]!='\n'; j++){}
113 k = j;
114 while( ignoreWS && k>0 && fossil_isspace(z[k-1]) ){ k--; }
115 for(h=0, x=0; x<k; x++){
116 h = h ^ (h<<2) ^ z[x];
117 }
118 a[i].h = h = (h<<LENGTH_MASK_SZ) | k;;
119 h2 = h % nLine;
120
+88 -26
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -19,10 +19,16 @@
1919
*/
2020
#include "config.h"
2121
#include "diffcmd.h"
2222
#include <assert.h>
2323
24
+/*
25
+** Diff option flags
26
+*/
27
+#define DIFF_NEWFILE 0x01 /* Treat non-existing fails as empty files */
28
+#define DIFF_NOEOLWS 0x02 /* Ignore whitespace at the end of lines */
29
+
2430
/*
2531
** This function implements a cross-platform "system()" interface.
2632
*/
2733
int portable_system(const char *zOrigCmd){
2834
int rc;
@@ -53,24 +59,30 @@
5359
static void diff_file(
5460
Blob *pFile1, /* In memory content to compare from */
5561
const char *zFile2, /* On disk content to compare to */
5662
const char *zName, /* Display name of the file */
5763
const char *zDiffCmd, /* Command for comparison */
58
- int ignoreEolWs /* Ignore whitespace at end of lines */
64
+ int ignoreEolWs /* Ignore whitespace at end of line */
5965
){
6066
if( zDiffCmd==0 ){
61
- Blob out; /* Diff output text */
62
- Blob file2; /* Content of zFile2 */
67
+ Blob out; /* Diff output text */
68
+ Blob file2; /* Content of zFile2 */
69
+ const char *zName2; /* Name of zFile2 for display */
6370
6471
/* Read content of zFile2 into memory */
6572
blob_zero(&file2);
66
- blob_read_from_file(&file2, zFile2);
73
+ if( file_size(zFile2)<0 ){
74
+ zName2 = "/dev/null";
75
+ }else{
76
+ blob_read_from_file(&file2, zFile2);
77
+ zName2 = zName;
78
+ }
6779
6880
/* Compute and output the differences */
6981
blob_zero(&out);
7082
text_diff(pFile1, &file2, &out, 5, ignoreEolWs);
71
- printf("--- %s\n+++ %s\n", zName, zName);
83
+ printf("--- %s\n+++ %s\n", zName, zName2);
7284
printf("%s\n", blob_str(&out));
7385
7486
/* Release memory resources */
7587
blob_reset(&file2);
7688
blob_reset(&out);
@@ -183,16 +195,20 @@
183195
** files on disk and the check-out on which they are based.
184196
*/
185197
static void diff_all_against_disk(
186198
const char *zFrom, /* Version to difference from */
187199
const char *zDiffCmd, /* Use this diff command. NULL for built-in */
188
- int ignoreEolWs /* Ignore end-of-line whitespace */
200
+ int diffFlags /* Flags controlling diff output */
189201
){
190202
int vid;
191203
Blob sql;
192204
Stmt q;
205
+ int ignoreEolWs; /* Ignore end-of-line whitespace */
206
+ int asNewFile; /* Treat non-existant files as empty files */
193207
208
+ ignoreEolWs = (diffFlags & DIFF_NOEOLWS)!=0;
209
+ asNewFile = (diffFlags & DIFF_NEWFILE)!=0;
194210
vid = db_lget_int("checkout", 0);
195211
vfile_check_signature(vid, 1);
196212
blob_zero(&sql);
197213
db_begin_transaction();
198214
if( zFrom ){
@@ -235,23 +251,35 @@
235251
while( db_step(&q)==SQLITE_ROW ){
236252
const char *zPathname = db_column_text(&q,0);
237253
int isDeleted = db_column_int(&q, 1);
238254
int isChnged = db_column_int(&q,2);
239255
int isNew = db_column_int(&q,3);
256
+ int srcid = db_column_int(&q, 4);
240257
char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
258
+ int showDiff = 1;
241259
if( isDeleted ){
242260
printf("DELETED %s\n", zPathname);
261
+ if( !asNewFile ){ showDiff = 0; zFullName = "/dev/null"; }
243262
}else if( access(zFullName, 0) ){
244263
printf("MISSING %s\n", zPathname);
264
+ if( !asNewFile ){ showDiff = 0; }
245265
}else if( isNew ){
246266
printf("ADDED %s\n", zPathname);
267
+ srcid = 0;
268
+ if( !asNewFile ){ showDiff = 0; }
247269
}else if( isChnged==3 ){
248270
printf("ADDED_BY_MERGE %s\n", zPathname);
249
- }else{
250
- int srcid = db_column_int(&q, 4);
271
+ srcid = 0;
272
+ if( !asNewFile ){ showDiff = 0; }
273
+ }
274
+ if( showDiff ){
251275
Blob content;
252
- content_get(srcid, &content);
276
+ if( srcid>0 ){
277
+ content_get(srcid, &content);
278
+ }else{
279
+ blob_zero(&content);
280
+ }
253281
printf("Index: %s\n======================================="
254282
"============================\n",
255283
zPathname
256284
);
257285
diff_file(&content, zFullName, zPathname, zDiffCmd, ignoreEolWs);
@@ -284,27 +312,61 @@
284312
diff_file_mem(&v1, &v2, zName, zDiffCmd, ignoreEolWs);
285313
blob_reset(&v1);
286314
blob_reset(&v2);
287315
blob_reset(&fname);
288316
}
317
+
318
+/*
319
+** Show the difference between two files identified by ManifestFile
320
+** entries.
321
+*/
322
+static void diff_manifest_entry(
323
+ struct ManifestFile *pFrom,
324
+ struct ManifestFile *pTo,
325
+ const char *zDiffCmd,
326
+ int ignoreEolWs
327
+){
328
+ Blob f1, f2;
329
+ int rid;
330
+ const char *zName = pFrom ? pFrom->zName : pTo->zName;
331
+ printf("Index: %s\n======================================="
332
+ "============================\n", zName);
333
+ if( pFrom ){
334
+ rid = uuid_to_rid(pFrom->zUuid, 0);
335
+ content_get(rid, &f1);
336
+ }else{
337
+ blob_zero(&f1);
338
+ }
339
+ if( pTo ){
340
+ rid = uuid_to_rid(pTo->zUuid, 0);
341
+ content_get(rid, &f2);
342
+ }else{
343
+ blob_zero(&f2);
344
+ }
345
+ diff_file_mem(&f1, &f2, zName, zDiffCmd, ignoreEolWs);
346
+ blob_reset(&f1);
347
+ blob_reset(&f2);
348
+}
289349
290350
/*
291351
** Output the differences between two check-ins.
292352
*/
293353
static void diff_all_two_versions(
294354
const char *zFrom,
295355
const char *zTo,
296356
const char *zDiffCmd,
297
- int ignoreEolWs
357
+ int diffFlags
298358
){
299359
Manifest mFrom, mTo;
300360
int iFrom, iTo;
361
+ int ignoreEolWs = (diffFlags & DIFF_NOEOLWS)!=0 ? 1 : 0;
362
+ int asNewFlag = (diffFlags & DIFF_NEWFILE)!=0 ? 1 : 0;
301363
302364
manifest_from_name(zFrom, &mFrom);
303365
manifest_from_name(zTo, &mTo);
304366
iFrom = iTo = 0;
305
- while( iFrom<mFrom.nFile && iTo<mTo.nFile ){
367
+ while( iFrom<mFrom.nFile || iTo<mTo.nFile ){
306368
int cmp;
307369
if( iFrom>=mFrom.nFile ){
308370
cmp = +1;
309371
}else if( iTo>=mTo.nFile ){
310372
cmp = -1;
@@ -311,33 +373,28 @@
311373
}else{
312374
cmp = strcmp(mFrom.aFile[iFrom].zName, mTo.aFile[iTo].zName);
313375
}
314376
if( cmp<0 ){
315377
printf("DELETED %s\n", mFrom.aFile[iFrom].zName);
378
+ if( asNewFlag ){
379
+ diff_manifest_entry(&mFrom.aFile[iFrom], 0, zDiffCmd, ignoreEolWs);
380
+ }
316381
iFrom++;
317382
}else if( cmp>0 ){
318383
printf("ADDED %s\n", mTo.aFile[iTo].zName);
384
+ if( asNewFlag ){
385
+ diff_manifest_entry(0, &mTo.aFile[iTo], zDiffCmd, ignoreEolWs);
386
+ }
319387
iTo++;
320388
}else if( strcmp(mFrom.aFile[iFrom].zUuid, mTo.aFile[iTo].zUuid)==0 ){
321389
/* No changes */
322390
iFrom++;
323391
iTo++;
324392
}else{
325
- Blob f1, f2;
326
- int rid;
327393
printf("CHANGED %s\n", mFrom.aFile[iFrom].zName);
328
- printf("Index: %s\n======================================="
329
- "============================\n",
330
- mFrom.aFile[iFrom].zName
331
- );
332
- rid = uuid_to_rid(mFrom.aFile[iFrom].zUuid, 0);
333
- content_get(rid, &f1);
334
- rid = uuid_to_rid(mTo.aFile[iTo].zUuid, 0);
335
- content_get(rid, &f2);
336
- diff_file_mem(&f1, &f2, mFrom.aFile[iFrom].zName, zDiffCmd, ignoreEolWs);
337
- blob_reset(&f1);
338
- blob_reset(&f2);
394
+ diff_manifest_entry(&mFrom.aFile[iFrom], &mTo.aFile[iTo],
395
+ zDiffCmd, ignoreEolWs);
339396
iFrom++;
340397
iTo++;
341398
}
342399
}
343400
manifest_clear(&mFrom);
@@ -375,29 +432,34 @@
375432
** 2. use the "diff against another version" link on the Check-in detail view.
376433
*/
377434
void diff_cmd(void){
378435
int isGDiff; /* True for gdiff. False for normal diff */
379436
int isInternDiff; /* True for internal diff */
437
+ int hasNFlag; /* True if -N or --new-file flag is used */
380438
const char *zFrom; /* Source version number */
381439
const char *zTo; /* Target version number */
382440
const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
441
+ int diffFlags = 0; /* Flags to control the DIFF */
383442
384443
isGDiff = g.argv[1][0]=='g';
385444
isInternDiff = find_option("internal","i",0)!=0;
386445
zFrom = find_option("from", "r", 1);
387446
zTo = find_option("to", 0, 1);
447
+ hasNFlag = find_option("new-file","N",0)!=0;
448
+
388449
450
+ if( hasNFlag ) diffFlags |= DIFF_NEWFILE;
389451
if( zTo==0 ){
390452
db_must_be_within_tree();
391453
verify_all_options();
392454
if( !isInternDiff ){
393455
zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
394456
}
395457
if( g.argc==3 ){
396458
diff_one_against_disk(zFrom, zDiffCmd, 0);
397459
}else{
398
- diff_all_against_disk(zFrom, zDiffCmd, 0);
460
+ diff_all_against_disk(zFrom, zDiffCmd, diffFlags);
399461
}
400462
}else if( zFrom==0 ){
401463
fossil_fatal("must use --from if --to is present");
402464
}else{
403465
db_find_and_open_repository(1);
@@ -406,9 +468,9 @@
406468
zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
407469
}
408470
if( g.argc==3 ){
409471
diff_one_two_versions(zFrom, zTo, zDiffCmd, 0);
410472
}else{
411
- diff_all_two_versions(zFrom, zTo, zDiffCmd, 0);
473
+ diff_all_two_versions(zFrom, zTo, zDiffCmd, diffFlags);
412474
}
413475
}
414476
}
415477
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -19,10 +19,16 @@
19 */
20 #include "config.h"
21 #include "diffcmd.h"
22 #include <assert.h>
23
 
 
 
 
 
 
24 /*
25 ** This function implements a cross-platform "system()" interface.
26 */
27 int portable_system(const char *zOrigCmd){
28 int rc;
@@ -53,24 +59,30 @@
53 static void diff_file(
54 Blob *pFile1, /* In memory content to compare from */
55 const char *zFile2, /* On disk content to compare to */
56 const char *zName, /* Display name of the file */
57 const char *zDiffCmd, /* Command for comparison */
58 int ignoreEolWs /* Ignore whitespace at end of lines */
59 ){
60 if( zDiffCmd==0 ){
61 Blob out; /* Diff output text */
62 Blob file2; /* Content of zFile2 */
 
63
64 /* Read content of zFile2 into memory */
65 blob_zero(&file2);
66 blob_read_from_file(&file2, zFile2);
 
 
 
 
 
67
68 /* Compute and output the differences */
69 blob_zero(&out);
70 text_diff(pFile1, &file2, &out, 5, ignoreEolWs);
71 printf("--- %s\n+++ %s\n", zName, zName);
72 printf("%s\n", blob_str(&out));
73
74 /* Release memory resources */
75 blob_reset(&file2);
76 blob_reset(&out);
@@ -183,16 +195,20 @@
183 ** files on disk and the check-out on which they are based.
184 */
185 static void diff_all_against_disk(
186 const char *zFrom, /* Version to difference from */
187 const char *zDiffCmd, /* Use this diff command. NULL for built-in */
188 int ignoreEolWs /* Ignore end-of-line whitespace */
189 ){
190 int vid;
191 Blob sql;
192 Stmt q;
 
 
193
 
 
194 vid = db_lget_int("checkout", 0);
195 vfile_check_signature(vid, 1);
196 blob_zero(&sql);
197 db_begin_transaction();
198 if( zFrom ){
@@ -235,23 +251,35 @@
235 while( db_step(&q)==SQLITE_ROW ){
236 const char *zPathname = db_column_text(&q,0);
237 int isDeleted = db_column_int(&q, 1);
238 int isChnged = db_column_int(&q,2);
239 int isNew = db_column_int(&q,3);
 
240 char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
 
241 if( isDeleted ){
242 printf("DELETED %s\n", zPathname);
 
243 }else if( access(zFullName, 0) ){
244 printf("MISSING %s\n", zPathname);
 
245 }else if( isNew ){
246 printf("ADDED %s\n", zPathname);
 
 
247 }else if( isChnged==3 ){
248 printf("ADDED_BY_MERGE %s\n", zPathname);
249 }else{
250 int srcid = db_column_int(&q, 4);
 
 
251 Blob content;
252 content_get(srcid, &content);
 
 
 
 
253 printf("Index: %s\n======================================="
254 "============================\n",
255 zPathname
256 );
257 diff_file(&content, zFullName, zPathname, zDiffCmd, ignoreEolWs);
@@ -284,27 +312,61 @@
284 diff_file_mem(&v1, &v2, zName, zDiffCmd, ignoreEolWs);
285 blob_reset(&v1);
286 blob_reset(&v2);
287 blob_reset(&fname);
288 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
290 /*
291 ** Output the differences between two check-ins.
292 */
293 static void diff_all_two_versions(
294 const char *zFrom,
295 const char *zTo,
296 const char *zDiffCmd,
297 int ignoreEolWs
298 ){
299 Manifest mFrom, mTo;
300 int iFrom, iTo;
 
 
301
302 manifest_from_name(zFrom, &mFrom);
303 manifest_from_name(zTo, &mTo);
304 iFrom = iTo = 0;
305 while( iFrom<mFrom.nFile && iTo<mTo.nFile ){
306 int cmp;
307 if( iFrom>=mFrom.nFile ){
308 cmp = +1;
309 }else if( iTo>=mTo.nFile ){
310 cmp = -1;
@@ -311,33 +373,28 @@
311 }else{
312 cmp = strcmp(mFrom.aFile[iFrom].zName, mTo.aFile[iTo].zName);
313 }
314 if( cmp<0 ){
315 printf("DELETED %s\n", mFrom.aFile[iFrom].zName);
 
 
 
316 iFrom++;
317 }else if( cmp>0 ){
318 printf("ADDED %s\n", mTo.aFile[iTo].zName);
 
 
 
319 iTo++;
320 }else if( strcmp(mFrom.aFile[iFrom].zUuid, mTo.aFile[iTo].zUuid)==0 ){
321 /* No changes */
322 iFrom++;
323 iTo++;
324 }else{
325 Blob f1, f2;
326 int rid;
327 printf("CHANGED %s\n", mFrom.aFile[iFrom].zName);
328 printf("Index: %s\n======================================="
329 "============================\n",
330 mFrom.aFile[iFrom].zName
331 );
332 rid = uuid_to_rid(mFrom.aFile[iFrom].zUuid, 0);
333 content_get(rid, &f1);
334 rid = uuid_to_rid(mTo.aFile[iTo].zUuid, 0);
335 content_get(rid, &f2);
336 diff_file_mem(&f1, &f2, mFrom.aFile[iFrom].zName, zDiffCmd, ignoreEolWs);
337 blob_reset(&f1);
338 blob_reset(&f2);
339 iFrom++;
340 iTo++;
341 }
342 }
343 manifest_clear(&mFrom);
@@ -375,29 +432,34 @@
375 ** 2. use the "diff against another version" link on the Check-in detail view.
376 */
377 void diff_cmd(void){
378 int isGDiff; /* True for gdiff. False for normal diff */
379 int isInternDiff; /* True for internal diff */
 
380 const char *zFrom; /* Source version number */
381 const char *zTo; /* Target version number */
382 const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
 
383
384 isGDiff = g.argv[1][0]=='g';
385 isInternDiff = find_option("internal","i",0)!=0;
386 zFrom = find_option("from", "r", 1);
387 zTo = find_option("to", 0, 1);
 
 
388
 
389 if( zTo==0 ){
390 db_must_be_within_tree();
391 verify_all_options();
392 if( !isInternDiff ){
393 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
394 }
395 if( g.argc==3 ){
396 diff_one_against_disk(zFrom, zDiffCmd, 0);
397 }else{
398 diff_all_against_disk(zFrom, zDiffCmd, 0);
399 }
400 }else if( zFrom==0 ){
401 fossil_fatal("must use --from if --to is present");
402 }else{
403 db_find_and_open_repository(1);
@@ -406,9 +468,9 @@
406 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
407 }
408 if( g.argc==3 ){
409 diff_one_two_versions(zFrom, zTo, zDiffCmd, 0);
410 }else{
411 diff_all_two_versions(zFrom, zTo, zDiffCmd, 0);
412 }
413 }
414 }
415
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -19,10 +19,16 @@
19 */
20 #include "config.h"
21 #include "diffcmd.h"
22 #include <assert.h>
23
24 /*
25 ** Diff option flags
26 */
27 #define DIFF_NEWFILE 0x01 /* Treat non-existing fails as empty files */
28 #define DIFF_NOEOLWS 0x02 /* Ignore whitespace at the end of lines */
29
30 /*
31 ** This function implements a cross-platform "system()" interface.
32 */
33 int portable_system(const char *zOrigCmd){
34 int rc;
@@ -53,24 +59,30 @@
59 static void diff_file(
60 Blob *pFile1, /* In memory content to compare from */
61 const char *zFile2, /* On disk content to compare to */
62 const char *zName, /* Display name of the file */
63 const char *zDiffCmd, /* Command for comparison */
64 int ignoreEolWs /* Ignore whitespace at end of line */
65 ){
66 if( zDiffCmd==0 ){
67 Blob out; /* Diff output text */
68 Blob file2; /* Content of zFile2 */
69 const char *zName2; /* Name of zFile2 for display */
70
71 /* Read content of zFile2 into memory */
72 blob_zero(&file2);
73 if( file_size(zFile2)<0 ){
74 zName2 = "/dev/null";
75 }else{
76 blob_read_from_file(&file2, zFile2);
77 zName2 = zName;
78 }
79
80 /* Compute and output the differences */
81 blob_zero(&out);
82 text_diff(pFile1, &file2, &out, 5, ignoreEolWs);
83 printf("--- %s\n+++ %s\n", zName, zName2);
84 printf("%s\n", blob_str(&out));
85
86 /* Release memory resources */
87 blob_reset(&file2);
88 blob_reset(&out);
@@ -183,16 +195,20 @@
195 ** files on disk and the check-out on which they are based.
196 */
197 static void diff_all_against_disk(
198 const char *zFrom, /* Version to difference from */
199 const char *zDiffCmd, /* Use this diff command. NULL for built-in */
200 int diffFlags /* Flags controlling diff output */
201 ){
202 int vid;
203 Blob sql;
204 Stmt q;
205 int ignoreEolWs; /* Ignore end-of-line whitespace */
206 int asNewFile; /* Treat non-existant files as empty files */
207
208 ignoreEolWs = (diffFlags & DIFF_NOEOLWS)!=0;
209 asNewFile = (diffFlags & DIFF_NEWFILE)!=0;
210 vid = db_lget_int("checkout", 0);
211 vfile_check_signature(vid, 1);
212 blob_zero(&sql);
213 db_begin_transaction();
214 if( zFrom ){
@@ -235,23 +251,35 @@
251 while( db_step(&q)==SQLITE_ROW ){
252 const char *zPathname = db_column_text(&q,0);
253 int isDeleted = db_column_int(&q, 1);
254 int isChnged = db_column_int(&q,2);
255 int isNew = db_column_int(&q,3);
256 int srcid = db_column_int(&q, 4);
257 char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
258 int showDiff = 1;
259 if( isDeleted ){
260 printf("DELETED %s\n", zPathname);
261 if( !asNewFile ){ showDiff = 0; zFullName = "/dev/null"; }
262 }else if( access(zFullName, 0) ){
263 printf("MISSING %s\n", zPathname);
264 if( !asNewFile ){ showDiff = 0; }
265 }else if( isNew ){
266 printf("ADDED %s\n", zPathname);
267 srcid = 0;
268 if( !asNewFile ){ showDiff = 0; }
269 }else if( isChnged==3 ){
270 printf("ADDED_BY_MERGE %s\n", zPathname);
271 srcid = 0;
272 if( !asNewFile ){ showDiff = 0; }
273 }
274 if( showDiff ){
275 Blob content;
276 if( srcid>0 ){
277 content_get(srcid, &content);
278 }else{
279 blob_zero(&content);
280 }
281 printf("Index: %s\n======================================="
282 "============================\n",
283 zPathname
284 );
285 diff_file(&content, zFullName, zPathname, zDiffCmd, ignoreEolWs);
@@ -284,27 +312,61 @@
312 diff_file_mem(&v1, &v2, zName, zDiffCmd, ignoreEolWs);
313 blob_reset(&v1);
314 blob_reset(&v2);
315 blob_reset(&fname);
316 }
317
318 /*
319 ** Show the difference between two files identified by ManifestFile
320 ** entries.
321 */
322 static void diff_manifest_entry(
323 struct ManifestFile *pFrom,
324 struct ManifestFile *pTo,
325 const char *zDiffCmd,
326 int ignoreEolWs
327 ){
328 Blob f1, f2;
329 int rid;
330 const char *zName = pFrom ? pFrom->zName : pTo->zName;
331 printf("Index: %s\n======================================="
332 "============================\n", zName);
333 if( pFrom ){
334 rid = uuid_to_rid(pFrom->zUuid, 0);
335 content_get(rid, &f1);
336 }else{
337 blob_zero(&f1);
338 }
339 if( pTo ){
340 rid = uuid_to_rid(pTo->zUuid, 0);
341 content_get(rid, &f2);
342 }else{
343 blob_zero(&f2);
344 }
345 diff_file_mem(&f1, &f2, zName, zDiffCmd, ignoreEolWs);
346 blob_reset(&f1);
347 blob_reset(&f2);
348 }
349
350 /*
351 ** Output the differences between two check-ins.
352 */
353 static void diff_all_two_versions(
354 const char *zFrom,
355 const char *zTo,
356 const char *zDiffCmd,
357 int diffFlags
358 ){
359 Manifest mFrom, mTo;
360 int iFrom, iTo;
361 int ignoreEolWs = (diffFlags & DIFF_NOEOLWS)!=0 ? 1 : 0;
362 int asNewFlag = (diffFlags & DIFF_NEWFILE)!=0 ? 1 : 0;
363
364 manifest_from_name(zFrom, &mFrom);
365 manifest_from_name(zTo, &mTo);
366 iFrom = iTo = 0;
367 while( iFrom<mFrom.nFile || iTo<mTo.nFile ){
368 int cmp;
369 if( iFrom>=mFrom.nFile ){
370 cmp = +1;
371 }else if( iTo>=mTo.nFile ){
372 cmp = -1;
@@ -311,33 +373,28 @@
373 }else{
374 cmp = strcmp(mFrom.aFile[iFrom].zName, mTo.aFile[iTo].zName);
375 }
376 if( cmp<0 ){
377 printf("DELETED %s\n", mFrom.aFile[iFrom].zName);
378 if( asNewFlag ){
379 diff_manifest_entry(&mFrom.aFile[iFrom], 0, zDiffCmd, ignoreEolWs);
380 }
381 iFrom++;
382 }else if( cmp>0 ){
383 printf("ADDED %s\n", mTo.aFile[iTo].zName);
384 if( asNewFlag ){
385 diff_manifest_entry(0, &mTo.aFile[iTo], zDiffCmd, ignoreEolWs);
386 }
387 iTo++;
388 }else if( strcmp(mFrom.aFile[iFrom].zUuid, mTo.aFile[iTo].zUuid)==0 ){
389 /* No changes */
390 iFrom++;
391 iTo++;
392 }else{
 
 
393 printf("CHANGED %s\n", mFrom.aFile[iFrom].zName);
394 diff_manifest_entry(&mFrom.aFile[iFrom], &mTo.aFile[iTo],
395 zDiffCmd, ignoreEolWs);
 
 
 
 
 
 
 
 
 
396 iFrom++;
397 iTo++;
398 }
399 }
400 manifest_clear(&mFrom);
@@ -375,29 +432,34 @@
432 ** 2. use the "diff against another version" link on the Check-in detail view.
433 */
434 void diff_cmd(void){
435 int isGDiff; /* True for gdiff. False for normal diff */
436 int isInternDiff; /* True for internal diff */
437 int hasNFlag; /* True if -N or --new-file flag is used */
438 const char *zFrom; /* Source version number */
439 const char *zTo; /* Target version number */
440 const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
441 int diffFlags = 0; /* Flags to control the DIFF */
442
443 isGDiff = g.argv[1][0]=='g';
444 isInternDiff = find_option("internal","i",0)!=0;
445 zFrom = find_option("from", "r", 1);
446 zTo = find_option("to", 0, 1);
447 hasNFlag = find_option("new-file","N",0)!=0;
448
449
450 if( hasNFlag ) diffFlags |= DIFF_NEWFILE;
451 if( zTo==0 ){
452 db_must_be_within_tree();
453 verify_all_options();
454 if( !isInternDiff ){
455 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
456 }
457 if( g.argc==3 ){
458 diff_one_against_disk(zFrom, zDiffCmd, 0);
459 }else{
460 diff_all_against_disk(zFrom, zDiffCmd, diffFlags);
461 }
462 }else if( zFrom==0 ){
463 fossil_fatal("must use --from if --to is present");
464 }else{
465 db_find_and_open_repository(1);
@@ -406,9 +468,9 @@
468 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
469 }
470 if( g.argc==3 ){
471 diff_one_two_versions(zFrom, zTo, zDiffCmd, 0);
472 }else{
473 diff_all_two_versions(zFrom, zTo, zDiffCmd, diffFlags);
474 }
475 }
476 }
477
+88 -26
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -19,10 +19,16 @@
1919
*/
2020
#include "config.h"
2121
#include "diffcmd.h"
2222
#include <assert.h>
2323
24
+/*
25
+** Diff option flags
26
+*/
27
+#define DIFF_NEWFILE 0x01 /* Treat non-existing fails as empty files */
28
+#define DIFF_NOEOLWS 0x02 /* Ignore whitespace at the end of lines */
29
+
2430
/*
2531
** This function implements a cross-platform "system()" interface.
2632
*/
2733
int portable_system(const char *zOrigCmd){
2834
int rc;
@@ -53,24 +59,30 @@
5359
static void diff_file(
5460
Blob *pFile1, /* In memory content to compare from */
5561
const char *zFile2, /* On disk content to compare to */
5662
const char *zName, /* Display name of the file */
5763
const char *zDiffCmd, /* Command for comparison */
58
- int ignoreEolWs /* Ignore whitespace at end of lines */
64
+ int ignoreEolWs /* Ignore whitespace at end of line */
5965
){
6066
if( zDiffCmd==0 ){
61
- Blob out; /* Diff output text */
62
- Blob file2; /* Content of zFile2 */
67
+ Blob out; /* Diff output text */
68
+ Blob file2; /* Content of zFile2 */
69
+ const char *zName2; /* Name of zFile2 for display */
6370
6471
/* Read content of zFile2 into memory */
6572
blob_zero(&file2);
66
- blob_read_from_file(&file2, zFile2);
73
+ if( file_size(zFile2)<0 ){
74
+ zName2 = "/dev/null";
75
+ }else{
76
+ blob_read_from_file(&file2, zFile2);
77
+ zName2 = zName;
78
+ }
6779
6880
/* Compute and output the differences */
6981
blob_zero(&out);
7082
text_diff(pFile1, &file2, &out, 5, ignoreEolWs);
71
- printf("--- %s\n+++ %s\n", zName, zName);
83
+ printf("--- %s\n+++ %s\n", zName, zName2);
7284
printf("%s\n", blob_str(&out));
7385
7486
/* Release memory resources */
7587
blob_reset(&file2);
7688
blob_reset(&out);
@@ -183,16 +195,20 @@
183195
** files on disk and the check-out on which they are based.
184196
*/
185197
static void diff_all_against_disk(
186198
const char *zFrom, /* Version to difference from */
187199
const char *zDiffCmd, /* Use this diff command. NULL for built-in */
188
- int ignoreEolWs /* Ignore end-of-line whitespace */
200
+ int diffFlags /* Flags controlling diff output */
189201
){
190202
int vid;
191203
Blob sql;
192204
Stmt q;
205
+ int ignoreEolWs; /* Ignore end-of-line whitespace */
206
+ int asNewFile; /* Treat non-existant files as empty files */
193207
208
+ ignoreEolWs = (diffFlags & DIFF_NOEOLWS)!=0;
209
+ asNewFile = (diffFlags & DIFF_NEWFILE)!=0;
194210
vid = db_lget_int("checkout", 0);
195211
vfile_check_signature(vid, 1);
196212
blob_zero(&sql);
197213
db_begin_transaction();
198214
if( zFrom ){
@@ -235,23 +251,35 @@
235251
while( db_step(&q)==SQLITE_ROW ){
236252
const char *zPathname = db_column_text(&q,0);
237253
int isDeleted = db_column_int(&q, 1);
238254
int isChnged = db_column_int(&q,2);
239255
int isNew = db_column_int(&q,3);
256
+ int srcid = db_column_int(&q, 4);
240257
char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
258
+ int showDiff = 1;
241259
if( isDeleted ){
242260
printf("DELETED %s\n", zPathname);
261
+ if( !asNewFile ){ showDiff = 0; zFullName = "/dev/null"; }
243262
}else if( access(zFullName, 0) ){
244263
printf("MISSING %s\n", zPathname);
264
+ if( !asNewFile ){ showDiff = 0; }
245265
}else if( isNew ){
246266
printf("ADDED %s\n", zPathname);
267
+ srcid = 0;
268
+ if( !asNewFile ){ showDiff = 0; }
247269
}else if( isChnged==3 ){
248270
printf("ADDED_BY_MERGE %s\n", zPathname);
249
- }else{
250
- int srcid = db_column_int(&q, 4);
271
+ srcid = 0;
272
+ if( !asNewFile ){ showDiff = 0; }
273
+ }
274
+ if( showDiff ){
251275
Blob content;
252
- content_get(srcid, &content);
276
+ if( srcid>0 ){
277
+ content_get(srcid, &content);
278
+ }else{
279
+ blob_zero(&content);
280
+ }
253281
printf("Index: %s\n======================================="
254282
"============================\n",
255283
zPathname
256284
);
257285
diff_file(&content, zFullName, zPathname, zDiffCmd, ignoreEolWs);
@@ -284,27 +312,61 @@
284312
diff_file_mem(&v1, &v2, zName, zDiffCmd, ignoreEolWs);
285313
blob_reset(&v1);
286314
blob_reset(&v2);
287315
blob_reset(&fname);
288316
}
317
+
318
+/*
319
+** Show the difference between two files identified by ManifestFile
320
+** entries.
321
+*/
322
+static void diff_manifest_entry(
323
+ struct ManifestFile *pFrom,
324
+ struct ManifestFile *pTo,
325
+ const char *zDiffCmd,
326
+ int ignoreEolWs
327
+){
328
+ Blob f1, f2;
329
+ int rid;
330
+ const char *zName = pFrom ? pFrom->zName : pTo->zName;
331
+ printf("Index: %s\n======================================="
332
+ "============================\n", zName);
333
+ if( pFrom ){
334
+ rid = uuid_to_rid(pFrom->zUuid, 0);
335
+ content_get(rid, &f1);
336
+ }else{
337
+ blob_zero(&f1);
338
+ }
339
+ if( pTo ){
340
+ rid = uuid_to_rid(pTo->zUuid, 0);
341
+ content_get(rid, &f2);
342
+ }else{
343
+ blob_zero(&f2);
344
+ }
345
+ diff_file_mem(&f1, &f2, zName, zDiffCmd, ignoreEolWs);
346
+ blob_reset(&f1);
347
+ blob_reset(&f2);
348
+}
289349
290350
/*
291351
** Output the differences between two check-ins.
292352
*/
293353
static void diff_all_two_versions(
294354
const char *zFrom,
295355
const char *zTo,
296356
const char *zDiffCmd,
297
- int ignoreEolWs
357
+ int diffFlags
298358
){
299359
Manifest mFrom, mTo;
300360
int iFrom, iTo;
361
+ int ignoreEolWs = (diffFlags & DIFF_NOEOLWS)!=0 ? 1 : 0;
362
+ int asNewFlag = (diffFlags & DIFF_NEWFILE)!=0 ? 1 : 0;
301363
302364
manifest_from_name(zFrom, &mFrom);
303365
manifest_from_name(zTo, &mTo);
304366
iFrom = iTo = 0;
305
- while( iFrom<mFrom.nFile && iTo<mTo.nFile ){
367
+ while( iFrom<mFrom.nFile || iTo<mTo.nFile ){
306368
int cmp;
307369
if( iFrom>=mFrom.nFile ){
308370
cmp = +1;
309371
}else if( iTo>=mTo.nFile ){
310372
cmp = -1;
@@ -311,33 +373,28 @@
311373
}else{
312374
cmp = strcmp(mFrom.aFile[iFrom].zName, mTo.aFile[iTo].zName);
313375
}
314376
if( cmp<0 ){
315377
printf("DELETED %s\n", mFrom.aFile[iFrom].zName);
378
+ if( asNewFlag ){
379
+ diff_manifest_entry(&mFrom.aFile[iFrom], 0, zDiffCmd, ignoreEolWs);
380
+ }
316381
iFrom++;
317382
}else if( cmp>0 ){
318383
printf("ADDED %s\n", mTo.aFile[iTo].zName);
384
+ if( asNewFlag ){
385
+ diff_manifest_entry(0, &mTo.aFile[iTo], zDiffCmd, ignoreEolWs);
386
+ }
319387
iTo++;
320388
}else if( strcmp(mFrom.aFile[iFrom].zUuid, mTo.aFile[iTo].zUuid)==0 ){
321389
/* No changes */
322390
iFrom++;
323391
iTo++;
324392
}else{
325
- Blob f1, f2;
326
- int rid;
327393
printf("CHANGED %s\n", mFrom.aFile[iFrom].zName);
328
- printf("Index: %s\n======================================="
329
- "============================\n",
330
- mFrom.aFile[iFrom].zName
331
- );
332
- rid = uuid_to_rid(mFrom.aFile[iFrom].zUuid, 0);
333
- content_get(rid, &f1);
334
- rid = uuid_to_rid(mTo.aFile[iTo].zUuid, 0);
335
- content_get(rid, &f2);
336
- diff_file_mem(&f1, &f2, mFrom.aFile[iFrom].zName, zDiffCmd, ignoreEolWs);
337
- blob_reset(&f1);
338
- blob_reset(&f2);
394
+ diff_manifest_entry(&mFrom.aFile[iFrom], &mTo.aFile[iTo],
395
+ zDiffCmd, ignoreEolWs);
339396
iFrom++;
340397
iTo++;
341398
}
342399
}
343400
manifest_clear(&mFrom);
@@ -375,29 +432,34 @@
375432
** 2. use the "diff against another version" link on the Check-in detail view.
376433
*/
377434
void diff_cmd(void){
378435
int isGDiff; /* True for gdiff. False for normal diff */
379436
int isInternDiff; /* True for internal diff */
437
+ int hasNFlag; /* True if -N or --new-file flag is used */
380438
const char *zFrom; /* Source version number */
381439
const char *zTo; /* Target version number */
382440
const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
441
+ int diffFlags = 0; /* Flags to control the DIFF */
383442
384443
isGDiff = g.argv[1][0]=='g';
385444
isInternDiff = find_option("internal","i",0)!=0;
386445
zFrom = find_option("from", "r", 1);
387446
zTo = find_option("to", 0, 1);
447
+ hasNFlag = find_option("new-file","N",0)!=0;
448
+
388449
450
+ if( hasNFlag ) diffFlags |= DIFF_NEWFILE;
389451
if( zTo==0 ){
390452
db_must_be_within_tree();
391453
verify_all_options();
392454
if( !isInternDiff ){
393455
zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
394456
}
395457
if( g.argc==3 ){
396458
diff_one_against_disk(zFrom, zDiffCmd, 0);
397459
}else{
398
- diff_all_against_disk(zFrom, zDiffCmd, 0);
460
+ diff_all_against_disk(zFrom, zDiffCmd, diffFlags);
399461
}
400462
}else if( zFrom==0 ){
401463
fossil_fatal("must use --from if --to is present");
402464
}else{
403465
db_find_and_open_repository(1);
@@ -406,9 +468,9 @@
406468
zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
407469
}
408470
if( g.argc==3 ){
409471
diff_one_two_versions(zFrom, zTo, zDiffCmd, 0);
410472
}else{
411
- diff_all_two_versions(zFrom, zTo, zDiffCmd, 0);
473
+ diff_all_two_versions(zFrom, zTo, zDiffCmd, diffFlags);
412474
}
413475
}
414476
}
415477
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -19,10 +19,16 @@
19 */
20 #include "config.h"
21 #include "diffcmd.h"
22 #include <assert.h>
23
 
 
 
 
 
 
24 /*
25 ** This function implements a cross-platform "system()" interface.
26 */
27 int portable_system(const char *zOrigCmd){
28 int rc;
@@ -53,24 +59,30 @@
53 static void diff_file(
54 Blob *pFile1, /* In memory content to compare from */
55 const char *zFile2, /* On disk content to compare to */
56 const char *zName, /* Display name of the file */
57 const char *zDiffCmd, /* Command for comparison */
58 int ignoreEolWs /* Ignore whitespace at end of lines */
59 ){
60 if( zDiffCmd==0 ){
61 Blob out; /* Diff output text */
62 Blob file2; /* Content of zFile2 */
 
63
64 /* Read content of zFile2 into memory */
65 blob_zero(&file2);
66 blob_read_from_file(&file2, zFile2);
 
 
 
 
 
67
68 /* Compute and output the differences */
69 blob_zero(&out);
70 text_diff(pFile1, &file2, &out, 5, ignoreEolWs);
71 printf("--- %s\n+++ %s\n", zName, zName);
72 printf("%s\n", blob_str(&out));
73
74 /* Release memory resources */
75 blob_reset(&file2);
76 blob_reset(&out);
@@ -183,16 +195,20 @@
183 ** files on disk and the check-out on which they are based.
184 */
185 static void diff_all_against_disk(
186 const char *zFrom, /* Version to difference from */
187 const char *zDiffCmd, /* Use this diff command. NULL for built-in */
188 int ignoreEolWs /* Ignore end-of-line whitespace */
189 ){
190 int vid;
191 Blob sql;
192 Stmt q;
 
 
193
 
 
194 vid = db_lget_int("checkout", 0);
195 vfile_check_signature(vid, 1);
196 blob_zero(&sql);
197 db_begin_transaction();
198 if( zFrom ){
@@ -235,23 +251,35 @@
235 while( db_step(&q)==SQLITE_ROW ){
236 const char *zPathname = db_column_text(&q,0);
237 int isDeleted = db_column_int(&q, 1);
238 int isChnged = db_column_int(&q,2);
239 int isNew = db_column_int(&q,3);
 
240 char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
 
241 if( isDeleted ){
242 printf("DELETED %s\n", zPathname);
 
243 }else if( access(zFullName, 0) ){
244 printf("MISSING %s\n", zPathname);
 
245 }else if( isNew ){
246 printf("ADDED %s\n", zPathname);
 
 
247 }else if( isChnged==3 ){
248 printf("ADDED_BY_MERGE %s\n", zPathname);
249 }else{
250 int srcid = db_column_int(&q, 4);
 
 
251 Blob content;
252 content_get(srcid, &content);
 
 
 
 
253 printf("Index: %s\n======================================="
254 "============================\n",
255 zPathname
256 );
257 diff_file(&content, zFullName, zPathname, zDiffCmd, ignoreEolWs);
@@ -284,27 +312,61 @@
284 diff_file_mem(&v1, &v2, zName, zDiffCmd, ignoreEolWs);
285 blob_reset(&v1);
286 blob_reset(&v2);
287 blob_reset(&fname);
288 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
290 /*
291 ** Output the differences between two check-ins.
292 */
293 static void diff_all_two_versions(
294 const char *zFrom,
295 const char *zTo,
296 const char *zDiffCmd,
297 int ignoreEolWs
298 ){
299 Manifest mFrom, mTo;
300 int iFrom, iTo;
 
 
301
302 manifest_from_name(zFrom, &mFrom);
303 manifest_from_name(zTo, &mTo);
304 iFrom = iTo = 0;
305 while( iFrom<mFrom.nFile && iTo<mTo.nFile ){
306 int cmp;
307 if( iFrom>=mFrom.nFile ){
308 cmp = +1;
309 }else if( iTo>=mTo.nFile ){
310 cmp = -1;
@@ -311,33 +373,28 @@
311 }else{
312 cmp = strcmp(mFrom.aFile[iFrom].zName, mTo.aFile[iTo].zName);
313 }
314 if( cmp<0 ){
315 printf("DELETED %s\n", mFrom.aFile[iFrom].zName);
 
 
 
316 iFrom++;
317 }else if( cmp>0 ){
318 printf("ADDED %s\n", mTo.aFile[iTo].zName);
 
 
 
319 iTo++;
320 }else if( strcmp(mFrom.aFile[iFrom].zUuid, mTo.aFile[iTo].zUuid)==0 ){
321 /* No changes */
322 iFrom++;
323 iTo++;
324 }else{
325 Blob f1, f2;
326 int rid;
327 printf("CHANGED %s\n", mFrom.aFile[iFrom].zName);
328 printf("Index: %s\n======================================="
329 "============================\n",
330 mFrom.aFile[iFrom].zName
331 );
332 rid = uuid_to_rid(mFrom.aFile[iFrom].zUuid, 0);
333 content_get(rid, &f1);
334 rid = uuid_to_rid(mTo.aFile[iTo].zUuid, 0);
335 content_get(rid, &f2);
336 diff_file_mem(&f1, &f2, mFrom.aFile[iFrom].zName, zDiffCmd, ignoreEolWs);
337 blob_reset(&f1);
338 blob_reset(&f2);
339 iFrom++;
340 iTo++;
341 }
342 }
343 manifest_clear(&mFrom);
@@ -375,29 +432,34 @@
375 ** 2. use the "diff against another version" link on the Check-in detail view.
376 */
377 void diff_cmd(void){
378 int isGDiff; /* True for gdiff. False for normal diff */
379 int isInternDiff; /* True for internal diff */
 
380 const char *zFrom; /* Source version number */
381 const char *zTo; /* Target version number */
382 const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
 
383
384 isGDiff = g.argv[1][0]=='g';
385 isInternDiff = find_option("internal","i",0)!=0;
386 zFrom = find_option("from", "r", 1);
387 zTo = find_option("to", 0, 1);
 
 
388
 
389 if( zTo==0 ){
390 db_must_be_within_tree();
391 verify_all_options();
392 if( !isInternDiff ){
393 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
394 }
395 if( g.argc==3 ){
396 diff_one_against_disk(zFrom, zDiffCmd, 0);
397 }else{
398 diff_all_against_disk(zFrom, zDiffCmd, 0);
399 }
400 }else if( zFrom==0 ){
401 fossil_fatal("must use --from if --to is present");
402 }else{
403 db_find_and_open_repository(1);
@@ -406,9 +468,9 @@
406 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
407 }
408 if( g.argc==3 ){
409 diff_one_two_versions(zFrom, zTo, zDiffCmd, 0);
410 }else{
411 diff_all_two_versions(zFrom, zTo, zDiffCmd, 0);
412 }
413 }
414 }
415
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -19,10 +19,16 @@
19 */
20 #include "config.h"
21 #include "diffcmd.h"
22 #include <assert.h>
23
24 /*
25 ** Diff option flags
26 */
27 #define DIFF_NEWFILE 0x01 /* Treat non-existing fails as empty files */
28 #define DIFF_NOEOLWS 0x02 /* Ignore whitespace at the end of lines */
29
30 /*
31 ** This function implements a cross-platform "system()" interface.
32 */
33 int portable_system(const char *zOrigCmd){
34 int rc;
@@ -53,24 +59,30 @@
59 static void diff_file(
60 Blob *pFile1, /* In memory content to compare from */
61 const char *zFile2, /* On disk content to compare to */
62 const char *zName, /* Display name of the file */
63 const char *zDiffCmd, /* Command for comparison */
64 int ignoreEolWs /* Ignore whitespace at end of line */
65 ){
66 if( zDiffCmd==0 ){
67 Blob out; /* Diff output text */
68 Blob file2; /* Content of zFile2 */
69 const char *zName2; /* Name of zFile2 for display */
70
71 /* Read content of zFile2 into memory */
72 blob_zero(&file2);
73 if( file_size(zFile2)<0 ){
74 zName2 = "/dev/null";
75 }else{
76 blob_read_from_file(&file2, zFile2);
77 zName2 = zName;
78 }
79
80 /* Compute and output the differences */
81 blob_zero(&out);
82 text_diff(pFile1, &file2, &out, 5, ignoreEolWs);
83 printf("--- %s\n+++ %s\n", zName, zName2);
84 printf("%s\n", blob_str(&out));
85
86 /* Release memory resources */
87 blob_reset(&file2);
88 blob_reset(&out);
@@ -183,16 +195,20 @@
195 ** files on disk and the check-out on which they are based.
196 */
197 static void diff_all_against_disk(
198 const char *zFrom, /* Version to difference from */
199 const char *zDiffCmd, /* Use this diff command. NULL for built-in */
200 int diffFlags /* Flags controlling diff output */
201 ){
202 int vid;
203 Blob sql;
204 Stmt q;
205 int ignoreEolWs; /* Ignore end-of-line whitespace */
206 int asNewFile; /* Treat non-existant files as empty files */
207
208 ignoreEolWs = (diffFlags & DIFF_NOEOLWS)!=0;
209 asNewFile = (diffFlags & DIFF_NEWFILE)!=0;
210 vid = db_lget_int("checkout", 0);
211 vfile_check_signature(vid, 1);
212 blob_zero(&sql);
213 db_begin_transaction();
214 if( zFrom ){
@@ -235,23 +251,35 @@
251 while( db_step(&q)==SQLITE_ROW ){
252 const char *zPathname = db_column_text(&q,0);
253 int isDeleted = db_column_int(&q, 1);
254 int isChnged = db_column_int(&q,2);
255 int isNew = db_column_int(&q,3);
256 int srcid = db_column_int(&q, 4);
257 char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
258 int showDiff = 1;
259 if( isDeleted ){
260 printf("DELETED %s\n", zPathname);
261 if( !asNewFile ){ showDiff = 0; zFullName = "/dev/null"; }
262 }else if( access(zFullName, 0) ){
263 printf("MISSING %s\n", zPathname);
264 if( !asNewFile ){ showDiff = 0; }
265 }else if( isNew ){
266 printf("ADDED %s\n", zPathname);
267 srcid = 0;
268 if( !asNewFile ){ showDiff = 0; }
269 }else if( isChnged==3 ){
270 printf("ADDED_BY_MERGE %s\n", zPathname);
271 srcid = 0;
272 if( !asNewFile ){ showDiff = 0; }
273 }
274 if( showDiff ){
275 Blob content;
276 if( srcid>0 ){
277 content_get(srcid, &content);
278 }else{
279 blob_zero(&content);
280 }
281 printf("Index: %s\n======================================="
282 "============================\n",
283 zPathname
284 );
285 diff_file(&content, zFullName, zPathname, zDiffCmd, ignoreEolWs);
@@ -284,27 +312,61 @@
312 diff_file_mem(&v1, &v2, zName, zDiffCmd, ignoreEolWs);
313 blob_reset(&v1);
314 blob_reset(&v2);
315 blob_reset(&fname);
316 }
317
318 /*
319 ** Show the difference between two files identified by ManifestFile
320 ** entries.
321 */
322 static void diff_manifest_entry(
323 struct ManifestFile *pFrom,
324 struct ManifestFile *pTo,
325 const char *zDiffCmd,
326 int ignoreEolWs
327 ){
328 Blob f1, f2;
329 int rid;
330 const char *zName = pFrom ? pFrom->zName : pTo->zName;
331 printf("Index: %s\n======================================="
332 "============================\n", zName);
333 if( pFrom ){
334 rid = uuid_to_rid(pFrom->zUuid, 0);
335 content_get(rid, &f1);
336 }else{
337 blob_zero(&f1);
338 }
339 if( pTo ){
340 rid = uuid_to_rid(pTo->zUuid, 0);
341 content_get(rid, &f2);
342 }else{
343 blob_zero(&f2);
344 }
345 diff_file_mem(&f1, &f2, zName, zDiffCmd, ignoreEolWs);
346 blob_reset(&f1);
347 blob_reset(&f2);
348 }
349
350 /*
351 ** Output the differences between two check-ins.
352 */
353 static void diff_all_two_versions(
354 const char *zFrom,
355 const char *zTo,
356 const char *zDiffCmd,
357 int diffFlags
358 ){
359 Manifest mFrom, mTo;
360 int iFrom, iTo;
361 int ignoreEolWs = (diffFlags & DIFF_NOEOLWS)!=0 ? 1 : 0;
362 int asNewFlag = (diffFlags & DIFF_NEWFILE)!=0 ? 1 : 0;
363
364 manifest_from_name(zFrom, &mFrom);
365 manifest_from_name(zTo, &mTo);
366 iFrom = iTo = 0;
367 while( iFrom<mFrom.nFile || iTo<mTo.nFile ){
368 int cmp;
369 if( iFrom>=mFrom.nFile ){
370 cmp = +1;
371 }else if( iTo>=mTo.nFile ){
372 cmp = -1;
@@ -311,33 +373,28 @@
373 }else{
374 cmp = strcmp(mFrom.aFile[iFrom].zName, mTo.aFile[iTo].zName);
375 }
376 if( cmp<0 ){
377 printf("DELETED %s\n", mFrom.aFile[iFrom].zName);
378 if( asNewFlag ){
379 diff_manifest_entry(&mFrom.aFile[iFrom], 0, zDiffCmd, ignoreEolWs);
380 }
381 iFrom++;
382 }else if( cmp>0 ){
383 printf("ADDED %s\n", mTo.aFile[iTo].zName);
384 if( asNewFlag ){
385 diff_manifest_entry(0, &mTo.aFile[iTo], zDiffCmd, ignoreEolWs);
386 }
387 iTo++;
388 }else if( strcmp(mFrom.aFile[iFrom].zUuid, mTo.aFile[iTo].zUuid)==0 ){
389 /* No changes */
390 iFrom++;
391 iTo++;
392 }else{
 
 
393 printf("CHANGED %s\n", mFrom.aFile[iFrom].zName);
394 diff_manifest_entry(&mFrom.aFile[iFrom], &mTo.aFile[iTo],
395 zDiffCmd, ignoreEolWs);
 
 
 
 
 
 
 
 
 
396 iFrom++;
397 iTo++;
398 }
399 }
400 manifest_clear(&mFrom);
@@ -375,29 +432,34 @@
432 ** 2. use the "diff against another version" link on the Check-in detail view.
433 */
434 void diff_cmd(void){
435 int isGDiff; /* True for gdiff. False for normal diff */
436 int isInternDiff; /* True for internal diff */
437 int hasNFlag; /* True if -N or --new-file flag is used */
438 const char *zFrom; /* Source version number */
439 const char *zTo; /* Target version number */
440 const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
441 int diffFlags = 0; /* Flags to control the DIFF */
442
443 isGDiff = g.argv[1][0]=='g';
444 isInternDiff = find_option("internal","i",0)!=0;
445 zFrom = find_option("from", "r", 1);
446 zTo = find_option("to", 0, 1);
447 hasNFlag = find_option("new-file","N",0)!=0;
448
449
450 if( hasNFlag ) diffFlags |= DIFF_NEWFILE;
451 if( zTo==0 ){
452 db_must_be_within_tree();
453 verify_all_options();
454 if( !isInternDiff ){
455 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
456 }
457 if( g.argc==3 ){
458 diff_one_against_disk(zFrom, zDiffCmd, 0);
459 }else{
460 diff_all_against_disk(zFrom, zDiffCmd, diffFlags);
461 }
462 }else if( zFrom==0 ){
463 fossil_fatal("must use --from if --to is present");
464 }else{
465 db_find_and_open_repository(1);
@@ -406,9 +468,9 @@
468 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
469 }
470 if( g.argc==3 ){
471 diff_one_two_versions(zFrom, zTo, zDiffCmd, 0);
472 }else{
473 diff_all_two_versions(zFrom, zTo, zDiffCmd, diffFlags);
474 }
475 }
476 }
477
+1 -1
--- src/doc.c
+++ src/doc.c
@@ -290,11 +290,11 @@
290290
if( zName[i]=='.' ) z = &zName[i+1];
291291
}
292292
len = strlen(z);
293293
if( len<sizeof(zSuffix)-1 ){
294294
strcpy(zSuffix, z);
295
- for(i=0; zSuffix[i]; i++) zSuffix[i] = tolower(zSuffix[i]);
295
+ for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]);
296296
first = 0;
297297
last = sizeof(aMime)/sizeof(aMime[0]);
298298
while( first<=last ){
299299
int c;
300300
i = (first+last)/2;
301301
--- src/doc.c
+++ src/doc.c
@@ -290,11 +290,11 @@
290 if( zName[i]=='.' ) z = &zName[i+1];
291 }
292 len = strlen(z);
293 if( len<sizeof(zSuffix)-1 ){
294 strcpy(zSuffix, z);
295 for(i=0; zSuffix[i]; i++) zSuffix[i] = tolower(zSuffix[i]);
296 first = 0;
297 last = sizeof(aMime)/sizeof(aMime[0]);
298 while( first<=last ){
299 int c;
300 i = (first+last)/2;
301
--- src/doc.c
+++ src/doc.c
@@ -290,11 +290,11 @@
290 if( zName[i]=='.' ) z = &zName[i+1];
291 }
292 len = strlen(z);
293 if( len<sizeof(zSuffix)-1 ){
294 strcpy(zSuffix, z);
295 for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]);
296 first = 0;
297 last = sizeof(aMime)/sizeof(aMime[0]);
298 while( first<=last ){
299 int c;
300 i = (first+last)/2;
301
+2 -2
--- src/encode.c
+++ src/encode.c
@@ -100,11 +100,11 @@
100100
int i = 0;
101101
int count = 0;
102102
char *zOut;
103103
int other;
104104
# define IsSafeChar(X) \
105
- (isalnum(X) || (X)=='.' || (X)=='$' \
105
+ (fossil_isalnum(X) || (X)=='.' || (X)=='$' \
106106
|| (X)=='~' || (X)=='-' || (X)=='_' || (X)==other)
107107
108108
if( zIn==0 ) return 0;
109109
if( n<0 ) n = strlen(zIn);
110110
other = encodeSlash ? 'a' : '/';
@@ -244,11 +244,11 @@
244244
zOut[j++] = '\\';
245245
zOut[j++] = '0';
246246
}else if( c=='\\' ){
247247
zOut[j++] = '\\';
248248
zOut[j++] = '\\';
249
- }else if( isspace(c) ){
249
+ }else if( fossil_isspace(c) ){
250250
zOut[j++] = '\\';
251251
switch( c ){
252252
case '\n': c = 'n'; break;
253253
case ' ': c = 's'; break;
254254
case '\t': c = 't'; break;
255255
--- src/encode.c
+++ src/encode.c
@@ -100,11 +100,11 @@
100 int i = 0;
101 int count = 0;
102 char *zOut;
103 int other;
104 # define IsSafeChar(X) \
105 (isalnum(X) || (X)=='.' || (X)=='$' \
106 || (X)=='~' || (X)=='-' || (X)=='_' || (X)==other)
107
108 if( zIn==0 ) return 0;
109 if( n<0 ) n = strlen(zIn);
110 other = encodeSlash ? 'a' : '/';
@@ -244,11 +244,11 @@
244 zOut[j++] = '\\';
245 zOut[j++] = '0';
246 }else if( c=='\\' ){
247 zOut[j++] = '\\';
248 zOut[j++] = '\\';
249 }else if( isspace(c) ){
250 zOut[j++] = '\\';
251 switch( c ){
252 case '\n': c = 'n'; break;
253 case ' ': c = 's'; break;
254 case '\t': c = 't'; break;
255
--- src/encode.c
+++ src/encode.c
@@ -100,11 +100,11 @@
100 int i = 0;
101 int count = 0;
102 char *zOut;
103 int other;
104 # define IsSafeChar(X) \
105 (fossil_isalnum(X) || (X)=='.' || (X)=='$' \
106 || (X)=='~' || (X)=='-' || (X)=='_' || (X)==other)
107
108 if( zIn==0 ) return 0;
109 if( n<0 ) n = strlen(zIn);
110 other = encodeSlash ? 'a' : '/';
@@ -244,11 +244,11 @@
244 zOut[j++] = '\\';
245 zOut[j++] = '0';
246 }else if( c=='\\' ){
247 zOut[j++] = '\\';
248 zOut[j++] = '\\';
249 }else if( fossil_isspace(c) ){
250 zOut[j++] = '\\';
251 switch( c ){
252 case '\n': c = 'n'; break;
253 case ' ': c = 's'; break;
254 case '\t': c = 't'; break;
255
+2 -2
--- src/event.c
+++ src/event.c
@@ -321,12 +321,12 @@
321321
322322
/* Collapse all sequences of whitespace and "," characters into
323323
** a single space character */
324324
zBlob = blob_str(&tags);
325325
for(i=j=0; zBlob[i]; i++, j++){
326
- if( blob_isspace(zBlob[i]) || zBlob[i]==',' ){
327
- while( blob_isspace(zBlob[i+1]) ){ i++; }
326
+ if( fossil_isspace(zBlob[i]) || zBlob[i]==',' ){
327
+ while( fossil_isspace(zBlob[i+1]) ){ i++; }
328328
zBlob[j] = ' ';
329329
}else{
330330
zBlob[j] = zBlob[i];
331331
}
332332
}
333333
--- src/event.c
+++ src/event.c
@@ -321,12 +321,12 @@
321
322 /* Collapse all sequences of whitespace and "," characters into
323 ** a single space character */
324 zBlob = blob_str(&tags);
325 for(i=j=0; zBlob[i]; i++, j++){
326 if( blob_isspace(zBlob[i]) || zBlob[i]==',' ){
327 while( blob_isspace(zBlob[i+1]) ){ i++; }
328 zBlob[j] = ' ';
329 }else{
330 zBlob[j] = zBlob[i];
331 }
332 }
333
--- src/event.c
+++ src/event.c
@@ -321,12 +321,12 @@
321
322 /* Collapse all sequences of whitespace and "," characters into
323 ** a single space character */
324 zBlob = blob_str(&tags);
325 for(i=j=0; zBlob[i]; i++, j++){
326 if( fossil_isspace(zBlob[i]) || zBlob[i]==',' ){
327 while( fossil_isspace(zBlob[i+1]) ){ i++; }
328 zBlob[j] = ' ';
329 }else{
330 zBlob[j] = zBlob[i];
331 }
332 }
333
+2 -2
--- src/event.c
+++ src/event.c
@@ -321,12 +321,12 @@
321321
322322
/* Collapse all sequences of whitespace and "," characters into
323323
** a single space character */
324324
zBlob = blob_str(&tags);
325325
for(i=j=0; zBlob[i]; i++, j++){
326
- if( blob_isspace(zBlob[i]) || zBlob[i]==',' ){
327
- while( blob_isspace(zBlob[i+1]) ){ i++; }
326
+ if( fossil_isspace(zBlob[i]) || zBlob[i]==',' ){
327
+ while( fossil_isspace(zBlob[i+1]) ){ i++; }
328328
zBlob[j] = ' ';
329329
}else{
330330
zBlob[j] = zBlob[i];
331331
}
332332
}
333333
--- src/event.c
+++ src/event.c
@@ -321,12 +321,12 @@
321
322 /* Collapse all sequences of whitespace and "," characters into
323 ** a single space character */
324 zBlob = blob_str(&tags);
325 for(i=j=0; zBlob[i]; i++, j++){
326 if( blob_isspace(zBlob[i]) || zBlob[i]==',' ){
327 while( blob_isspace(zBlob[i+1]) ){ i++; }
328 zBlob[j] = ' ';
329 }else{
330 zBlob[j] = zBlob[i];
331 }
332 }
333
--- src/event.c
+++ src/event.c
@@ -321,12 +321,12 @@
321
322 /* Collapse all sequences of whitespace and "," characters into
323 ** a single space character */
324 zBlob = blob_str(&tags);
325 for(i=j=0; zBlob[i]; i++, j++){
326 if( fossil_isspace(zBlob[i]) || zBlob[i]==',' ){
327 while( fossil_isspace(zBlob[i+1]) ){ i++; }
328 zBlob[j] = ' ';
329 }else{
330 zBlob[j] = zBlob[i];
331 }
332 }
333
+2 -2
--- src/http.c
+++ src/http.c
@@ -210,15 +210,15 @@
210210
closeConnection = 1;
211211
}else{
212212
closeConnection = 0;
213213
}
214214
}else if( strncasecmp(zLine, "content-length:", 15)==0 ){
215
- for(i=15; isspace(zLine[i]); i++){}
215
+ for(i=15; fossil_isspace(zLine[i]); i++){}
216216
iLength = atoi(&zLine[i]);
217217
}else if( strncasecmp(zLine, "connection:", 11)==0 ){
218218
char c;
219
- for(i=11; isspace(zLine[i]); i++){}
219
+ for(i=11; fossil_isspace(zLine[i]); i++){}
220220
c = zLine[i];
221221
if( c=='c' || c=='C' ){
222222
closeConnection = 1;
223223
}else if( c=='k' || c=='K' ){
224224
closeConnection = 0;
225225
--- src/http.c
+++ src/http.c
@@ -210,15 +210,15 @@
210 closeConnection = 1;
211 }else{
212 closeConnection = 0;
213 }
214 }else if( strncasecmp(zLine, "content-length:", 15)==0 ){
215 for(i=15; isspace(zLine[i]); i++){}
216 iLength = atoi(&zLine[i]);
217 }else if( strncasecmp(zLine, "connection:", 11)==0 ){
218 char c;
219 for(i=11; isspace(zLine[i]); i++){}
220 c = zLine[i];
221 if( c=='c' || c=='C' ){
222 closeConnection = 1;
223 }else if( c=='k' || c=='K' ){
224 closeConnection = 0;
225
--- src/http.c
+++ src/http.c
@@ -210,15 +210,15 @@
210 closeConnection = 1;
211 }else{
212 closeConnection = 0;
213 }
214 }else if( strncasecmp(zLine, "content-length:", 15)==0 ){
215 for(i=15; fossil_isspace(zLine[i]); i++){}
216 iLength = atoi(&zLine[i]);
217 }else if( strncasecmp(zLine, "connection:", 11)==0 ){
218 char c;
219 for(i=11; fossil_isspace(zLine[i]); i++){}
220 c = zLine[i];
221 if( c=='c' || c=='C' ){
222 closeConnection = 1;
223 }else if( c=='k' || c=='K' ){
224 closeConnection = 0;
225
--- src/http_transport.c
+++ src/http_transport.c
@@ -83,11 +83,11 @@
8383
int got;
8484
zBuf[0] = 0;
8585
got = read(sshIn, zBuf, szBuf-1);
8686
while( got>=0 ){
8787
zBuf[got] = 0;
88
- if( got==0 || !isspace(zBuf[got-1]) ) break;
88
+ if( got==0 || !fossil_isspace(zBuf[got-1]) ) break;
8989
got--;
9090
}
9191
}
9292
9393
/*
@@ -439,11 +439,11 @@
439439
break;
440440
}
441441
}
442442
if( transport.pBuf[i]=='\n' ){
443443
transport.iCursor = i+1;
444
- while( i>=iStart && isspace(transport.pBuf[i]) ){
444
+ while( i>=iStart && fossil_isspace(transport.pBuf[i]) ){
445445
transport.pBuf[i] = 0;
446446
i--;
447447
}
448448
break;
449449
}
450450
--- src/http_transport.c
+++ src/http_transport.c
@@ -83,11 +83,11 @@
83 int got;
84 zBuf[0] = 0;
85 got = read(sshIn, zBuf, szBuf-1);
86 while( got>=0 ){
87 zBuf[got] = 0;
88 if( got==0 || !isspace(zBuf[got-1]) ) break;
89 got--;
90 }
91 }
92
93 /*
@@ -439,11 +439,11 @@
439 break;
440 }
441 }
442 if( transport.pBuf[i]=='\n' ){
443 transport.iCursor = i+1;
444 while( i>=iStart && isspace(transport.pBuf[i]) ){
445 transport.pBuf[i] = 0;
446 i--;
447 }
448 break;
449 }
450
--- src/http_transport.c
+++ src/http_transport.c
@@ -83,11 +83,11 @@
83 int got;
84 zBuf[0] = 0;
85 got = read(sshIn, zBuf, szBuf-1);
86 while( got>=0 ){
87 zBuf[got] = 0;
88 if( got==0 || !fossil_isspace(zBuf[got-1]) ) break;
89 got--;
90 }
91 }
92
93 /*
@@ -439,11 +439,11 @@
439 break;
440 }
441 }
442 if( transport.pBuf[i]=='\n' ){
443 transport.iCursor = i+1;
444 while( i>=iStart && fossil_isspace(transport.pBuf[i]) ){
445 transport.pBuf[i] = 0;
446 i--;
447 }
448 break;
449 }
450
+38 -28
--- src/info.c
+++ src/info.c
@@ -234,14 +234,26 @@
234234
235235
236236
/*
237237
** Append the difference between two RIDs to the output
238238
*/
239
-static void append_diff(int fromid, int toid){
239
+static void append_diff(const char *zFrom, const char *zTo){
240
+ int fromid;
241
+ int toid;
240242
Blob from, to, out;
241
- content_get(fromid, &from);
242
- content_get(toid, &to);
243
+ if( zFrom ){
244
+ fromid = uuid_to_rid(zFrom, 0);
245
+ content_get(fromid, &from);
246
+ }else{
247
+ blob_zero(&from);
248
+ }
249
+ if( zTo ){
250
+ toid = uuid_to_rid(zTo, 0);
251
+ content_get(toid, &to);
252
+ }else{
253
+ blob_zero(&to);
254
+ }
243255
blob_zero(&out);
244256
text_diff(&from, &to, &out, 5, 1);
245257
@ %h(blob_str(&out))
246258
blob_reset(&from);
247259
blob_reset(&to);
@@ -263,39 +275,37 @@
263275
@ <p>Deleted %h(zName)</p>
264276
}else if( zOld==0 ){
265277
@ <p>Added %h(zName)</p>
266278
}else{
267279
@ <p>Changes to %h(zName)</p>
268
- if( showDiff ){
269
- int rid1 = uuid_to_rid(zOld, 0);
270
- int rid2 = uuid_to_rid(zNew, 0);
271
- @ <blockquote><pre>
272
- append_diff(rid1, rid2);
273
- @ </pre></blockquote>
274
- }
275
- }
276
- }else if( zOld && zNew ){
277
- @ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
278
- @ from <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
279
- @ to <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)].</a>
280
- if( !showDiff ){
280
+ }
281
+ if( showDiff ){
282
+ @ <blockquote><pre>
283
+ append_diff(zOld, zNew);
284
+ @ </pre></blockquote>
285
+ }
286
+ }else{
287
+ if( zOld && zNew ){
288
+ @ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
289
+ @ from <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
290
+ @ to <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)].</a>
291
+ }else if( zOld ){
292
+ @ <p>Deleted <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
293
+ @ version <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
294
+ }else{
295
+ @ <p>Added <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
296
+ @ version <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)]</a>
297
+ }
298
+ if( showDiff ){
299
+ @ <blockquote><pre>
300
+ append_diff(zOld, zNew);
301
+ @ </pre></blockquote>
302
+ }else if( zOld && zNew ){
281303
@ &nbsp;&nbsp;
282304
@ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&amp;v2=%S(zNew)">[diff]</a>
283
- }else{
284
- int rid1 = uuid_to_rid(zOld, 0);
285
- int rid2 = uuid_to_rid(zNew, 0);
286
- @ <blockquote><pre>
287
- append_diff(rid1, rid2);
288
- @ </pre></blockquote>
289305
}
290306
@ </p>
291
- }else if( zOld ){
292
- @ <p>Deleted <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
293
- @ version <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a></p>
294
- }else{
295
- @ <p>Added <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
296
- @ version <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)]</a></p>
297307
}
298308
}
299309
300310
301311
/*
302312
--- src/info.c
+++ src/info.c
@@ -234,14 +234,26 @@
234
235
236 /*
237 ** Append the difference between two RIDs to the output
238 */
239 static void append_diff(int fromid, int toid){
 
 
240 Blob from, to, out;
241 content_get(fromid, &from);
242 content_get(toid, &to);
 
 
 
 
 
 
 
 
 
 
243 blob_zero(&out);
244 text_diff(&from, &to, &out, 5, 1);
245 @ %h(blob_str(&out))
246 blob_reset(&from);
247 blob_reset(&to);
@@ -263,39 +275,37 @@
263 @ <p>Deleted %h(zName)</p>
264 }else if( zOld==0 ){
265 @ <p>Added %h(zName)</p>
266 }else{
267 @ <p>Changes to %h(zName)</p>
268 if( showDiff ){
269 int rid1 = uuid_to_rid(zOld, 0);
270 int rid2 = uuid_to_rid(zNew, 0);
271 @ <blockquote><pre>
272 append_diff(rid1, rid2);
273 @ </pre></blockquote>
274 }
275 }
276 }else if( zOld && zNew ){
277 @ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
278 @ from <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
279 @ to <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)].</a>
280 if( !showDiff ){
 
 
 
 
 
 
 
 
 
 
281 @ &nbsp;&nbsp;
282 @ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&amp;v2=%S(zNew)">[diff]</a>
283 }else{
284 int rid1 = uuid_to_rid(zOld, 0);
285 int rid2 = uuid_to_rid(zNew, 0);
286 @ <blockquote><pre>
287 append_diff(rid1, rid2);
288 @ </pre></blockquote>
289 }
290 @ </p>
291 }else if( zOld ){
292 @ <p>Deleted <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
293 @ version <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a></p>
294 }else{
295 @ <p>Added <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
296 @ version <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)]</a></p>
297 }
298 }
299
300
301 /*
302
--- src/info.c
+++ src/info.c
@@ -234,14 +234,26 @@
234
235
236 /*
237 ** Append the difference between two RIDs to the output
238 */
239 static void append_diff(const char *zFrom, const char *zTo){
240 int fromid;
241 int toid;
242 Blob from, to, out;
243 if( zFrom ){
244 fromid = uuid_to_rid(zFrom, 0);
245 content_get(fromid, &from);
246 }else{
247 blob_zero(&from);
248 }
249 if( zTo ){
250 toid = uuid_to_rid(zTo, 0);
251 content_get(toid, &to);
252 }else{
253 blob_zero(&to);
254 }
255 blob_zero(&out);
256 text_diff(&from, &to, &out, 5, 1);
257 @ %h(blob_str(&out))
258 blob_reset(&from);
259 blob_reset(&to);
@@ -263,39 +275,37 @@
275 @ <p>Deleted %h(zName)</p>
276 }else if( zOld==0 ){
277 @ <p>Added %h(zName)</p>
278 }else{
279 @ <p>Changes to %h(zName)</p>
280 }
281 if( showDiff ){
282 @ <blockquote><pre>
283 append_diff(zOld, zNew);
284 @ </pre></blockquote>
285 }
286 }else{
287 if( zOld && zNew ){
288 @ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
289 @ from <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
290 @ to <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)].</a>
291 }else if( zOld ){
292 @ <p>Deleted <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
293 @ version <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
294 }else{
295 @ <p>Added <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
296 @ version <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)]</a>
297 }
298 if( showDiff ){
299 @ <blockquote><pre>
300 append_diff(zOld, zNew);
301 @ </pre></blockquote>
302 }else if( zOld && zNew ){
303 @ &nbsp;&nbsp;
304 @ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&amp;v2=%S(zNew)">[diff]</a>
 
 
 
 
 
 
305 }
306 @ </p>
 
 
 
 
 
 
307 }
308 }
309
310
311 /*
312
+38 -28
--- src/info.c
+++ src/info.c
@@ -234,14 +234,26 @@
234234
235235
236236
/*
237237
** Append the difference between two RIDs to the output
238238
*/
239
-static void append_diff(int fromid, int toid){
239
+static void append_diff(const char *zFrom, const char *zTo){
240
+ int fromid;
241
+ int toid;
240242
Blob from, to, out;
241
- content_get(fromid, &from);
242
- content_get(toid, &to);
243
+ if( zFrom ){
244
+ fromid = uuid_to_rid(zFrom, 0);
245
+ content_get(fromid, &from);
246
+ }else{
247
+ blob_zero(&from);
248
+ }
249
+ if( zTo ){
250
+ toid = uuid_to_rid(zTo, 0);
251
+ content_get(toid, &to);
252
+ }else{
253
+ blob_zero(&to);
254
+ }
243255
blob_zero(&out);
244256
text_diff(&from, &to, &out, 5, 1);
245257
@ %h(blob_str(&out))
246258
blob_reset(&from);
247259
blob_reset(&to);
@@ -263,39 +275,37 @@
263275
@ <p>Deleted %h(zName)</p>
264276
}else if( zOld==0 ){
265277
@ <p>Added %h(zName)</p>
266278
}else{
267279
@ <p>Changes to %h(zName)</p>
268
- if( showDiff ){
269
- int rid1 = uuid_to_rid(zOld, 0);
270
- int rid2 = uuid_to_rid(zNew, 0);
271
- @ <blockquote><pre>
272
- append_diff(rid1, rid2);
273
- @ </pre></blockquote>
274
- }
275
- }
276
- }else if( zOld && zNew ){
277
- @ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
278
- @ from <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
279
- @ to <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)].</a>
280
- if( !showDiff ){
280
+ }
281
+ if( showDiff ){
282
+ @ <blockquote><pre>
283
+ append_diff(zOld, zNew);
284
+ @ </pre></blockquote>
285
+ }
286
+ }else{
287
+ if( zOld && zNew ){
288
+ @ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
289
+ @ from <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
290
+ @ to <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)].</a>
291
+ }else if( zOld ){
292
+ @ <p>Deleted <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
293
+ @ version <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
294
+ }else{
295
+ @ <p>Added <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
296
+ @ version <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)]</a>
297
+ }
298
+ if( showDiff ){
299
+ @ <blockquote><pre>
300
+ append_diff(zOld, zNew);
301
+ @ </pre></blockquote>
302
+ }else if( zOld && zNew ){
281303
@ &nbsp;&nbsp;
282304
@ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&amp;v2=%S(zNew)">[diff]</a>
283
- }else{
284
- int rid1 = uuid_to_rid(zOld, 0);
285
- int rid2 = uuid_to_rid(zNew, 0);
286
- @ <blockquote><pre>
287
- append_diff(rid1, rid2);
288
- @ </pre></blockquote>
289305
}
290306
@ </p>
291
- }else if( zOld ){
292
- @ <p>Deleted <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
293
- @ version <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a></p>
294
- }else{
295
- @ <p>Added <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
296
- @ version <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)]</a></p>
297307
}
298308
}
299309
300310
301311
/*
302312
--- src/info.c
+++ src/info.c
@@ -234,14 +234,26 @@
234
235
236 /*
237 ** Append the difference between two RIDs to the output
238 */
239 static void append_diff(int fromid, int toid){
 
 
240 Blob from, to, out;
241 content_get(fromid, &from);
242 content_get(toid, &to);
 
 
 
 
 
 
 
 
 
 
243 blob_zero(&out);
244 text_diff(&from, &to, &out, 5, 1);
245 @ %h(blob_str(&out))
246 blob_reset(&from);
247 blob_reset(&to);
@@ -263,39 +275,37 @@
263 @ <p>Deleted %h(zName)</p>
264 }else if( zOld==0 ){
265 @ <p>Added %h(zName)</p>
266 }else{
267 @ <p>Changes to %h(zName)</p>
268 if( showDiff ){
269 int rid1 = uuid_to_rid(zOld, 0);
270 int rid2 = uuid_to_rid(zNew, 0);
271 @ <blockquote><pre>
272 append_diff(rid1, rid2);
273 @ </pre></blockquote>
274 }
275 }
276 }else if( zOld && zNew ){
277 @ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
278 @ from <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
279 @ to <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)].</a>
280 if( !showDiff ){
 
 
 
 
 
 
 
 
 
 
281 @ &nbsp;&nbsp;
282 @ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&amp;v2=%S(zNew)">[diff]</a>
283 }else{
284 int rid1 = uuid_to_rid(zOld, 0);
285 int rid2 = uuid_to_rid(zNew, 0);
286 @ <blockquote><pre>
287 append_diff(rid1, rid2);
288 @ </pre></blockquote>
289 }
290 @ </p>
291 }else if( zOld ){
292 @ <p>Deleted <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
293 @ version <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a></p>
294 }else{
295 @ <p>Added <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
296 @ version <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)]</a></p>
297 }
298 }
299
300
301 /*
302
--- src/info.c
+++ src/info.c
@@ -234,14 +234,26 @@
234
235
236 /*
237 ** Append the difference between two RIDs to the output
238 */
239 static void append_diff(const char *zFrom, const char *zTo){
240 int fromid;
241 int toid;
242 Blob from, to, out;
243 if( zFrom ){
244 fromid = uuid_to_rid(zFrom, 0);
245 content_get(fromid, &from);
246 }else{
247 blob_zero(&from);
248 }
249 if( zTo ){
250 toid = uuid_to_rid(zTo, 0);
251 content_get(toid, &to);
252 }else{
253 blob_zero(&to);
254 }
255 blob_zero(&out);
256 text_diff(&from, &to, &out, 5, 1);
257 @ %h(blob_str(&out))
258 blob_reset(&from);
259 blob_reset(&to);
@@ -263,39 +275,37 @@
275 @ <p>Deleted %h(zName)</p>
276 }else if( zOld==0 ){
277 @ <p>Added %h(zName)</p>
278 }else{
279 @ <p>Changes to %h(zName)</p>
280 }
281 if( showDiff ){
282 @ <blockquote><pre>
283 append_diff(zOld, zNew);
284 @ </pre></blockquote>
285 }
286 }else{
287 if( zOld && zNew ){
288 @ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
289 @ from <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
290 @ to <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)].</a>
291 }else if( zOld ){
292 @ <p>Deleted <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
293 @ version <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
294 }else{
295 @ <p>Added <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
296 @ version <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)]</a>
297 }
298 if( showDiff ){
299 @ <blockquote><pre>
300 append_diff(zOld, zNew);
301 @ </pre></blockquote>
302 }else if( zOld && zNew ){
303 @ &nbsp;&nbsp;
304 @ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&amp;v2=%S(zNew)">[diff]</a>
 
 
 
 
 
 
305 }
306 @ </p>
 
 
 
 
 
 
307 }
308 }
309
310
311 /*
312
+1 -1
--- src/login.c
+++ src/login.c
@@ -353,11 +353,11 @@
353353
}
354354
355355
/* Check the login cookie to see if it matches a known valid user.
356356
*/
357357
if( uid==0 && (zCookie = P(login_cookie_name()))!=0 ){
358
- if( isdigit(zCookie[0]) ){
358
+ if( fossil_isdigit(zCookie[0]) ){
359359
/* Cookies of the form "uid/randomness". There must be a
360360
** corresponding entry in the user table. */
361361
uid = db_int(0,
362362
"SELECT uid FROM user"
363363
" WHERE uid=%d"
364364
--- src/login.c
+++ src/login.c
@@ -353,11 +353,11 @@
353 }
354
355 /* Check the login cookie to see if it matches a known valid user.
356 */
357 if( uid==0 && (zCookie = P(login_cookie_name()))!=0 ){
358 if( isdigit(zCookie[0]) ){
359 /* Cookies of the form "uid/randomness". There must be a
360 ** corresponding entry in the user table. */
361 uid = db_int(0,
362 "SELECT uid FROM user"
363 " WHERE uid=%d"
364
--- src/login.c
+++ src/login.c
@@ -353,11 +353,11 @@
353 }
354
355 /* Check the login cookie to see if it matches a known valid user.
356 */
357 if( uid==0 && (zCookie = P(login_cookie_name()))!=0 ){
358 if( fossil_isdigit(zCookie[0]) ){
359 /* Cookies of the form "uid/randomness". There must be a
360 ** corresponding entry in the user table. */
361 uid = db_int(0,
362 "SELECT uid FROM user"
363 " WHERE uid=%d"
364
+2 -2
--- src/main.c
+++ src/main.c
@@ -704,11 +704,11 @@
704704
@ see also the list of
705705
@ <a href="help">available commands</a> in fossil
706706
@ version %s(MANIFEST_VERSION" "MANIFEST_DATE) UTC
707707
}else{
708708
int nCol, nRow, i, ignored, cnt, showTest;
709
-
709
+
710710
/* detect, if we show normal or test commands */
711711
showTest = ( zCmd && !strncmp(zCmd,"test",4) );
712712
for( i=0,ignored=0; i<count(aCommand); i++){
713713
if( (strncmp(aCommand[i].zName,"test",4)==0) ^ showTest ) ignored++;
714714
}
@@ -848,11 +848,11 @@
848848
849849
/* To avoid mischief, make sure the repository basename contains no
850850
** characters other than alphanumerics, "-", and "_".
851851
*/
852852
for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){
853
- if( !isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
853
+ if( !fossil_isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
854854
}
855855
if( zRepo[0]=='/' && zRepo[1]=='/' ) zRepo++;
856856
857857
if( file_size(zRepo)<1024 ){
858858
if( zNotFound ){
859859
--- src/main.c
+++ src/main.c
@@ -704,11 +704,11 @@
704 @ see also the list of
705 @ <a href="help">available commands</a> in fossil
706 @ version %s(MANIFEST_VERSION" "MANIFEST_DATE) UTC
707 }else{
708 int nCol, nRow, i, ignored, cnt, showTest;
709
710 /* detect, if we show normal or test commands */
711 showTest = ( zCmd && !strncmp(zCmd,"test",4) );
712 for( i=0,ignored=0; i<count(aCommand); i++){
713 if( (strncmp(aCommand[i].zName,"test",4)==0) ^ showTest ) ignored++;
714 }
@@ -848,11 +848,11 @@
848
849 /* To avoid mischief, make sure the repository basename contains no
850 ** characters other than alphanumerics, "-", and "_".
851 */
852 for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){
853 if( !isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
854 }
855 if( zRepo[0]=='/' && zRepo[1]=='/' ) zRepo++;
856
857 if( file_size(zRepo)<1024 ){
858 if( zNotFound ){
859
--- src/main.c
+++ src/main.c
@@ -704,11 +704,11 @@
704 @ see also the list of
705 @ <a href="help">available commands</a> in fossil
706 @ version %s(MANIFEST_VERSION" "MANIFEST_DATE) UTC
707 }else{
708 int nCol, nRow, i, ignored, cnt, showTest;
709
710 /* detect, if we show normal or test commands */
711 showTest = ( zCmd && !strncmp(zCmd,"test",4) );
712 for( i=0,ignored=0; i<count(aCommand); i++){
713 if( (strncmp(aCommand[i].zName,"test",4)==0) ^ showTest ) ignored++;
714 }
@@ -848,11 +848,11 @@
848
849 /* To avoid mischief, make sure the repository basename contains no
850 ** characters other than alphanumerics, "-", and "_".
851 */
852 for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){
853 if( !fossil_isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
854 }
855 if( zRepo[0]=='/' && zRepo[1]=='/' ) zRepo++;
856
857 if( file_size(zRepo)<1024 ){
858 if( zNotFound ){
859
+2 -2
--- src/main.c
+++ src/main.c
@@ -704,11 +704,11 @@
704704
@ see also the list of
705705
@ <a href="help">available commands</a> in fossil
706706
@ version %s(MANIFEST_VERSION" "MANIFEST_DATE) UTC
707707
}else{
708708
int nCol, nRow, i, ignored, cnt, showTest;
709
-
709
+
710710
/* detect, if we show normal or test commands */
711711
showTest = ( zCmd && !strncmp(zCmd,"test",4) );
712712
for( i=0,ignored=0; i<count(aCommand); i++){
713713
if( (strncmp(aCommand[i].zName,"test",4)==0) ^ showTest ) ignored++;
714714
}
@@ -848,11 +848,11 @@
848848
849849
/* To avoid mischief, make sure the repository basename contains no
850850
** characters other than alphanumerics, "-", and "_".
851851
*/
852852
for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){
853
- if( !isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
853
+ if( !fossil_isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
854854
}
855855
if( zRepo[0]=='/' && zRepo[1]=='/' ) zRepo++;
856856
857857
if( file_size(zRepo)<1024 ){
858858
if( zNotFound ){
859859
--- src/main.c
+++ src/main.c
@@ -704,11 +704,11 @@
704 @ see also the list of
705 @ <a href="help">available commands</a> in fossil
706 @ version %s(MANIFEST_VERSION" "MANIFEST_DATE) UTC
707 }else{
708 int nCol, nRow, i, ignored, cnt, showTest;
709
710 /* detect, if we show normal or test commands */
711 showTest = ( zCmd && !strncmp(zCmd,"test",4) );
712 for( i=0,ignored=0; i<count(aCommand); i++){
713 if( (strncmp(aCommand[i].zName,"test",4)==0) ^ showTest ) ignored++;
714 }
@@ -848,11 +848,11 @@
848
849 /* To avoid mischief, make sure the repository basename contains no
850 ** characters other than alphanumerics, "-", and "_".
851 */
852 for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){
853 if( !isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
854 }
855 if( zRepo[0]=='/' && zRepo[1]=='/' ) zRepo++;
856
857 if( file_size(zRepo)<1024 ){
858 if( zNotFound ){
859
--- src/main.c
+++ src/main.c
@@ -704,11 +704,11 @@
704 @ see also the list of
705 @ <a href="help">available commands</a> in fossil
706 @ version %s(MANIFEST_VERSION" "MANIFEST_DATE) UTC
707 }else{
708 int nCol, nRow, i, ignored, cnt, showTest;
709
710 /* detect, if we show normal or test commands */
711 showTest = ( zCmd && !strncmp(zCmd,"test",4) );
712 for( i=0,ignored=0; i<count(aCommand); i++){
713 if( (strncmp(aCommand[i].zName,"test",4)==0) ^ showTest ) ignored++;
714 }
@@ -848,11 +848,11 @@
848
849 /* To avoid mischief, make sure the repository basename contains no
850 ** characters other than alphanumerics, "-", and "_".
851 */
852 for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){
853 if( !fossil_isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
854 }
855 if( zRepo[0]=='/' && zRepo[1]=='/' ) zRepo++;
856
857 if( file_size(zRepo)<1024 ){
858 if( zNotFound ){
859
+3 -3
--- src/manifest.c
+++ src/manifest.c
@@ -54,11 +54,11 @@
5454
char *zAttachName; /* Filename of an attachment. A card. */
5555
char *zAttachSrc; /* UUID of document being attached. A card. */
5656
char *zAttachTarget; /* Ticket or wiki that attachment applies to. A card */
5757
int nFile; /* Number of F cards */
5858
int nFileAlloc; /* Slots allocated in aFile[] */
59
- struct {
59
+ struct ManifestFile {
6060
char *zName; /* Name of a file */
6161
char *zUuid; /* UUID of the file */
6262
char *zPerm; /* File permissions */
6363
char *zPrior; /* Prior name if the name was changed */
6464
int iRename; /* index of renamed name in prior/next manifest */
@@ -1211,11 +1211,11 @@
12111211
int tagid = tag_findid(zTag, 1);
12121212
int prior;
12131213
char *zComment;
12141214
int nWiki;
12151215
char zLength[40];
1216
- while( isspace(m.zWiki[0]) ) m.zWiki++;
1216
+ while( fossil_isspace(m.zWiki[0]) ) m.zWiki++;
12171217
nWiki = strlen(m.zWiki);
12181218
sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
12191219
tag_insert(zTag, 1, zLength, rid, m.rDate, rid);
12201220
free(zTag);
12211221
prior = db_int(0,
@@ -1251,11 +1251,11 @@
12511251
char *zTag = mprintf("event-%s", m.zEventId);
12521252
int tagid = tag_findid(zTag, 1);
12531253
int prior, subsequent;
12541254
int nWiki;
12551255
char zLength[40];
1256
- while( isspace(m.zWiki[0]) ) m.zWiki++;
1256
+ while( fossil_isspace(m.zWiki[0]) ) m.zWiki++;
12571257
nWiki = strlen(m.zWiki);
12581258
sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
12591259
tag_insert(zTag, 1, zLength, rid, m.rDate, rid);
12601260
free(zTag);
12611261
prior = db_int(0,
12621262
--- src/manifest.c
+++ src/manifest.c
@@ -54,11 +54,11 @@
54 char *zAttachName; /* Filename of an attachment. A card. */
55 char *zAttachSrc; /* UUID of document being attached. A card. */
56 char *zAttachTarget; /* Ticket or wiki that attachment applies to. A card */
57 int nFile; /* Number of F cards */
58 int nFileAlloc; /* Slots allocated in aFile[] */
59 struct {
60 char *zName; /* Name of a file */
61 char *zUuid; /* UUID of the file */
62 char *zPerm; /* File permissions */
63 char *zPrior; /* Prior name if the name was changed */
64 int iRename; /* index of renamed name in prior/next manifest */
@@ -1211,11 +1211,11 @@
1211 int tagid = tag_findid(zTag, 1);
1212 int prior;
1213 char *zComment;
1214 int nWiki;
1215 char zLength[40];
1216 while( isspace(m.zWiki[0]) ) m.zWiki++;
1217 nWiki = strlen(m.zWiki);
1218 sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
1219 tag_insert(zTag, 1, zLength, rid, m.rDate, rid);
1220 free(zTag);
1221 prior = db_int(0,
@@ -1251,11 +1251,11 @@
1251 char *zTag = mprintf("event-%s", m.zEventId);
1252 int tagid = tag_findid(zTag, 1);
1253 int prior, subsequent;
1254 int nWiki;
1255 char zLength[40];
1256 while( isspace(m.zWiki[0]) ) m.zWiki++;
1257 nWiki = strlen(m.zWiki);
1258 sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
1259 tag_insert(zTag, 1, zLength, rid, m.rDate, rid);
1260 free(zTag);
1261 prior = db_int(0,
1262
--- src/manifest.c
+++ src/manifest.c
@@ -54,11 +54,11 @@
54 char *zAttachName; /* Filename of an attachment. A card. */
55 char *zAttachSrc; /* UUID of document being attached. A card. */
56 char *zAttachTarget; /* Ticket or wiki that attachment applies to. A card */
57 int nFile; /* Number of F cards */
58 int nFileAlloc; /* Slots allocated in aFile[] */
59 struct ManifestFile {
60 char *zName; /* Name of a file */
61 char *zUuid; /* UUID of the file */
62 char *zPerm; /* File permissions */
63 char *zPrior; /* Prior name if the name was changed */
64 int iRename; /* index of renamed name in prior/next manifest */
@@ -1211,11 +1211,11 @@
1211 int tagid = tag_findid(zTag, 1);
1212 int prior;
1213 char *zComment;
1214 int nWiki;
1215 char zLength[40];
1216 while( fossil_isspace(m.zWiki[0]) ) m.zWiki++;
1217 nWiki = strlen(m.zWiki);
1218 sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
1219 tag_insert(zTag, 1, zLength, rid, m.rDate, rid);
1220 free(zTag);
1221 prior = db_int(0,
@@ -1251,11 +1251,11 @@
1251 char *zTag = mprintf("event-%s", m.zEventId);
1252 int tagid = tag_findid(zTag, 1);
1253 int prior, subsequent;
1254 int nWiki;
1255 char zLength[40];
1256 while( fossil_isspace(m.zWiki[0]) ) m.zWiki++;
1257 nWiki = strlen(m.zWiki);
1258 sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
1259 tag_insert(zTag, 1, zLength, rid, m.rDate, rid);
1260 free(zTag);
1261 prior = db_int(0,
1262
+2 -2
--- src/merge3.c
+++ src/merge3.c
@@ -151,13 +151,13 @@
151151
int *aC2; /* Changes from pPivot to pV2 */
152152
int i1, i2; /* Index into aC1[] and aC2[] */
153153
int nCpy, nDel, nIns; /* Number of lines to copy, delete, or insert */
154154
int limit1, limit2; /* Sizes of aC1[] and aC2[] */
155155
int nConflict = 0; /* Number of merge conflicts seen so far */
156
- static const char zBegin[] = ">>>>>>> BEGIN MERGE CONFLICT\n";
156
+ static const char zBegin[] = "<<<<<<< BEGIN MERGE CONFLICT\n";
157157
static const char zMid[] = "============================\n";
158
- static const char zEnd[] = "<<<<<<< END MERGE CONFLICT\n";
158
+ static const char zEnd[] = ">>>>>>> END MERGE CONFLICT\n";
159159
160160
blob_zero(pOut); /* Merge results stored in pOut */
161161
162162
/* Compute the edits that occur from pPivot => pV1 (into aC1)
163163
** and pPivot => pV2 (into aC2). Each of the aC1 and aC2 arrays is
164164
--- src/merge3.c
+++ src/merge3.c
@@ -151,13 +151,13 @@
151 int *aC2; /* Changes from pPivot to pV2 */
152 int i1, i2; /* Index into aC1[] and aC2[] */
153 int nCpy, nDel, nIns; /* Number of lines to copy, delete, or insert */
154 int limit1, limit2; /* Sizes of aC1[] and aC2[] */
155 int nConflict = 0; /* Number of merge conflicts seen so far */
156 static const char zBegin[] = ">>>>>>> BEGIN MERGE CONFLICT\n";
157 static const char zMid[] = "============================\n";
158 static const char zEnd[] = "<<<<<<< END MERGE CONFLICT\n";
159
160 blob_zero(pOut); /* Merge results stored in pOut */
161
162 /* Compute the edits that occur from pPivot => pV1 (into aC1)
163 ** and pPivot => pV2 (into aC2). Each of the aC1 and aC2 arrays is
164
--- src/merge3.c
+++ src/merge3.c
@@ -151,13 +151,13 @@
151 int *aC2; /* Changes from pPivot to pV2 */
152 int i1, i2; /* Index into aC1[] and aC2[] */
153 int nCpy, nDel, nIns; /* Number of lines to copy, delete, or insert */
154 int limit1, limit2; /* Sizes of aC1[] and aC2[] */
155 int nConflict = 0; /* Number of merge conflicts seen so far */
156 static const char zBegin[] = "<<<<<<< BEGIN MERGE CONFLICT\n";
157 static const char zMid[] = "============================\n";
158 static const char zEnd[] = ">>>>>>> END MERGE CONFLICT\n";
159
160 blob_zero(pOut); /* Merge results stored in pOut */
161
162 /* Compute the edits that occur from pPivot => pV1 (into aC1)
163 ** and pPivot => pV2 (into aC2). Each of the aC1 and aC2 arrays is
164
+10 -10
--- src/name.c
+++ src/name.c
@@ -111,20 +111,20 @@
111111
112112
/*
113113
** Return TRUE if the string begins with an ISO8601 date: YYYY-MM-DD.
114114
*/
115115
static int is_date(const char *z){
116
- if( !isdigit(z[0]) ) return 0;
117
- if( !isdigit(z[1]) ) return 0;
118
- if( !isdigit(z[2]) ) return 0;
119
- if( !isdigit(z[3]) ) return 0;
116
+ if( !fossil_isdigit(z[0]) ) return 0;
117
+ if( !fossil_isdigit(z[1]) ) return 0;
118
+ if( !fossil_isdigit(z[2]) ) return 0;
119
+ if( !fossil_isdigit(z[3]) ) return 0;
120120
if( z[4]!='-') return 0;
121
- if( !isdigit(z[5]) ) return 0;
122
- if( !isdigit(z[6]) ) return 0;
121
+ if( !fossil_isdigit(z[5]) ) return 0;
122
+ if( !fossil_isdigit(z[6]) ) return 0;
123123
if( z[7]!='-') return 0;
124
- if( !isdigit(z[8]) ) return 0;
125
- if( !isdigit(z[9]) ) return 0;
124
+ if( !fossil_isdigit(z[8]) ) return 0;
125
+ if( !fossil_isdigit(z[9]) ) return 0;
126126
return 1;
127127
}
128128
129129
/*
130130
** Convert a symbolic tag name into the UUID of a check-in that contains
@@ -280,11 +280,11 @@
280280
281281
if( zName==0 || zName[0]==0 ) return 0;
282282
blob_init(&name, zName, -1);
283283
if( name_to_uuid(&name, -1) ){
284284
blob_reset(&name);
285
- for(i=0; zName[i] && isdigit(zName[i]); i++){}
285
+ for(i=0; zName[i] && fossil_isdigit(zName[i]); i++){}
286286
if( zName[i]==0 ){
287287
rid = atoi(zName);
288288
if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
289289
return rid;
290290
}
@@ -348,11 +348,11 @@
348348
if( zName==0 || zName[0]==0 ) return 0;
349349
blob_init(&name, zName, -1);
350350
rc = name_to_uuid(&name, -1);
351351
if( rc==1 ){
352352
blob_reset(&name);
353
- for(i=0; zName[i] && isdigit(zName[i]); i++){}
353
+ for(i=0; zName[i] && fossil_isdigit(zName[i]); i++){}
354354
if( zName[i]==0 ){
355355
rid = atoi(zName);
356356
if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
357357
return rid;
358358
}
359359
--- src/name.c
+++ src/name.c
@@ -111,20 +111,20 @@
111
112 /*
113 ** Return TRUE if the string begins with an ISO8601 date: YYYY-MM-DD.
114 */
115 static int is_date(const char *z){
116 if( !isdigit(z[0]) ) return 0;
117 if( !isdigit(z[1]) ) return 0;
118 if( !isdigit(z[2]) ) return 0;
119 if( !isdigit(z[3]) ) return 0;
120 if( z[4]!='-') return 0;
121 if( !isdigit(z[5]) ) return 0;
122 if( !isdigit(z[6]) ) return 0;
123 if( z[7]!='-') return 0;
124 if( !isdigit(z[8]) ) return 0;
125 if( !isdigit(z[9]) ) return 0;
126 return 1;
127 }
128
129 /*
130 ** Convert a symbolic tag name into the UUID of a check-in that contains
@@ -280,11 +280,11 @@
280
281 if( zName==0 || zName[0]==0 ) return 0;
282 blob_init(&name, zName, -1);
283 if( name_to_uuid(&name, -1) ){
284 blob_reset(&name);
285 for(i=0; zName[i] && isdigit(zName[i]); i++){}
286 if( zName[i]==0 ){
287 rid = atoi(zName);
288 if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
289 return rid;
290 }
@@ -348,11 +348,11 @@
348 if( zName==0 || zName[0]==0 ) return 0;
349 blob_init(&name, zName, -1);
350 rc = name_to_uuid(&name, -1);
351 if( rc==1 ){
352 blob_reset(&name);
353 for(i=0; zName[i] && isdigit(zName[i]); i++){}
354 if( zName[i]==0 ){
355 rid = atoi(zName);
356 if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
357 return rid;
358 }
359
--- src/name.c
+++ src/name.c
@@ -111,20 +111,20 @@
111
112 /*
113 ** Return TRUE if the string begins with an ISO8601 date: YYYY-MM-DD.
114 */
115 static int is_date(const char *z){
116 if( !fossil_isdigit(z[0]) ) return 0;
117 if( !fossil_isdigit(z[1]) ) return 0;
118 if( !fossil_isdigit(z[2]) ) return 0;
119 if( !fossil_isdigit(z[3]) ) return 0;
120 if( z[4]!='-') return 0;
121 if( !fossil_isdigit(z[5]) ) return 0;
122 if( !fossil_isdigit(z[6]) ) return 0;
123 if( z[7]!='-') return 0;
124 if( !fossil_isdigit(z[8]) ) return 0;
125 if( !fossil_isdigit(z[9]) ) return 0;
126 return 1;
127 }
128
129 /*
130 ** Convert a symbolic tag name into the UUID of a check-in that contains
@@ -280,11 +280,11 @@
280
281 if( zName==0 || zName[0]==0 ) return 0;
282 blob_init(&name, zName, -1);
283 if( name_to_uuid(&name, -1) ){
284 blob_reset(&name);
285 for(i=0; zName[i] && fossil_isdigit(zName[i]); i++){}
286 if( zName[i]==0 ){
287 rid = atoi(zName);
288 if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
289 return rid;
290 }
@@ -348,11 +348,11 @@
348 if( zName==0 || zName[0]==0 ) return 0;
349 blob_init(&name, zName, -1);
350 rc = name_to_uuid(&name, -1);
351 if( rc==1 ){
352 blob_reset(&name);
353 for(i=0; zName[i] && fossil_isdigit(zName[i]); i++){}
354 if( zName[i]==0 ){
355 rid = atoi(zName);
356 if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
357 return rid;
358 }
359
+16 -46
--- src/report.c
+++ src/report.c
@@ -88,22 +88,22 @@
8888
/*
8989
** Remove whitespace from both ends of a string.
9090
*/
9191
char *trim_string(const char *zOrig){
9292
int i;
93
- while( isspace(*zOrig) ){ zOrig++; }
93
+ while( fossil_isspace(*zOrig) ){ zOrig++; }
9494
i = strlen(zOrig);
95
- while( i>0 && isspace(zOrig[i-1]) ){ i--; }
95
+ while( i>0 && fossil_isspace(zOrig[i-1]) ){ i--; }
9696
return mprintf("%.*s", i, zOrig);
9797
}
9898
9999
/*
100100
** Extract a numeric (integer) value from a string.
101101
*/
102102
char *extract_integer(const char *zOrig){
103103
if( zOrig == NULL || zOrig[0] == 0 ) return "";
104
- while( *zOrig && !isdigit(*zOrig) ){ zOrig++; }
104
+ while( *zOrig && !fossil_isdigit(*zOrig) ){ zOrig++; }
105105
if( *zOrig ){
106106
/* we have a digit. atoi() will get as much of the number as it
107107
** can. We'll run it through mprintf() to get a string. Not
108108
** an efficient way to do it, but effective.
109109
*/
@@ -118,18 +118,18 @@
118118
** which also converts any CRNL sequence into a single NL.
119119
*/
120120
char *remove_blank_lines(const char *zOrig){
121121
int i, j, n;
122122
char *z;
123
- for(i=j=0; isspace(zOrig[i]); i++){ if( zOrig[i]=='\n' ) j = i+1; }
123
+ for(i=j=0; fossil_isspace(zOrig[i]); i++){ if( zOrig[i]=='\n' ) j = i+1; }
124124
n = strlen(&zOrig[j]);
125
- while( n>0 && isspace(zOrig[j+n-1]) ){ n--; }
125
+ while( n>0 && fossil_isspace(zOrig[j+n-1]) ){ n--; }
126126
z = mprintf("%.*s", n, &zOrig[j]);
127127
for(i=j=0; z[i]; i++){
128
- if( z[i+1]=='\n' && z[i]!='\n' && isspace(z[i]) ){
128
+ if( z[i+1]=='\n' && z[i]!='\n' && fossil_isspace(z[i]) ){
129129
z[j] = z[i];
130
- while(isspace(z[j]) && z[j] != '\n' ){ j--; }
130
+ while(fossil_isspace(z[j]) && z[j] != '\n' ){ j--; }
131131
j++;
132132
continue;
133133
}
134134
135135
z[j++] = z[i];
@@ -212,11 +212,11 @@
212212
int rc;
213213
214214
/* First make sure the SQL is a single query command by verifying that
215215
** the first token is "SELECT" and that there are no unquoted semicolons.
216216
*/
217
- for(i=0; isspace(zSql[i]); i++){}
217
+ for(i=0; fossil_isspace(zSql[i]); i++){}
218218
if( strncasecmp(&zSql[i],"select",6)!=0 ){
219219
return mprintf("The SQL must be a SELECT statement");
220220
}
221221
for(i=0; zSql[i]; i++){
222222
if( zSql[i]==';' ){
@@ -583,39 +583,10 @@
583583
@ FROM ticket
584584
@ </pre></blockquote>
585585
@
586586
}
587587
588
-#if 0 /* NOT USED */
589
-static void column_header(int rn,const char *zCol, int nCol, int nSorted,
590
- const char *zDirection, const char *zExtra
591
-){
592
- int set = (nCol==nSorted);
593
- int desc = !strcmp(zDirection,"DESC");
594
-
595
- /*
596
- ** Clicking same column header 3 times in a row resets any sorting.
597
- ** Note that we link to rptview, which means embedded reports will get
598
- ** sent to the actual report view page as soon as a user tries to do
599
- ** any sorting. I don't see that as a Bad Thing.
600
- */
601
- if(set && desc){
602
- @ <th bgcolor="%s(BG1)" class="bkgnd1">
603
- @ <a href="rptview?rn=%d(rn)%s(zExtra)">%h(zCol)</a></th>
604
- }else{
605
- if(set){
606
- @ <th bgcolor="%s(BG1)" class="bkgnd1"><a
607
- }else{
608
- @ <th><a
609
- }
610
- @ href="rptview?rn=%d(rn)&amp;order_by=%d(nCol)&amp;\
611
- @ order_dir=%s(desc?"ASC":"DESC")\
612
- @ %s(zExtra)">%h(zCol)</a></th>
613
- }
614
-}
615
-#endif
616
-
617588
/*
618589
** The state of the report generation.
619590
*/
620591
struct GenerateHTML {
621592
int rn; /* Report number */
@@ -772,15 +743,15 @@
772743
** spaces.
773744
*/
774745
static void output_no_tabs(const char *z){
775746
while( z && z[0] ){
776747
int i, j;
777
- for(i=0; z[i] && (!isspace(z[i]) || z[i]==' '); i++){}
748
+ for(i=0; z[i] && (!fossil_isspace(z[i]) || z[i]==' '); i++){}
778749
if( i>0 ){
779750
cgi_printf("%.*s", i, z);
780751
}
781
- for(j=i; isspace(z[j]); j++){}
752
+ for(j=i; fossil_isspace(z[j]); j++){}
782753
if( j>i ){
783754
cgi_printf("%*s", j-i, "");
784755
}
785756
z += j;
786757
}
@@ -816,21 +787,21 @@
816787
** Generate HTML that describes a color key.
817788
*/
818789
void output_color_key(const char *zClrKey, int horiz, char *zTabArgs){
819790
int i, j, k;
820791
char *zSafeKey, *zToFree;
821
- while( isspace(*zClrKey) ) zClrKey++;
792
+ while( fossil_isspace(*zClrKey) ) zClrKey++;
822793
if( zClrKey[0]==0 ) return;
823794
@ <table %s(zTabArgs)>
824795
if( horiz ){
825796
@ <tr>
826797
}
827798
zToFree = zSafeKey = mprintf("%h", zClrKey);
828799
while( zSafeKey[0] ){
829
- while( isspace(*zSafeKey) ) zSafeKey++;
830
- for(i=0; zSafeKey[i] && !isspace(zSafeKey[i]); i++){}
831
- for(j=i; isspace(zSafeKey[j]); j++){}
800
+ while( fossil_isspace(*zSafeKey) ) zSafeKey++;
801
+ for(i=0; zSafeKey[i] && !fossil_isspace(zSafeKey[i]); i++){}
802
+ for(j=i; fossil_isspace(zSafeKey[j]); j++){}
832803
for(k=j; zSafeKey[k] && zSafeKey[k]!='\n' && zSafeKey[k]!='\r'; k++){}
833804
if( !horiz ){
834805
cgi_printf("<tr style=\"background-color: %.*s;\"><td>%.*s</td></tr>\n",
835806
i, zSafeKey, k-j, &zSafeKey[j]);
836807
}else{
@@ -1006,15 +977,15 @@
1006977
break;
1007978
}
1008979
default:
1009980
while( z && z[0] ){
1010981
int i, j;
1011
- for(i=0; z[i] && (!isspace(z[i]) || z[i]==' '); i++){}
982
+ for(i=0; z[i] && (!fossil_isspace(z[i]) || z[i]==' '); i++){}
1012983
if( i>0 ){
1013984
printf("%.*s", i, z);
1014985
}
1015
- for(j=i; isspace(z[j]); j++){}
986
+ for(j=i; fossil_isspace(z[j]); j++){}
1016987
if( j>i ){
1017988
printf("%*s", j-i, "");
1018989
}
1019990
z += j;
1020991
}
@@ -1105,6 +1076,5 @@
11051076
sqlite3_set_authorizer(g.db, 0, 0);
11061077
if( zFilter ){
11071078
free(zSql);
11081079
}
11091080
}
1110
-
11111081
--- src/report.c
+++ src/report.c
@@ -88,22 +88,22 @@
88 /*
89 ** Remove whitespace from both ends of a string.
90 */
91 char *trim_string(const char *zOrig){
92 int i;
93 while( isspace(*zOrig) ){ zOrig++; }
94 i = strlen(zOrig);
95 while( i>0 && isspace(zOrig[i-1]) ){ i--; }
96 return mprintf("%.*s", i, zOrig);
97 }
98
99 /*
100 ** Extract a numeric (integer) value from a string.
101 */
102 char *extract_integer(const char *zOrig){
103 if( zOrig == NULL || zOrig[0] == 0 ) return "";
104 while( *zOrig && !isdigit(*zOrig) ){ zOrig++; }
105 if( *zOrig ){
106 /* we have a digit. atoi() will get as much of the number as it
107 ** can. We'll run it through mprintf() to get a string. Not
108 ** an efficient way to do it, but effective.
109 */
@@ -118,18 +118,18 @@
118 ** which also converts any CRNL sequence into a single NL.
119 */
120 char *remove_blank_lines(const char *zOrig){
121 int i, j, n;
122 char *z;
123 for(i=j=0; isspace(zOrig[i]); i++){ if( zOrig[i]=='\n' ) j = i+1; }
124 n = strlen(&zOrig[j]);
125 while( n>0 && isspace(zOrig[j+n-1]) ){ n--; }
126 z = mprintf("%.*s", n, &zOrig[j]);
127 for(i=j=0; z[i]; i++){
128 if( z[i+1]=='\n' && z[i]!='\n' && isspace(z[i]) ){
129 z[j] = z[i];
130 while(isspace(z[j]) && z[j] != '\n' ){ j--; }
131 j++;
132 continue;
133 }
134
135 z[j++] = z[i];
@@ -212,11 +212,11 @@
212 int rc;
213
214 /* First make sure the SQL is a single query command by verifying that
215 ** the first token is "SELECT" and that there are no unquoted semicolons.
216 */
217 for(i=0; isspace(zSql[i]); i++){}
218 if( strncasecmp(&zSql[i],"select",6)!=0 ){
219 return mprintf("The SQL must be a SELECT statement");
220 }
221 for(i=0; zSql[i]; i++){
222 if( zSql[i]==';' ){
@@ -583,39 +583,10 @@
583 @ FROM ticket
584 @ </pre></blockquote>
585 @
586 }
587
588 #if 0 /* NOT USED */
589 static void column_header(int rn,const char *zCol, int nCol, int nSorted,
590 const char *zDirection, const char *zExtra
591 ){
592 int set = (nCol==nSorted);
593 int desc = !strcmp(zDirection,"DESC");
594
595 /*
596 ** Clicking same column header 3 times in a row resets any sorting.
597 ** Note that we link to rptview, which means embedded reports will get
598 ** sent to the actual report view page as soon as a user tries to do
599 ** any sorting. I don't see that as a Bad Thing.
600 */
601 if(set && desc){
602 @ <th bgcolor="%s(BG1)" class="bkgnd1">
603 @ <a href="rptview?rn=%d(rn)%s(zExtra)">%h(zCol)</a></th>
604 }else{
605 if(set){
606 @ <th bgcolor="%s(BG1)" class="bkgnd1"><a
607 }else{
608 @ <th><a
609 }
610 @ href="rptview?rn=%d(rn)&amp;order_by=%d(nCol)&amp;\
611 @ order_dir=%s(desc?"ASC":"DESC")\
612 @ %s(zExtra)">%h(zCol)</a></th>
613 }
614 }
615 #endif
616
617 /*
618 ** The state of the report generation.
619 */
620 struct GenerateHTML {
621 int rn; /* Report number */
@@ -772,15 +743,15 @@
772 ** spaces.
773 */
774 static void output_no_tabs(const char *z){
775 while( z && z[0] ){
776 int i, j;
777 for(i=0; z[i] && (!isspace(z[i]) || z[i]==' '); i++){}
778 if( i>0 ){
779 cgi_printf("%.*s", i, z);
780 }
781 for(j=i; isspace(z[j]); j++){}
782 if( j>i ){
783 cgi_printf("%*s", j-i, "");
784 }
785 z += j;
786 }
@@ -816,21 +787,21 @@
816 ** Generate HTML that describes a color key.
817 */
818 void output_color_key(const char *zClrKey, int horiz, char *zTabArgs){
819 int i, j, k;
820 char *zSafeKey, *zToFree;
821 while( isspace(*zClrKey) ) zClrKey++;
822 if( zClrKey[0]==0 ) return;
823 @ <table %s(zTabArgs)>
824 if( horiz ){
825 @ <tr>
826 }
827 zToFree = zSafeKey = mprintf("%h", zClrKey);
828 while( zSafeKey[0] ){
829 while( isspace(*zSafeKey) ) zSafeKey++;
830 for(i=0; zSafeKey[i] && !isspace(zSafeKey[i]); i++){}
831 for(j=i; isspace(zSafeKey[j]); j++){}
832 for(k=j; zSafeKey[k] && zSafeKey[k]!='\n' && zSafeKey[k]!='\r'; k++){}
833 if( !horiz ){
834 cgi_printf("<tr style=\"background-color: %.*s;\"><td>%.*s</td></tr>\n",
835 i, zSafeKey, k-j, &zSafeKey[j]);
836 }else{
@@ -1006,15 +977,15 @@
1006 break;
1007 }
1008 default:
1009 while( z && z[0] ){
1010 int i, j;
1011 for(i=0; z[i] && (!isspace(z[i]) || z[i]==' '); i++){}
1012 if( i>0 ){
1013 printf("%.*s", i, z);
1014 }
1015 for(j=i; isspace(z[j]); j++){}
1016 if( j>i ){
1017 printf("%*s", j-i, "");
1018 }
1019 z += j;
1020 }
@@ -1105,6 +1076,5 @@
1105 sqlite3_set_authorizer(g.db, 0, 0);
1106 if( zFilter ){
1107 free(zSql);
1108 }
1109 }
1110
1111
--- src/report.c
+++ src/report.c
@@ -88,22 +88,22 @@
88 /*
89 ** Remove whitespace from both ends of a string.
90 */
91 char *trim_string(const char *zOrig){
92 int i;
93 while( fossil_isspace(*zOrig) ){ zOrig++; }
94 i = strlen(zOrig);
95 while( i>0 && fossil_isspace(zOrig[i-1]) ){ i--; }
96 return mprintf("%.*s", i, zOrig);
97 }
98
99 /*
100 ** Extract a numeric (integer) value from a string.
101 */
102 char *extract_integer(const char *zOrig){
103 if( zOrig == NULL || zOrig[0] == 0 ) return "";
104 while( *zOrig && !fossil_isdigit(*zOrig) ){ zOrig++; }
105 if( *zOrig ){
106 /* we have a digit. atoi() will get as much of the number as it
107 ** can. We'll run it through mprintf() to get a string. Not
108 ** an efficient way to do it, but effective.
109 */
@@ -118,18 +118,18 @@
118 ** which also converts any CRNL sequence into a single NL.
119 */
120 char *remove_blank_lines(const char *zOrig){
121 int i, j, n;
122 char *z;
123 for(i=j=0; fossil_isspace(zOrig[i]); i++){ if( zOrig[i]=='\n' ) j = i+1; }
124 n = strlen(&zOrig[j]);
125 while( n>0 && fossil_isspace(zOrig[j+n-1]) ){ n--; }
126 z = mprintf("%.*s", n, &zOrig[j]);
127 for(i=j=0; z[i]; i++){
128 if( z[i+1]=='\n' && z[i]!='\n' && fossil_isspace(z[i]) ){
129 z[j] = z[i];
130 while(fossil_isspace(z[j]) && z[j] != '\n' ){ j--; }
131 j++;
132 continue;
133 }
134
135 z[j++] = z[i];
@@ -212,11 +212,11 @@
212 int rc;
213
214 /* First make sure the SQL is a single query command by verifying that
215 ** the first token is "SELECT" and that there are no unquoted semicolons.
216 */
217 for(i=0; fossil_isspace(zSql[i]); i++){}
218 if( strncasecmp(&zSql[i],"select",6)!=0 ){
219 return mprintf("The SQL must be a SELECT statement");
220 }
221 for(i=0; zSql[i]; i++){
222 if( zSql[i]==';' ){
@@ -583,39 +583,10 @@
583 @ FROM ticket
584 @ </pre></blockquote>
585 @
586 }
587
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
588 /*
589 ** The state of the report generation.
590 */
591 struct GenerateHTML {
592 int rn; /* Report number */
@@ -772,15 +743,15 @@
743 ** spaces.
744 */
745 static void output_no_tabs(const char *z){
746 while( z && z[0] ){
747 int i, j;
748 for(i=0; z[i] && (!fossil_isspace(z[i]) || z[i]==' '); i++){}
749 if( i>0 ){
750 cgi_printf("%.*s", i, z);
751 }
752 for(j=i; fossil_isspace(z[j]); j++){}
753 if( j>i ){
754 cgi_printf("%*s", j-i, "");
755 }
756 z += j;
757 }
@@ -816,21 +787,21 @@
787 ** Generate HTML that describes a color key.
788 */
789 void output_color_key(const char *zClrKey, int horiz, char *zTabArgs){
790 int i, j, k;
791 char *zSafeKey, *zToFree;
792 while( fossil_isspace(*zClrKey) ) zClrKey++;
793 if( zClrKey[0]==0 ) return;
794 @ <table %s(zTabArgs)>
795 if( horiz ){
796 @ <tr>
797 }
798 zToFree = zSafeKey = mprintf("%h", zClrKey);
799 while( zSafeKey[0] ){
800 while( fossil_isspace(*zSafeKey) ) zSafeKey++;
801 for(i=0; zSafeKey[i] && !fossil_isspace(zSafeKey[i]); i++){}
802 for(j=i; fossil_isspace(zSafeKey[j]); j++){}
803 for(k=j; zSafeKey[k] && zSafeKey[k]!='\n' && zSafeKey[k]!='\r'; k++){}
804 if( !horiz ){
805 cgi_printf("<tr style=\"background-color: %.*s;\"><td>%.*s</td></tr>\n",
806 i, zSafeKey, k-j, &zSafeKey[j]);
807 }else{
@@ -1006,15 +977,15 @@
977 break;
978 }
979 default:
980 while( z && z[0] ){
981 int i, j;
982 for(i=0; z[i] && (!fossil_isspace(z[i]) || z[i]==' '); i++){}
983 if( i>0 ){
984 printf("%.*s", i, z);
985 }
986 for(j=i; fossil_isspace(z[j]); j++){}
987 if( j>i ){
988 printf("%*s", j-i, "");
989 }
990 z += j;
991 }
@@ -1105,6 +1076,5 @@
1076 sqlite3_set_authorizer(g.db, 0, 0);
1077 if( zFilter ){
1078 free(zSql);
1079 }
1080 }
 
1081
+16 -46
--- src/report.c
+++ src/report.c
@@ -88,22 +88,22 @@
8888
/*
8989
** Remove whitespace from both ends of a string.
9090
*/
9191
char *trim_string(const char *zOrig){
9292
int i;
93
- while( isspace(*zOrig) ){ zOrig++; }
93
+ while( fossil_isspace(*zOrig) ){ zOrig++; }
9494
i = strlen(zOrig);
95
- while( i>0 && isspace(zOrig[i-1]) ){ i--; }
95
+ while( i>0 && fossil_isspace(zOrig[i-1]) ){ i--; }
9696
return mprintf("%.*s", i, zOrig);
9797
}
9898
9999
/*
100100
** Extract a numeric (integer) value from a string.
101101
*/
102102
char *extract_integer(const char *zOrig){
103103
if( zOrig == NULL || zOrig[0] == 0 ) return "";
104
- while( *zOrig && !isdigit(*zOrig) ){ zOrig++; }
104
+ while( *zOrig && !fossil_isdigit(*zOrig) ){ zOrig++; }
105105
if( *zOrig ){
106106
/* we have a digit. atoi() will get as much of the number as it
107107
** can. We'll run it through mprintf() to get a string. Not
108108
** an efficient way to do it, but effective.
109109
*/
@@ -118,18 +118,18 @@
118118
** which also converts any CRNL sequence into a single NL.
119119
*/
120120
char *remove_blank_lines(const char *zOrig){
121121
int i, j, n;
122122
char *z;
123
- for(i=j=0; isspace(zOrig[i]); i++){ if( zOrig[i]=='\n' ) j = i+1; }
123
+ for(i=j=0; fossil_isspace(zOrig[i]); i++){ if( zOrig[i]=='\n' ) j = i+1; }
124124
n = strlen(&zOrig[j]);
125
- while( n>0 && isspace(zOrig[j+n-1]) ){ n--; }
125
+ while( n>0 && fossil_isspace(zOrig[j+n-1]) ){ n--; }
126126
z = mprintf("%.*s", n, &zOrig[j]);
127127
for(i=j=0; z[i]; i++){
128
- if( z[i+1]=='\n' && z[i]!='\n' && isspace(z[i]) ){
128
+ if( z[i+1]=='\n' && z[i]!='\n' && fossil_isspace(z[i]) ){
129129
z[j] = z[i];
130
- while(isspace(z[j]) && z[j] != '\n' ){ j--; }
130
+ while(fossil_isspace(z[j]) && z[j] != '\n' ){ j--; }
131131
j++;
132132
continue;
133133
}
134134
135135
z[j++] = z[i];
@@ -212,11 +212,11 @@
212212
int rc;
213213
214214
/* First make sure the SQL is a single query command by verifying that
215215
** the first token is "SELECT" and that there are no unquoted semicolons.
216216
*/
217
- for(i=0; isspace(zSql[i]); i++){}
217
+ for(i=0; fossil_isspace(zSql[i]); i++){}
218218
if( strncasecmp(&zSql[i],"select",6)!=0 ){
219219
return mprintf("The SQL must be a SELECT statement");
220220
}
221221
for(i=0; zSql[i]; i++){
222222
if( zSql[i]==';' ){
@@ -583,39 +583,10 @@
583583
@ FROM ticket
584584
@ </pre></blockquote>
585585
@
586586
}
587587
588
-#if 0 /* NOT USED */
589
-static void column_header(int rn,const char *zCol, int nCol, int nSorted,
590
- const char *zDirection, const char *zExtra
591
-){
592
- int set = (nCol==nSorted);
593
- int desc = !strcmp(zDirection,"DESC");
594
-
595
- /*
596
- ** Clicking same column header 3 times in a row resets any sorting.
597
- ** Note that we link to rptview, which means embedded reports will get
598
- ** sent to the actual report view page as soon as a user tries to do
599
- ** any sorting. I don't see that as a Bad Thing.
600
- */
601
- if(set && desc){
602
- @ <th bgcolor="%s(BG1)" class="bkgnd1">
603
- @ <a href="rptview?rn=%d(rn)%s(zExtra)">%h(zCol)</a></th>
604
- }else{
605
- if(set){
606
- @ <th bgcolor="%s(BG1)" class="bkgnd1"><a
607
- }else{
608
- @ <th><a
609
- }
610
- @ href="rptview?rn=%d(rn)&amp;order_by=%d(nCol)&amp;\
611
- @ order_dir=%s(desc?"ASC":"DESC")\
612
- @ %s(zExtra)">%h(zCol)</a></th>
613
- }
614
-}
615
-#endif
616
-
617588
/*
618589
** The state of the report generation.
619590
*/
620591
struct GenerateHTML {
621592
int rn; /* Report number */
@@ -772,15 +743,15 @@
772743
** spaces.
773744
*/
774745
static void output_no_tabs(const char *z){
775746
while( z && z[0] ){
776747
int i, j;
777
- for(i=0; z[i] && (!isspace(z[i]) || z[i]==' '); i++){}
748
+ for(i=0; z[i] && (!fossil_isspace(z[i]) || z[i]==' '); i++){}
778749
if( i>0 ){
779750
cgi_printf("%.*s", i, z);
780751
}
781
- for(j=i; isspace(z[j]); j++){}
752
+ for(j=i; fossil_isspace(z[j]); j++){}
782753
if( j>i ){
783754
cgi_printf("%*s", j-i, "");
784755
}
785756
z += j;
786757
}
@@ -816,21 +787,21 @@
816787
** Generate HTML that describes a color key.
817788
*/
818789
void output_color_key(const char *zClrKey, int horiz, char *zTabArgs){
819790
int i, j, k;
820791
char *zSafeKey, *zToFree;
821
- while( isspace(*zClrKey) ) zClrKey++;
792
+ while( fossil_isspace(*zClrKey) ) zClrKey++;
822793
if( zClrKey[0]==0 ) return;
823794
@ <table %s(zTabArgs)>
824795
if( horiz ){
825796
@ <tr>
826797
}
827798
zToFree = zSafeKey = mprintf("%h", zClrKey);
828799
while( zSafeKey[0] ){
829
- while( isspace(*zSafeKey) ) zSafeKey++;
830
- for(i=0; zSafeKey[i] && !isspace(zSafeKey[i]); i++){}
831
- for(j=i; isspace(zSafeKey[j]); j++){}
800
+ while( fossil_isspace(*zSafeKey) ) zSafeKey++;
801
+ for(i=0; zSafeKey[i] && !fossil_isspace(zSafeKey[i]); i++){}
802
+ for(j=i; fossil_isspace(zSafeKey[j]); j++){}
832803
for(k=j; zSafeKey[k] && zSafeKey[k]!='\n' && zSafeKey[k]!='\r'; k++){}
833804
if( !horiz ){
834805
cgi_printf("<tr style=\"background-color: %.*s;\"><td>%.*s</td></tr>\n",
835806
i, zSafeKey, k-j, &zSafeKey[j]);
836807
}else{
@@ -1006,15 +977,15 @@
1006977
break;
1007978
}
1008979
default:
1009980
while( z && z[0] ){
1010981
int i, j;
1011
- for(i=0; z[i] && (!isspace(z[i]) || z[i]==' '); i++){}
982
+ for(i=0; z[i] && (!fossil_isspace(z[i]) || z[i]==' '); i++){}
1012983
if( i>0 ){
1013984
printf("%.*s", i, z);
1014985
}
1015
- for(j=i; isspace(z[j]); j++){}
986
+ for(j=i; fossil_isspace(z[j]); j++){}
1016987
if( j>i ){
1017988
printf("%*s", j-i, "");
1018989
}
1019990
z += j;
1020991
}
@@ -1105,6 +1076,5 @@
11051076
sqlite3_set_authorizer(g.db, 0, 0);
11061077
if( zFilter ){
11071078
free(zSql);
11081079
}
11091080
}
1110
-
11111081
--- src/report.c
+++ src/report.c
@@ -88,22 +88,22 @@
88 /*
89 ** Remove whitespace from both ends of a string.
90 */
91 char *trim_string(const char *zOrig){
92 int i;
93 while( isspace(*zOrig) ){ zOrig++; }
94 i = strlen(zOrig);
95 while( i>0 && isspace(zOrig[i-1]) ){ i--; }
96 return mprintf("%.*s", i, zOrig);
97 }
98
99 /*
100 ** Extract a numeric (integer) value from a string.
101 */
102 char *extract_integer(const char *zOrig){
103 if( zOrig == NULL || zOrig[0] == 0 ) return "";
104 while( *zOrig && !isdigit(*zOrig) ){ zOrig++; }
105 if( *zOrig ){
106 /* we have a digit. atoi() will get as much of the number as it
107 ** can. We'll run it through mprintf() to get a string. Not
108 ** an efficient way to do it, but effective.
109 */
@@ -118,18 +118,18 @@
118 ** which also converts any CRNL sequence into a single NL.
119 */
120 char *remove_blank_lines(const char *zOrig){
121 int i, j, n;
122 char *z;
123 for(i=j=0; isspace(zOrig[i]); i++){ if( zOrig[i]=='\n' ) j = i+1; }
124 n = strlen(&zOrig[j]);
125 while( n>0 && isspace(zOrig[j+n-1]) ){ n--; }
126 z = mprintf("%.*s", n, &zOrig[j]);
127 for(i=j=0; z[i]; i++){
128 if( z[i+1]=='\n' && z[i]!='\n' && isspace(z[i]) ){
129 z[j] = z[i];
130 while(isspace(z[j]) && z[j] != '\n' ){ j--; }
131 j++;
132 continue;
133 }
134
135 z[j++] = z[i];
@@ -212,11 +212,11 @@
212 int rc;
213
214 /* First make sure the SQL is a single query command by verifying that
215 ** the first token is "SELECT" and that there are no unquoted semicolons.
216 */
217 for(i=0; isspace(zSql[i]); i++){}
218 if( strncasecmp(&zSql[i],"select",6)!=0 ){
219 return mprintf("The SQL must be a SELECT statement");
220 }
221 for(i=0; zSql[i]; i++){
222 if( zSql[i]==';' ){
@@ -583,39 +583,10 @@
583 @ FROM ticket
584 @ </pre></blockquote>
585 @
586 }
587
588 #if 0 /* NOT USED */
589 static void column_header(int rn,const char *zCol, int nCol, int nSorted,
590 const char *zDirection, const char *zExtra
591 ){
592 int set = (nCol==nSorted);
593 int desc = !strcmp(zDirection,"DESC");
594
595 /*
596 ** Clicking same column header 3 times in a row resets any sorting.
597 ** Note that we link to rptview, which means embedded reports will get
598 ** sent to the actual report view page as soon as a user tries to do
599 ** any sorting. I don't see that as a Bad Thing.
600 */
601 if(set && desc){
602 @ <th bgcolor="%s(BG1)" class="bkgnd1">
603 @ <a href="rptview?rn=%d(rn)%s(zExtra)">%h(zCol)</a></th>
604 }else{
605 if(set){
606 @ <th bgcolor="%s(BG1)" class="bkgnd1"><a
607 }else{
608 @ <th><a
609 }
610 @ href="rptview?rn=%d(rn)&amp;order_by=%d(nCol)&amp;\
611 @ order_dir=%s(desc?"ASC":"DESC")\
612 @ %s(zExtra)">%h(zCol)</a></th>
613 }
614 }
615 #endif
616
617 /*
618 ** The state of the report generation.
619 */
620 struct GenerateHTML {
621 int rn; /* Report number */
@@ -772,15 +743,15 @@
772 ** spaces.
773 */
774 static void output_no_tabs(const char *z){
775 while( z && z[0] ){
776 int i, j;
777 for(i=0; z[i] && (!isspace(z[i]) || z[i]==' '); i++){}
778 if( i>0 ){
779 cgi_printf("%.*s", i, z);
780 }
781 for(j=i; isspace(z[j]); j++){}
782 if( j>i ){
783 cgi_printf("%*s", j-i, "");
784 }
785 z += j;
786 }
@@ -816,21 +787,21 @@
816 ** Generate HTML that describes a color key.
817 */
818 void output_color_key(const char *zClrKey, int horiz, char *zTabArgs){
819 int i, j, k;
820 char *zSafeKey, *zToFree;
821 while( isspace(*zClrKey) ) zClrKey++;
822 if( zClrKey[0]==0 ) return;
823 @ <table %s(zTabArgs)>
824 if( horiz ){
825 @ <tr>
826 }
827 zToFree = zSafeKey = mprintf("%h", zClrKey);
828 while( zSafeKey[0] ){
829 while( isspace(*zSafeKey) ) zSafeKey++;
830 for(i=0; zSafeKey[i] && !isspace(zSafeKey[i]); i++){}
831 for(j=i; isspace(zSafeKey[j]); j++){}
832 for(k=j; zSafeKey[k] && zSafeKey[k]!='\n' && zSafeKey[k]!='\r'; k++){}
833 if( !horiz ){
834 cgi_printf("<tr style=\"background-color: %.*s;\"><td>%.*s</td></tr>\n",
835 i, zSafeKey, k-j, &zSafeKey[j]);
836 }else{
@@ -1006,15 +977,15 @@
1006 break;
1007 }
1008 default:
1009 while( z && z[0] ){
1010 int i, j;
1011 for(i=0; z[i] && (!isspace(z[i]) || z[i]==' '); i++){}
1012 if( i>0 ){
1013 printf("%.*s", i, z);
1014 }
1015 for(j=i; isspace(z[j]); j++){}
1016 if( j>i ){
1017 printf("%*s", j-i, "");
1018 }
1019 z += j;
1020 }
@@ -1105,6 +1076,5 @@
1105 sqlite3_set_authorizer(g.db, 0, 0);
1106 if( zFilter ){
1107 free(zSql);
1108 }
1109 }
1110
1111
--- src/report.c
+++ src/report.c
@@ -88,22 +88,22 @@
88 /*
89 ** Remove whitespace from both ends of a string.
90 */
91 char *trim_string(const char *zOrig){
92 int i;
93 while( fossil_isspace(*zOrig) ){ zOrig++; }
94 i = strlen(zOrig);
95 while( i>0 && fossil_isspace(zOrig[i-1]) ){ i--; }
96 return mprintf("%.*s", i, zOrig);
97 }
98
99 /*
100 ** Extract a numeric (integer) value from a string.
101 */
102 char *extract_integer(const char *zOrig){
103 if( zOrig == NULL || zOrig[0] == 0 ) return "";
104 while( *zOrig && !fossil_isdigit(*zOrig) ){ zOrig++; }
105 if( *zOrig ){
106 /* we have a digit. atoi() will get as much of the number as it
107 ** can. We'll run it through mprintf() to get a string. Not
108 ** an efficient way to do it, but effective.
109 */
@@ -118,18 +118,18 @@
118 ** which also converts any CRNL sequence into a single NL.
119 */
120 char *remove_blank_lines(const char *zOrig){
121 int i, j, n;
122 char *z;
123 for(i=j=0; fossil_isspace(zOrig[i]); i++){ if( zOrig[i]=='\n' ) j = i+1; }
124 n = strlen(&zOrig[j]);
125 while( n>0 && fossil_isspace(zOrig[j+n-1]) ){ n--; }
126 z = mprintf("%.*s", n, &zOrig[j]);
127 for(i=j=0; z[i]; i++){
128 if( z[i+1]=='\n' && z[i]!='\n' && fossil_isspace(z[i]) ){
129 z[j] = z[i];
130 while(fossil_isspace(z[j]) && z[j] != '\n' ){ j--; }
131 j++;
132 continue;
133 }
134
135 z[j++] = z[i];
@@ -212,11 +212,11 @@
212 int rc;
213
214 /* First make sure the SQL is a single query command by verifying that
215 ** the first token is "SELECT" and that there are no unquoted semicolons.
216 */
217 for(i=0; fossil_isspace(zSql[i]); i++){}
218 if( strncasecmp(&zSql[i],"select",6)!=0 ){
219 return mprintf("The SQL must be a SELECT statement");
220 }
221 for(i=0; zSql[i]; i++){
222 if( zSql[i]==';' ){
@@ -583,39 +583,10 @@
583 @ FROM ticket
584 @ </pre></blockquote>
585 @
586 }
587
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
588 /*
589 ** The state of the report generation.
590 */
591 struct GenerateHTML {
592 int rn; /* Report number */
@@ -772,15 +743,15 @@
743 ** spaces.
744 */
745 static void output_no_tabs(const char *z){
746 while( z && z[0] ){
747 int i, j;
748 for(i=0; z[i] && (!fossil_isspace(z[i]) || z[i]==' '); i++){}
749 if( i>0 ){
750 cgi_printf("%.*s", i, z);
751 }
752 for(j=i; fossil_isspace(z[j]); j++){}
753 if( j>i ){
754 cgi_printf("%*s", j-i, "");
755 }
756 z += j;
757 }
@@ -816,21 +787,21 @@
787 ** Generate HTML that describes a color key.
788 */
789 void output_color_key(const char *zClrKey, int horiz, char *zTabArgs){
790 int i, j, k;
791 char *zSafeKey, *zToFree;
792 while( fossil_isspace(*zClrKey) ) zClrKey++;
793 if( zClrKey[0]==0 ) return;
794 @ <table %s(zTabArgs)>
795 if( horiz ){
796 @ <tr>
797 }
798 zToFree = zSafeKey = mprintf("%h", zClrKey);
799 while( zSafeKey[0] ){
800 while( fossil_isspace(*zSafeKey) ) zSafeKey++;
801 for(i=0; zSafeKey[i] && !fossil_isspace(zSafeKey[i]); i++){}
802 for(j=i; fossil_isspace(zSafeKey[j]); j++){}
803 for(k=j; zSafeKey[k] && zSafeKey[k]!='\n' && zSafeKey[k]!='\r'; k++){}
804 if( !horiz ){
805 cgi_printf("<tr style=\"background-color: %.*s;\"><td>%.*s</td></tr>\n",
806 i, zSafeKey, k-j, &zSafeKey[j]);
807 }else{
@@ -1006,15 +977,15 @@
977 break;
978 }
979 default:
980 while( z && z[0] ){
981 int i, j;
982 for(i=0; z[i] && (!fossil_isspace(z[i]) || z[i]==' '); i++){}
983 if( i>0 ){
984 printf("%.*s", i, z);
985 }
986 for(j=i; fossil_isspace(z[j]); j++){}
987 if( j>i ){
988 printf("%*s", j-i, "");
989 }
990 z += j;
991 }
@@ -1105,6 +1076,5 @@
1076 sqlite3_set_authorizer(g.db, 0, 0);
1077 if( zFilter ){
1078 free(zSql);
1079 }
1080 }
 
1081
+2 -2
--- src/search.c
+++ src/search.c
@@ -48,14 +48,14 @@
4848
if( p==0 ) fossil_panic("out of memory");
4949
z = (char*)&p[1];
5050
strcpy(z, zPattern);
5151
memset(p, 0, sizeof(*p));
5252
while( *z && p->nTerm<sizeof(p->a)/sizeof(p->a[0]) ){
53
- while( !isalnum(*z) && *z ){ z++; }
53
+ while( !fossil_isalnum(*z) && *z ){ z++; }
5454
if( *z==0 ) break;
5555
p->a[p->nTerm].z = z;
56
- for(i=1; isalnum(z[i]) || z[i]=='_'; i++){}
56
+ for(i=1; fossil_isalnum(z[i]) || z[i]=='_'; i++){}
5757
p->a[p->nTerm].n = i;
5858
z += i;
5959
p->nTerm++;
6060
}
6161
return p;
6262
--- src/search.c
+++ src/search.c
@@ -48,14 +48,14 @@
48 if( p==0 ) fossil_panic("out of memory");
49 z = (char*)&p[1];
50 strcpy(z, zPattern);
51 memset(p, 0, sizeof(*p));
52 while( *z && p->nTerm<sizeof(p->a)/sizeof(p->a[0]) ){
53 while( !isalnum(*z) && *z ){ z++; }
54 if( *z==0 ) break;
55 p->a[p->nTerm].z = z;
56 for(i=1; isalnum(z[i]) || z[i]=='_'; i++){}
57 p->a[p->nTerm].n = i;
58 z += i;
59 p->nTerm++;
60 }
61 return p;
62
--- src/search.c
+++ src/search.c
@@ -48,14 +48,14 @@
48 if( p==0 ) fossil_panic("out of memory");
49 z = (char*)&p[1];
50 strcpy(z, zPattern);
51 memset(p, 0, sizeof(*p));
52 while( *z && p->nTerm<sizeof(p->a)/sizeof(p->a[0]) ){
53 while( !fossil_isalnum(*z) && *z ){ z++; }
54 if( *z==0 ) break;
55 p->a[p->nTerm].z = z;
56 for(i=1; fossil_isalnum(z[i]) || z[i]=='_'; i++){}
57 p->a[p->nTerm].n = i;
58 z += i;
59 p->nTerm++;
60 }
61 return p;
62
+2 -1
--- src/th_lang.c
+++ src/th_lang.c
@@ -7,10 +7,11 @@
77
** declared in th.h, so this file serves as both a part of the language
88
** implementation and an example of how to extend the language with
99
** new commands.
1010
*/
1111
12
+#include "config.h"
1213
#include "th.h"
1314
#include <string.h>
1415
#include <assert.h>
1516
1617
int Th_WrongNumArgs(Th_Interp *interp, const char *zMsg){
@@ -571,11 +572,11 @@
571572
return Th_WrongNumArgs(interp, "return ?value?");
572573
}
573574
if( argc==2 ){
574575
Th_SetResult(interp, argv[1], argl[1]);
575576
}
576
- return (int)ctx;
577
+ return FOSSIL_PTR_TO_INT(ctx);
577578
}
578579
579580
/*
580581
** TH Syntax:
581582
**
582583
--- src/th_lang.c
+++ src/th_lang.c
@@ -7,10 +7,11 @@
7 ** declared in th.h, so this file serves as both a part of the language
8 ** implementation and an example of how to extend the language with
9 ** new commands.
10 */
11
 
12 #include "th.h"
13 #include <string.h>
14 #include <assert.h>
15
16 int Th_WrongNumArgs(Th_Interp *interp, const char *zMsg){
@@ -571,11 +572,11 @@
571 return Th_WrongNumArgs(interp, "return ?value?");
572 }
573 if( argc==2 ){
574 Th_SetResult(interp, argv[1], argl[1]);
575 }
576 return (int)ctx;
577 }
578
579 /*
580 ** TH Syntax:
581 **
582
--- src/th_lang.c
+++ src/th_lang.c
@@ -7,10 +7,11 @@
7 ** declared in th.h, so this file serves as both a part of the language
8 ** implementation and an example of how to extend the language with
9 ** new commands.
10 */
11
12 #include "config.h"
13 #include "th.h"
14 #include <string.h>
15 #include <assert.h>
16
17 int Th_WrongNumArgs(Th_Interp *interp, const char *zMsg){
@@ -571,11 +572,11 @@
572 return Th_WrongNumArgs(interp, "return ?value?");
573 }
574 if( argc==2 ){
575 Th_SetResult(interp, argv[1], argl[1]);
576 }
577 return FOSSIL_PTR_TO_INT(ctx);
578 }
579
580 /*
581 ** TH Syntax:
582 **
583
+3 -3
--- src/th_main.c
+++ src/th_main.c
@@ -435,20 +435,20 @@
435435
int inBracket = 0;
436436
if( z[0]=='<' ){
437437
inBracket = 1;
438438
z++;
439439
}
440
- if( z[0]==':' && z[1]==':' && isalpha(z[2]) ){
440
+ if( z[0]==':' && z[1]==':' && fossil_isalpha(z[2]) ){
441441
z += 3;
442442
i += 3;
443
- }else if( isalpha(z[0]) ){
443
+ }else if( fossil_isalpha(z[0]) ){
444444
z ++;
445445
i += 1;
446446
}else{
447447
return 0;
448448
}
449
- while( isalnum(z[0]) || z[0]=='_' ){
449
+ while( fossil_isalnum(z[0]) || z[0]=='_' ){
450450
z++;
451451
i++;
452452
}
453453
if( inBracket ){
454454
if( z[0]!='>' ) return 0;
455455
--- src/th_main.c
+++ src/th_main.c
@@ -435,20 +435,20 @@
435 int inBracket = 0;
436 if( z[0]=='<' ){
437 inBracket = 1;
438 z++;
439 }
440 if( z[0]==':' && z[1]==':' && isalpha(z[2]) ){
441 z += 3;
442 i += 3;
443 }else if( isalpha(z[0]) ){
444 z ++;
445 i += 1;
446 }else{
447 return 0;
448 }
449 while( isalnum(z[0]) || z[0]=='_' ){
450 z++;
451 i++;
452 }
453 if( inBracket ){
454 if( z[0]!='>' ) return 0;
455
--- src/th_main.c
+++ src/th_main.c
@@ -435,20 +435,20 @@
435 int inBracket = 0;
436 if( z[0]=='<' ){
437 inBracket = 1;
438 z++;
439 }
440 if( z[0]==':' && z[1]==':' && fossil_isalpha(z[2]) ){
441 z += 3;
442 i += 3;
443 }else if( fossil_isalpha(z[0]) ){
444 z ++;
445 i += 1;
446 }else{
447 return 0;
448 }
449 while( fossil_isalnum(z[0]) || z[0]=='_' ){
450 z++;
451 i++;
452 }
453 if( inBracket ){
454 if( z[0]!='>' ) return 0;
455
+5 -5
--- src/timeline.c
+++ src/timeline.c
@@ -830,11 +830,11 @@
830830
" AND (event.comment LIKE '%%%q%%' OR event.brief LIKE '%%%q%%')",
831831
zSearch, zSearch);
832832
url_add_parameter(&url, "s", zSearch);
833833
}
834834
if( zAfter ){
835
- while( isspace(zAfter[0]) ){ zAfter++; }
835
+ while( fossil_isspace(zAfter[0]) ){ zAfter++; }
836836
if( zAfter[0] ){
837837
blob_appendf(&sql,
838838
" AND event.mtime>=(SELECT julianday(%Q, 'utc'))"
839839
" ORDER BY event.mtime ASC", zAfter);
840840
url_add_parameter(&url, "a", zAfter);
@@ -841,21 +841,21 @@
841841
zBefore = 0;
842842
}else{
843843
zAfter = 0;
844844
}
845845
}else if( zBefore ){
846
- while( isspace(zBefore[0]) ){ zBefore++; }
846
+ while( fossil_isspace(zBefore[0]) ){ zBefore++; }
847847
if( zBefore[0] ){
848848
blob_appendf(&sql,
849849
" AND event.mtime<=(SELECT julianday(%Q, 'utc'))"
850850
" ORDER BY event.mtime DESC", zBefore);
851851
url_add_parameter(&url, "b", zBefore);
852852
}else{
853853
zBefore = 0;
854854
}
855855
}else if( zCirca ){
856
- while( isspace(zCirca[0]) ){ zCirca++; }
856
+ while( fossil_isspace(zCirca[0]) ){ zCirca++; }
857857
if( zCirca[0] ){
858858
double rCirca = db_double(0.0, "SELECT julianday(%Q, 'utc')", zCirca);
859859
Blob sql2;
860860
blob_init(&sql2, blob_str(&sql), -1);
861861
blob_appendf(&sql2,
@@ -1060,12 +1060,12 @@
10601060
*/
10611061
static int isIsoDate(const char *z){
10621062
return strlen(z)==10
10631063
&& z[4]=='-'
10641064
&& z[7]=='-'
1065
- && isdigit(z[0])
1066
- && isdigit(z[5]);
1065
+ && fossil_isdigit(z[0])
1066
+ && fossil_isdigit(z[5]);
10671067
}
10681068
10691069
/*
10701070
** COMMAND: timeline
10711071
**
10721072
--- src/timeline.c
+++ src/timeline.c
@@ -830,11 +830,11 @@
830 " AND (event.comment LIKE '%%%q%%' OR event.brief LIKE '%%%q%%')",
831 zSearch, zSearch);
832 url_add_parameter(&url, "s", zSearch);
833 }
834 if( zAfter ){
835 while( isspace(zAfter[0]) ){ zAfter++; }
836 if( zAfter[0] ){
837 blob_appendf(&sql,
838 " AND event.mtime>=(SELECT julianday(%Q, 'utc'))"
839 " ORDER BY event.mtime ASC", zAfter);
840 url_add_parameter(&url, "a", zAfter);
@@ -841,21 +841,21 @@
841 zBefore = 0;
842 }else{
843 zAfter = 0;
844 }
845 }else if( zBefore ){
846 while( isspace(zBefore[0]) ){ zBefore++; }
847 if( zBefore[0] ){
848 blob_appendf(&sql,
849 " AND event.mtime<=(SELECT julianday(%Q, 'utc'))"
850 " ORDER BY event.mtime DESC", zBefore);
851 url_add_parameter(&url, "b", zBefore);
852 }else{
853 zBefore = 0;
854 }
855 }else if( zCirca ){
856 while( isspace(zCirca[0]) ){ zCirca++; }
857 if( zCirca[0] ){
858 double rCirca = db_double(0.0, "SELECT julianday(%Q, 'utc')", zCirca);
859 Blob sql2;
860 blob_init(&sql2, blob_str(&sql), -1);
861 blob_appendf(&sql2,
@@ -1060,12 +1060,12 @@
1060 */
1061 static int isIsoDate(const char *z){
1062 return strlen(z)==10
1063 && z[4]=='-'
1064 && z[7]=='-'
1065 && isdigit(z[0])
1066 && isdigit(z[5]);
1067 }
1068
1069 /*
1070 ** COMMAND: timeline
1071 **
1072
--- src/timeline.c
+++ src/timeline.c
@@ -830,11 +830,11 @@
830 " AND (event.comment LIKE '%%%q%%' OR event.brief LIKE '%%%q%%')",
831 zSearch, zSearch);
832 url_add_parameter(&url, "s", zSearch);
833 }
834 if( zAfter ){
835 while( fossil_isspace(zAfter[0]) ){ zAfter++; }
836 if( zAfter[0] ){
837 blob_appendf(&sql,
838 " AND event.mtime>=(SELECT julianday(%Q, 'utc'))"
839 " ORDER BY event.mtime ASC", zAfter);
840 url_add_parameter(&url, "a", zAfter);
@@ -841,21 +841,21 @@
841 zBefore = 0;
842 }else{
843 zAfter = 0;
844 }
845 }else if( zBefore ){
846 while( fossil_isspace(zBefore[0]) ){ zBefore++; }
847 if( zBefore[0] ){
848 blob_appendf(&sql,
849 " AND event.mtime<=(SELECT julianday(%Q, 'utc'))"
850 " ORDER BY event.mtime DESC", zBefore);
851 url_add_parameter(&url, "b", zBefore);
852 }else{
853 zBefore = 0;
854 }
855 }else if( zCirca ){
856 while( fossil_isspace(zCirca[0]) ){ zCirca++; }
857 if( zCirca[0] ){
858 double rCirca = db_double(0.0, "SELECT julianday(%Q, 'utc')", zCirca);
859 Blob sql2;
860 blob_init(&sql2, blob_str(&sql), -1);
861 blob_appendf(&sql2,
@@ -1060,12 +1060,12 @@
1060 */
1061 static int isIsoDate(const char *z){
1062 return strlen(z)==10
1063 && z[4]=='-'
1064 && z[7]=='-'
1065 && fossil_isdigit(z[0])
1066 && fossil_isdigit(z[5]);
1067 }
1068
1069 /*
1070 ** COMMAND: timeline
1071 **
1072
+5 -5
--- src/timeline.c
+++ src/timeline.c
@@ -830,11 +830,11 @@
830830
" AND (event.comment LIKE '%%%q%%' OR event.brief LIKE '%%%q%%')",
831831
zSearch, zSearch);
832832
url_add_parameter(&url, "s", zSearch);
833833
}
834834
if( zAfter ){
835
- while( isspace(zAfter[0]) ){ zAfter++; }
835
+ while( fossil_isspace(zAfter[0]) ){ zAfter++; }
836836
if( zAfter[0] ){
837837
blob_appendf(&sql,
838838
" AND event.mtime>=(SELECT julianday(%Q, 'utc'))"
839839
" ORDER BY event.mtime ASC", zAfter);
840840
url_add_parameter(&url, "a", zAfter);
@@ -841,21 +841,21 @@
841841
zBefore = 0;
842842
}else{
843843
zAfter = 0;
844844
}
845845
}else if( zBefore ){
846
- while( isspace(zBefore[0]) ){ zBefore++; }
846
+ while( fossil_isspace(zBefore[0]) ){ zBefore++; }
847847
if( zBefore[0] ){
848848
blob_appendf(&sql,
849849
" AND event.mtime<=(SELECT julianday(%Q, 'utc'))"
850850
" ORDER BY event.mtime DESC", zBefore);
851851
url_add_parameter(&url, "b", zBefore);
852852
}else{
853853
zBefore = 0;
854854
}
855855
}else if( zCirca ){
856
- while( isspace(zCirca[0]) ){ zCirca++; }
856
+ while( fossil_isspace(zCirca[0]) ){ zCirca++; }
857857
if( zCirca[0] ){
858858
double rCirca = db_double(0.0, "SELECT julianday(%Q, 'utc')", zCirca);
859859
Blob sql2;
860860
blob_init(&sql2, blob_str(&sql), -1);
861861
blob_appendf(&sql2,
@@ -1060,12 +1060,12 @@
10601060
*/
10611061
static int isIsoDate(const char *z){
10621062
return strlen(z)==10
10631063
&& z[4]=='-'
10641064
&& z[7]=='-'
1065
- && isdigit(z[0])
1066
- && isdigit(z[5]);
1065
+ && fossil_isdigit(z[0])
1066
+ && fossil_isdigit(z[5]);
10671067
}
10681068
10691069
/*
10701070
** COMMAND: timeline
10711071
**
10721072
--- src/timeline.c
+++ src/timeline.c
@@ -830,11 +830,11 @@
830 " AND (event.comment LIKE '%%%q%%' OR event.brief LIKE '%%%q%%')",
831 zSearch, zSearch);
832 url_add_parameter(&url, "s", zSearch);
833 }
834 if( zAfter ){
835 while( isspace(zAfter[0]) ){ zAfter++; }
836 if( zAfter[0] ){
837 blob_appendf(&sql,
838 " AND event.mtime>=(SELECT julianday(%Q, 'utc'))"
839 " ORDER BY event.mtime ASC", zAfter);
840 url_add_parameter(&url, "a", zAfter);
@@ -841,21 +841,21 @@
841 zBefore = 0;
842 }else{
843 zAfter = 0;
844 }
845 }else if( zBefore ){
846 while( isspace(zBefore[0]) ){ zBefore++; }
847 if( zBefore[0] ){
848 blob_appendf(&sql,
849 " AND event.mtime<=(SELECT julianday(%Q, 'utc'))"
850 " ORDER BY event.mtime DESC", zBefore);
851 url_add_parameter(&url, "b", zBefore);
852 }else{
853 zBefore = 0;
854 }
855 }else if( zCirca ){
856 while( isspace(zCirca[0]) ){ zCirca++; }
857 if( zCirca[0] ){
858 double rCirca = db_double(0.0, "SELECT julianday(%Q, 'utc')", zCirca);
859 Blob sql2;
860 blob_init(&sql2, blob_str(&sql), -1);
861 blob_appendf(&sql2,
@@ -1060,12 +1060,12 @@
1060 */
1061 static int isIsoDate(const char *z){
1062 return strlen(z)==10
1063 && z[4]=='-'
1064 && z[7]=='-'
1065 && isdigit(z[0])
1066 && isdigit(z[5]);
1067 }
1068
1069 /*
1070 ** COMMAND: timeline
1071 **
1072
--- src/timeline.c
+++ src/timeline.c
@@ -830,11 +830,11 @@
830 " AND (event.comment LIKE '%%%q%%' OR event.brief LIKE '%%%q%%')",
831 zSearch, zSearch);
832 url_add_parameter(&url, "s", zSearch);
833 }
834 if( zAfter ){
835 while( fossil_isspace(zAfter[0]) ){ zAfter++; }
836 if( zAfter[0] ){
837 blob_appendf(&sql,
838 " AND event.mtime>=(SELECT julianday(%Q, 'utc'))"
839 " ORDER BY event.mtime ASC", zAfter);
840 url_add_parameter(&url, "a", zAfter);
@@ -841,21 +841,21 @@
841 zBefore = 0;
842 }else{
843 zAfter = 0;
844 }
845 }else if( zBefore ){
846 while( fossil_isspace(zBefore[0]) ){ zBefore++; }
847 if( zBefore[0] ){
848 blob_appendf(&sql,
849 " AND event.mtime<=(SELECT julianday(%Q, 'utc'))"
850 " ORDER BY event.mtime DESC", zBefore);
851 url_add_parameter(&url, "b", zBefore);
852 }else{
853 zBefore = 0;
854 }
855 }else if( zCirca ){
856 while( fossil_isspace(zCirca[0]) ){ zCirca++; }
857 if( zCirca[0] ){
858 double rCirca = db_double(0.0, "SELECT julianday(%Q, 'utc')", zCirca);
859 Blob sql2;
860 blob_init(&sql2, blob_str(&sql), -1);
861 blob_appendf(&sql2,
@@ -1060,12 +1060,12 @@
1060 */
1061 static int isIsoDate(const char *z){
1062 return strlen(z)==10
1063 && z[4]=='-'
1064 && z[7]=='-'
1065 && fossil_isdigit(z[0])
1066 && fossil_isdigit(z[5]);
1067 }
1068
1069 /*
1070 ** COMMAND: timeline
1071 **
1072
+1 -1
--- src/tkt.c
+++ src/tkt.c
@@ -445,11 +445,11 @@
445445
blob_appendf(&tktchng, "J +%s %z\n", azField[i],
446446
fossilize(azAppend[i], -1));
447447
}else{
448448
zValue = Th_Fetch(azField[i], &nValue);
449449
if( zValue ){
450
- while( nValue>0 && isspace(zValue[nValue-1]) ){ nValue--; }
450
+ while( nValue>0 && fossil_isspace(zValue[nValue-1]) ){ nValue--; }
451451
if( strncmp(zValue, azValue[i], nValue) || strlen(azValue[i])!=nValue ){
452452
if( strncmp(azField[i], "private_", 8)==0 ){
453453
zValue = db_conceal(zValue, nValue);
454454
blob_appendf(&tktchng, "J %s %s\n", azField[i], zValue);
455455
}else{
456456
--- src/tkt.c
+++ src/tkt.c
@@ -445,11 +445,11 @@
445 blob_appendf(&tktchng, "J +%s %z\n", azField[i],
446 fossilize(azAppend[i], -1));
447 }else{
448 zValue = Th_Fetch(azField[i], &nValue);
449 if( zValue ){
450 while( nValue>0 && isspace(zValue[nValue-1]) ){ nValue--; }
451 if( strncmp(zValue, azValue[i], nValue) || strlen(azValue[i])!=nValue ){
452 if( strncmp(azField[i], "private_", 8)==0 ){
453 zValue = db_conceal(zValue, nValue);
454 blob_appendf(&tktchng, "J %s %s\n", azField[i], zValue);
455 }else{
456
--- src/tkt.c
+++ src/tkt.c
@@ -445,11 +445,11 @@
445 blob_appendf(&tktchng, "J +%s %z\n", azField[i],
446 fossilize(azAppend[i], -1));
447 }else{
448 zValue = Th_Fetch(azField[i], &nValue);
449 if( zValue ){
450 while( nValue>0 && fossil_isspace(zValue[nValue-1]) ){ nValue--; }
451 if( strncmp(zValue, azValue[i], nValue) || strlen(azValue[i])!=nValue ){
452 if( strncmp(azField[i], "private_", 8)==0 ){
453 zValue = db_conceal(zValue, nValue);
454 blob_appendf(&tktchng, "J %s %s\n", azField[i], zValue);
455 }else{
456
+1 -1
--- src/tkt.c
+++ src/tkt.c
@@ -445,11 +445,11 @@
445445
blob_appendf(&tktchng, "J +%s %z\n", azField[i],
446446
fossilize(azAppend[i], -1));
447447
}else{
448448
zValue = Th_Fetch(azField[i], &nValue);
449449
if( zValue ){
450
- while( nValue>0 && isspace(zValue[nValue-1]) ){ nValue--; }
450
+ while( nValue>0 && fossil_isspace(zValue[nValue-1]) ){ nValue--; }
451451
if( strncmp(zValue, azValue[i], nValue) || strlen(azValue[i])!=nValue ){
452452
if( strncmp(azField[i], "private_", 8)==0 ){
453453
zValue = db_conceal(zValue, nValue);
454454
blob_appendf(&tktchng, "J %s %s\n", azField[i], zValue);
455455
}else{
456456
--- src/tkt.c
+++ src/tkt.c
@@ -445,11 +445,11 @@
445 blob_appendf(&tktchng, "J +%s %z\n", azField[i],
446 fossilize(azAppend[i], -1));
447 }else{
448 zValue = Th_Fetch(azField[i], &nValue);
449 if( zValue ){
450 while( nValue>0 && isspace(zValue[nValue-1]) ){ nValue--; }
451 if( strncmp(zValue, azValue[i], nValue) || strlen(azValue[i])!=nValue ){
452 if( strncmp(azField[i], "private_", 8)==0 ){
453 zValue = db_conceal(zValue, nValue);
454 blob_appendf(&tktchng, "J %s %s\n", azField[i], zValue);
455 }else{
456
--- src/tkt.c
+++ src/tkt.c
@@ -445,11 +445,11 @@
445 blob_appendf(&tktchng, "J +%s %z\n", azField[i],
446 fossilize(azAppend[i], -1));
447 }else{
448 zValue = Th_Fetch(azField[i], &nValue);
449 if( zValue ){
450 while( nValue>0 && fossil_isspace(zValue[nValue-1]) ){ nValue--; }
451 if( strncmp(zValue, azValue[i], nValue) || strlen(azValue[i])!=nValue ){
452 if( strncmp(azField[i], "private_", 8)==0 ){
453 zValue = db_conceal(zValue, nValue);
454 blob_appendf(&tktchng, "J %s %s\n", azField[i], zValue);
455 }else{
456
+2 -2
--- src/url.c
+++ src/url.c
@@ -23,11 +23,11 @@
2323
/*
2424
** Convert a string to lower-case.
2525
*/
2626
static void url_tolower(char *z){
2727
while( *z ){
28
- *z = tolower(*z);
28
+ *z = fossil_tolower(*z);
2929
z++;
3030
}
3131
}
3232
3333
/*
@@ -109,11 +109,11 @@
109109
}
110110
url_tolower(g.urlName);
111111
if( c==':' ){
112112
g.urlPort = 0;
113113
i++;
114
- while( (c = zUrl[i])!=0 && isdigit(c) ){
114
+ while( (c = zUrl[i])!=0 && fossil_isdigit(c) ){
115115
g.urlPort = g.urlPort*10 + c - '0';
116116
i++;
117117
}
118118
g.urlHostname = mprintf("%s:%d", g.urlName, g.urlPort);
119119
}else{
120120
--- src/url.c
+++ src/url.c
@@ -23,11 +23,11 @@
23 /*
24 ** Convert a string to lower-case.
25 */
26 static void url_tolower(char *z){
27 while( *z ){
28 *z = tolower(*z);
29 z++;
30 }
31 }
32
33 /*
@@ -109,11 +109,11 @@
109 }
110 url_tolower(g.urlName);
111 if( c==':' ){
112 g.urlPort = 0;
113 i++;
114 while( (c = zUrl[i])!=0 && isdigit(c) ){
115 g.urlPort = g.urlPort*10 + c - '0';
116 i++;
117 }
118 g.urlHostname = mprintf("%s:%d", g.urlName, g.urlPort);
119 }else{
120
--- src/url.c
+++ src/url.c
@@ -23,11 +23,11 @@
23 /*
24 ** Convert a string to lower-case.
25 */
26 static void url_tolower(char *z){
27 while( *z ){
28 *z = fossil_tolower(*z);
29 z++;
30 }
31 }
32
33 /*
@@ -109,11 +109,11 @@
109 }
110 url_tolower(g.urlName);
111 if( c==':' ){
112 g.urlPort = 0;
113 i++;
114 while( (c = zUrl[i])!=0 && fossil_isdigit(c) ){
115 g.urlPort = g.urlPort*10 + c - '0';
116 i++;
117 }
118 g.urlHostname = mprintf("%s:%d", g.urlName, g.urlPort);
119 }else{
120
+2 -2
--- src/user.c
+++ src/user.c
@@ -27,14 +27,14 @@
2727
** onto the end of a blob.
2828
*/
2929
static void strip_string(Blob *pBlob, char *z){
3030
int i;
3131
blob_reset(pBlob);
32
- while( isspace(*z) ){ z++; }
32
+ while( fossil_isspace(*z) ){ z++; }
3333
for(i=0; z[i]; i++){
3434
if( z[i]=='\r' || z[i]=='\n' ){
35
- while( i>0 && isspace(z[i-1]) ){ i--; }
35
+ while( i>0 && fossil_isspace(z[i-1]) ){ i--; }
3636
z[i] = 0;
3737
break;
3838
}
3939
if( z[i]<' ' ) z[i] = ' ';
4040
}
4141
--- src/user.c
+++ src/user.c
@@ -27,14 +27,14 @@
27 ** onto the end of a blob.
28 */
29 static void strip_string(Blob *pBlob, char *z){
30 int i;
31 blob_reset(pBlob);
32 while( isspace(*z) ){ z++; }
33 for(i=0; z[i]; i++){
34 if( z[i]=='\r' || z[i]=='\n' ){
35 while( i>0 && isspace(z[i-1]) ){ i--; }
36 z[i] = 0;
37 break;
38 }
39 if( z[i]<' ' ) z[i] = ' ';
40 }
41
--- src/user.c
+++ src/user.c
@@ -27,14 +27,14 @@
27 ** onto the end of a blob.
28 */
29 static void strip_string(Blob *pBlob, char *z){
30 int i;
31 blob_reset(pBlob);
32 while( fossil_isspace(*z) ){ z++; }
33 for(i=0; z[i]; i++){
34 if( z[i]=='\r' || z[i]=='\n' ){
35 while( i>0 && fossil_isspace(z[i-1]) ){ i--; }
36 z[i] = 0;
37 break;
38 }
39 if( z[i]<' ' ) z[i] = ' ';
40 }
41
+2 -2
--- src/user.c
+++ src/user.c
@@ -27,14 +27,14 @@
2727
** onto the end of a blob.
2828
*/
2929
static void strip_string(Blob *pBlob, char *z){
3030
int i;
3131
blob_reset(pBlob);
32
- while( isspace(*z) ){ z++; }
32
+ while( fossil_isspace(*z) ){ z++; }
3333
for(i=0; z[i]; i++){
3434
if( z[i]=='\r' || z[i]=='\n' ){
35
- while( i>0 && isspace(z[i-1]) ){ i--; }
35
+ while( i>0 && fossil_isspace(z[i-1]) ){ i--; }
3636
z[i] = 0;
3737
break;
3838
}
3939
if( z[i]<' ' ) z[i] = ' ';
4040
}
4141
--- src/user.c
+++ src/user.c
@@ -27,14 +27,14 @@
27 ** onto the end of a blob.
28 */
29 static void strip_string(Blob *pBlob, char *z){
30 int i;
31 blob_reset(pBlob);
32 while( isspace(*z) ){ z++; }
33 for(i=0; z[i]; i++){
34 if( z[i]=='\r' || z[i]=='\n' ){
35 while( i>0 && isspace(z[i-1]) ){ i--; }
36 z[i] = 0;
37 break;
38 }
39 if( z[i]<' ' ) z[i] = ' ';
40 }
41
--- src/user.c
+++ src/user.c
@@ -27,14 +27,14 @@
27 ** onto the end of a blob.
28 */
29 static void strip_string(Blob *pBlob, char *z){
30 int i;
31 blob_reset(pBlob);
32 while( fossil_isspace(*z) ){ z++; }
33 for(i=0; z[i]; i++){
34 if( z[i]=='\r' || z[i]=='\n' ){
35 while( i>0 && fossil_isspace(z[i-1]) ){ i--; }
36 z[i] = 0;
37 break;
38 }
39 if( z[i]<' ' ) z[i] = ' ';
40 }
41
+2 -2
--- src/wiki.c
+++ src/wiki.c
@@ -186,11 +186,11 @@
186186
if( rid ){
187187
Blob content;
188188
content_get(rid, &content);
189189
manifest_parse(&m, &content);
190190
if( m.type==CFTYPE_WIKI && m.zWiki ){
191
- while( isspace(m.zWiki[0]) ) m.zWiki++;
191
+ while( fossil_isspace(m.zWiki[0]) ) m.zWiki++;
192192
if( m.zWiki[0] ) zBody = m.zWiki;
193193
}
194194
}
195195
}
196196
if( !g.isHome ){
@@ -945,11 +945,11 @@
945945
}
946946
}
947947
if( zBody==0 ){
948948
fossil_fatal("wiki page [%s] not found",zPageName);
949949
}
950
- for(i=strlen(zBody); i>0 && isspace(zBody[i-1]); i--){}
950
+ for(i=strlen(zBody); i>0 && fossil_isspace(zBody[i-1]); i--){}
951951
zFile = (g.argc==4) ? 0 : g.argv[4];
952952
if( zFile ){
953953
FILE * zF;
954954
short doClose = 0;
955955
if( (1 == strlen(zFile)) && ('-'==zFile[0]) ){
956956
--- src/wiki.c
+++ src/wiki.c
@@ -186,11 +186,11 @@
186 if( rid ){
187 Blob content;
188 content_get(rid, &content);
189 manifest_parse(&m, &content);
190 if( m.type==CFTYPE_WIKI && m.zWiki ){
191 while( isspace(m.zWiki[0]) ) m.zWiki++;
192 if( m.zWiki[0] ) zBody = m.zWiki;
193 }
194 }
195 }
196 if( !g.isHome ){
@@ -945,11 +945,11 @@
945 }
946 }
947 if( zBody==0 ){
948 fossil_fatal("wiki page [%s] not found",zPageName);
949 }
950 for(i=strlen(zBody); i>0 && isspace(zBody[i-1]); i--){}
951 zFile = (g.argc==4) ? 0 : g.argv[4];
952 if( zFile ){
953 FILE * zF;
954 short doClose = 0;
955 if( (1 == strlen(zFile)) && ('-'==zFile[0]) ){
956
--- src/wiki.c
+++ src/wiki.c
@@ -186,11 +186,11 @@
186 if( rid ){
187 Blob content;
188 content_get(rid, &content);
189 manifest_parse(&m, &content);
190 if( m.type==CFTYPE_WIKI && m.zWiki ){
191 while( fossil_isspace(m.zWiki[0]) ) m.zWiki++;
192 if( m.zWiki[0] ) zBody = m.zWiki;
193 }
194 }
195 }
196 if( !g.isHome ){
@@ -945,11 +945,11 @@
945 }
946 }
947 if( zBody==0 ){
948 fossil_fatal("wiki page [%s] not found",zPageName);
949 }
950 for(i=strlen(zBody); i>0 && fossil_isspace(zBody[i-1]); i--){}
951 zFile = (g.argc==4) ? 0 : g.argv[4];
952 if( zFile ){
953 FILE * zF;
954 short doClose = 0;
955 if( (1 == strlen(zFile)) && ('-'==zFile[0]) ){
956
+2 -2
--- src/wiki.c
+++ src/wiki.c
@@ -186,11 +186,11 @@
186186
if( rid ){
187187
Blob content;
188188
content_get(rid, &content);
189189
manifest_parse(&m, &content);
190190
if( m.type==CFTYPE_WIKI && m.zWiki ){
191
- while( isspace(m.zWiki[0]) ) m.zWiki++;
191
+ while( fossil_isspace(m.zWiki[0]) ) m.zWiki++;
192192
if( m.zWiki[0] ) zBody = m.zWiki;
193193
}
194194
}
195195
}
196196
if( !g.isHome ){
@@ -945,11 +945,11 @@
945945
}
946946
}
947947
if( zBody==0 ){
948948
fossil_fatal("wiki page [%s] not found",zPageName);
949949
}
950
- for(i=strlen(zBody); i>0 && isspace(zBody[i-1]); i--){}
950
+ for(i=strlen(zBody); i>0 && fossil_isspace(zBody[i-1]); i--){}
951951
zFile = (g.argc==4) ? 0 : g.argv[4];
952952
if( zFile ){
953953
FILE * zF;
954954
short doClose = 0;
955955
if( (1 == strlen(zFile)) && ('-'==zFile[0]) ){
956956
--- src/wiki.c
+++ src/wiki.c
@@ -186,11 +186,11 @@
186 if( rid ){
187 Blob content;
188 content_get(rid, &content);
189 manifest_parse(&m, &content);
190 if( m.type==CFTYPE_WIKI && m.zWiki ){
191 while( isspace(m.zWiki[0]) ) m.zWiki++;
192 if( m.zWiki[0] ) zBody = m.zWiki;
193 }
194 }
195 }
196 if( !g.isHome ){
@@ -945,11 +945,11 @@
945 }
946 }
947 if( zBody==0 ){
948 fossil_fatal("wiki page [%s] not found",zPageName);
949 }
950 for(i=strlen(zBody); i>0 && isspace(zBody[i-1]); i--){}
951 zFile = (g.argc==4) ? 0 : g.argv[4];
952 if( zFile ){
953 FILE * zF;
954 short doClose = 0;
955 if( (1 == strlen(zFile)) && ('-'==zFile[0]) ){
956
--- src/wiki.c
+++ src/wiki.c
@@ -186,11 +186,11 @@
186 if( rid ){
187 Blob content;
188 content_get(rid, &content);
189 manifest_parse(&m, &content);
190 if( m.type==CFTYPE_WIKI && m.zWiki ){
191 while( fossil_isspace(m.zWiki[0]) ) m.zWiki++;
192 if( m.zWiki[0] ) zBody = m.zWiki;
193 }
194 }
195 }
196 if( !g.isHome ){
@@ -945,11 +945,11 @@
945 }
946 }
947 if( zBody==0 ){
948 fossil_fatal("wiki page [%s] not found",zPageName);
949 }
950 for(i=strlen(zBody); i>0 && fossil_isspace(zBody[i-1]); i--){}
951 zFile = (g.argc==4) ? 0 : g.argv[4];
952 if( zFile ){
953 FILE * zF;
954 short doClose = 0;
955 if( (1 == strlen(zFile)) && ('-'==zFile[0]) ){
956
+28 -28
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -412,15 +412,15 @@
412412
static int markupLength(const char *z){
413413
int n = 1;
414414
int inparen = 0;
415415
int c;
416416
if( z[n]=='/' ){ n++; }
417
- if( !isalpha(z[n]) ) return 0;
418
- while( isalnum(z[n]) ){ n++; }
417
+ if( !fossil_isalpha(z[n]) ) return 0;
418
+ while( fossil_isalnum(z[n]) ){ n++; }
419419
c = z[n];
420420
if( c=='/' && z[n+1]=='>' ){ return n+2; }
421
- if( c!='>' && !isspace(c) ) return 0;
421
+ if( c!='>' && !fossil_isspace(c) ) return 0;
422422
while( (c = z[n])!=0 && (c!='>' || inparen) ){
423423
if( c==inparen ){
424424
inparen = 0;
425425
}else if( inparen==0 && (c=='"' || c=='\'') ){
426426
inparen = c;
@@ -437,11 +437,11 @@
437437
** of characters through the closing "\n". If not, return 0.
438438
*/
439439
static int paragraphBreakLength(const char *z){
440440
int i, n;
441441
int nNewline = 1;
442
- for(i=1, n=0; isspace(z[i]); i++){
442
+ for(i=1, n=0; fossil_isspace(z[i]); i++){
443443
if( z[i]=='\n' ){
444444
nNewline++;
445445
n = i;
446446
}
447447
}
@@ -482,14 +482,14 @@
482482
*/
483483
static int isElement(const char *z){
484484
int i;
485485
assert( z[0]=='&' );
486486
if( z[1]=='#' ){
487
- for(i=2; isdigit(z[i]); i++){}
487
+ for(i=2; fossil_isdigit(z[i]); i++){}
488488
return i>2 && z[i]==';';
489489
}else{
490
- for(i=1; isalpha(z[i]); i++){}
490
+ for(i=1; fossil_isalpha(z[i]); i++){}
491491
return i>1 && z[i]==';';
492492
}
493493
}
494494
495495
/*
@@ -511,11 +511,11 @@
511511
while( z[n]==' ' || z[n]=='\t' ){
512512
if( z[n]=='\t' ) i++;
513513
i++;
514514
n++;
515515
}
516
- if( i<2 || isspace(z[n]) ) return 0;
516
+ if( i<2 || fossil_isspace(z[n]) ) return 0;
517517
return n;
518518
}
519519
520520
/*
521521
** Check to see if the z[] string is the beginning of a enumeration value.
@@ -536,11 +536,11 @@
536536
if( z[n]=='\t' ) i++;
537537
i++;
538538
n++;
539539
}
540540
if( i<2 ) return 0;
541
- for(i=0; isdigit(z[n]); i++, n++){}
541
+ for(i=0; fossil_isdigit(z[n]); i++, n++){}
542542
if( i==0 ) return 0;
543543
if( z[n]=='.' ){
544544
n++;
545545
}
546546
i = 0;
@@ -547,11 +547,11 @@
547547
while( z[n]==' ' || z[n]=='\t' ){
548548
if( z[n]=='\t' ) i++;
549549
i++;
550550
n++;
551551
}
552
- if( i<2 || isspace(z[n]) ) return 0;
552
+ if( i<2 || fossil_isspace(z[n]) ) return 0;
553553
return n;
554554
}
555555
556556
/*
557557
** Check to see if the z[] string is the beginning of an indented
@@ -565,11 +565,11 @@
565565
while( z[n]==' ' || z[n]=='\t' ){
566566
if( z[n]=='\t' ) i++;
567567
i++;
568568
n++;
569569
}
570
- if( i<2 || isspace(z[n]) ) return 0;
570
+ if( i<2 || fossil_isspace(z[n]) ) return 0;
571571
return n;
572572
}
573573
574574
/*
575575
** Check to see if the z[] string is a wiki hyperlink. If it is,
@@ -612,16 +612,16 @@
612612
if( z[0]=='\n' ){
613613
n = paragraphBreakLength(z);
614614
if( n>0 ){
615615
*pTokenType = TOKEN_PARAGRAPH;
616616
return n;
617
- }else if( isspace(z[1]) ){
617
+ }else if( fossil_isspace(z[1]) ){
618618
*pTokenType = TOKEN_NEWLINE;
619619
return 1;
620620
}
621621
}
622
- if( (p->state & AT_NEWLINE)!=0 && isspace(z[0]) ){
622
+ if( (p->state & AT_NEWLINE)!=0 && fossil_isspace(z[0]) ){
623623
n = listItemLength(z, '*');
624624
if( n>0 ){
625625
*pTokenType = TOKEN_BUL_LI;
626626
return n;
627627
}
@@ -634,11 +634,11 @@
634634
if( n>0 ){
635635
*pTokenType = TOKEN_ENUM;
636636
return n;
637637
}
638638
}
639
- if( (p->state & AT_PARAGRAPH)!=0 && isspace(z[0]) ){
639
+ if( (p->state & AT_PARAGRAPH)!=0 && fossil_isspace(z[0]) ){
640640
n = indentLength(z);
641641
if( n>0 ){
642642
*pTokenType = TOKEN_INDENT;
643643
return n;
644644
}
@@ -705,37 +705,37 @@
705705
}else{
706706
p->endTag = 0;
707707
i = 1;
708708
}
709709
j = 0;
710
- while( isalnum(z[i]) ){
711
- if( j<sizeof(zTag)-1 ) zTag[j++] = tolower(z[i]);
710
+ while( fossil_isalnum(z[i]) ){
711
+ if( j<sizeof(zTag)-1 ) zTag[j++] = fossil_tolower(z[i]);
712712
i++;
713713
}
714714
zTag[j] = 0;
715715
p->iCode = findTag(zTag);
716716
p->iType = aMarkup[p->iCode].iType;
717717
p->nAttr = 0;
718
- while( isspace(z[i]) ){ i++; }
719
- while( p->nAttr<8 && isalpha(z[i]) ){
718
+ while( fossil_isspace(z[i]) ){ i++; }
719
+ while( p->nAttr<8 && fossil_isalpha(z[i]) ){
720720
int attrOk; /* True to preserver attribute. False to ignore it */
721721
j = 0;
722
- while( isalnum(z[i]) ){
723
- if( j<sizeof(zTag)-1 ) zTag[j++] = tolower(z[i]);
722
+ while( fossil_isalnum(z[i]) ){
723
+ if( j<sizeof(zTag)-1 ) zTag[j++] = fossil_tolower(z[i]);
724724
i++;
725725
}
726726
zTag[j] = 0;
727727
p->aAttr[p->nAttr].iACode = iACode = findAttr(zTag);
728728
attrOk = iACode!=0 && (seen & aAttribute[iACode].iMask)==0;
729
- while( isspace(z[i]) ){ z++; }
729
+ while( fossil_isspace(z[i]) ){ z++; }
730730
if( z[i]!='=' ){
731731
p->aAttr[p->nAttr].zValue = 0;
732732
p->aAttr[p->nAttr].cTerm = 0;
733733
c = 0;
734734
}else{
735735
i++;
736
- while( isspace(z[i]) ){ z++; }
736
+ while( fossil_isspace(z[i]) ){ z++; }
737737
if( z[i]=='"' ){
738738
i++;
739739
zValue = &z[i];
740740
while( z[i] && z[i]!='"' ){ i++; }
741741
}else if( z[i]=='\'' ){
@@ -742,11 +742,11 @@
742742
i++;
743743
zValue = &z[i];
744744
while( z[i] && z[i]!='\'' ){ i++; }
745745
}else{
746746
zValue = &z[i];
747
- while( !isspace(z[i]) && z[i]!='>' ){ z++; }
747
+ while( !fossil_isspace(z[i]) && z[i]!='>' ){ z++; }
748748
}
749749
if( attrOk ){
750750
p->aAttr[p->nAttr].zValue = zValue;
751751
p->aAttr[p->nAttr].cTerm = c = z[i];
752752
z[i] = 0;
@@ -755,11 +755,11 @@
755755
}
756756
if( attrOk ){
757757
seen |= aAttribute[iACode].iMask;
758758
p->nAttr++;
759759
}
760
- while( isspace(z[i]) ){ i++; }
760
+ while( fossil_isspace(z[i]) ){ i++; }
761761
if( z[i]=='>' || (z[i]=='/' && z[i+1]=='>') ) break;
762762
}
763763
}
764764
765765
/*
@@ -1067,11 +1067,11 @@
10671067
}
10681068
}
10691069
}else if( g.okHistory ){
10701070
blob_appendf(p->pOut, "<a href=\"%s/info/%s\">", g.zBaseURL, zTarget);
10711071
}
1072
- }else if( strlen(zTarget)>=10 && isdigit(zTarget[0]) && zTarget[4]=='-'
1072
+ }else if( strlen(zTarget)>=10 && fossil_isdigit(zTarget[0]) && zTarget[4]=='-'
10731073
&& db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){
10741074
blob_appendf(p->pOut, "<a href=\"%s/timeline?c=%T\">", g.zBaseURL, zTarget);
10751075
}else if( strncmp(zTarget, "wiki:", 5)==0
10761076
&& wiki_name_is_wellformed((const unsigned char*)zTarget) ){
10771077
zTarget += 5;
@@ -1245,18 +1245,18 @@
12451245
zTarget = &z[1];
12461246
for(i=1; z[i] && z[i]!=']'; i++){
12471247
if( z[i]=='|' && zDisplay==0 ){
12481248
zDisplay = &z[i+1];
12491249
z[i] = 0;
1250
- for(j=i-1; j>0 && isspace(z[j]); j--){ z[j] = 0; }
1250
+ for(j=i-1; j>0 && fossil_isspace(z[j]); j--){ z[j] = 0; }
12511251
}
12521252
}
12531253
z[i] = 0;
12541254
if( zDisplay==0 ){
12551255
zDisplay = zTarget;
12561256
}else{
1257
- while( isspace(*zDisplay) ) zDisplay++;
1257
+ while( fossil_isspace(*zDisplay) ) zDisplay++;
12581258
}
12591259
openHyperlink(p, zTarget, zClose, sizeof(zClose));
12601260
savedState = p->state;
12611261
p->state &= ~ALLOW_WIKI;
12621262
p->state |= FONT_MARKUP_ONLY;
@@ -1265,11 +1265,11 @@
12651265
blob_append(p->pOut, zClose, -1);
12661266
break;
12671267
}
12681268
case TOKEN_TEXT: {
12691269
int i;
1270
- for(i=0; i<n && isspace(z[i]); i++){}
1270
+ for(i=0; i<n && fossil_isspace(z[i]); i++){}
12711271
if( i<n ) startAutoParagraph(p);
12721272
blob_append(p->pOut, z, n);
12731273
break;
12741274
}
12751275
case TOKEN_RAW: {
@@ -1521,11 +1521,11 @@
15211521
int wiki_find_title(Blob *pIn, Blob *pTitle, Blob *pTail){
15221522
char *z;
15231523
int i;
15241524
int iStart;
15251525
z = skip_bom(blob_str(pIn));
1526
- for(i=0; isspace(z[i]); i++){}
1526
+ for(i=0; fossil_isspace(z[i]); i++){}
15271527
if( z[i]!='<' ) return 0;
15281528
i++;
15291529
if( strncmp(&z[i],"title>", 6)!=0 ) return 0;
15301530
iStart = i+6;
15311531
for(i=iStart; z[i] && (z[i]!='<' || strncmp(&z[i],"</title>",8)!=0); i++){}
15321532
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -412,15 +412,15 @@
412 static int markupLength(const char *z){
413 int n = 1;
414 int inparen = 0;
415 int c;
416 if( z[n]=='/' ){ n++; }
417 if( !isalpha(z[n]) ) return 0;
418 while( isalnum(z[n]) ){ n++; }
419 c = z[n];
420 if( c=='/' && z[n+1]=='>' ){ return n+2; }
421 if( c!='>' && !isspace(c) ) return 0;
422 while( (c = z[n])!=0 && (c!='>' || inparen) ){
423 if( c==inparen ){
424 inparen = 0;
425 }else if( inparen==0 && (c=='"' || c=='\'') ){
426 inparen = c;
@@ -437,11 +437,11 @@
437 ** of characters through the closing "\n". If not, return 0.
438 */
439 static int paragraphBreakLength(const char *z){
440 int i, n;
441 int nNewline = 1;
442 for(i=1, n=0; isspace(z[i]); i++){
443 if( z[i]=='\n' ){
444 nNewline++;
445 n = i;
446 }
447 }
@@ -482,14 +482,14 @@
482 */
483 static int isElement(const char *z){
484 int i;
485 assert( z[0]=='&' );
486 if( z[1]=='#' ){
487 for(i=2; isdigit(z[i]); i++){}
488 return i>2 && z[i]==';';
489 }else{
490 for(i=1; isalpha(z[i]); i++){}
491 return i>1 && z[i]==';';
492 }
493 }
494
495 /*
@@ -511,11 +511,11 @@
511 while( z[n]==' ' || z[n]=='\t' ){
512 if( z[n]=='\t' ) i++;
513 i++;
514 n++;
515 }
516 if( i<2 || isspace(z[n]) ) return 0;
517 return n;
518 }
519
520 /*
521 ** Check to see if the z[] string is the beginning of a enumeration value.
@@ -536,11 +536,11 @@
536 if( z[n]=='\t' ) i++;
537 i++;
538 n++;
539 }
540 if( i<2 ) return 0;
541 for(i=0; isdigit(z[n]); i++, n++){}
542 if( i==0 ) return 0;
543 if( z[n]=='.' ){
544 n++;
545 }
546 i = 0;
@@ -547,11 +547,11 @@
547 while( z[n]==' ' || z[n]=='\t' ){
548 if( z[n]=='\t' ) i++;
549 i++;
550 n++;
551 }
552 if( i<2 || isspace(z[n]) ) return 0;
553 return n;
554 }
555
556 /*
557 ** Check to see if the z[] string is the beginning of an indented
@@ -565,11 +565,11 @@
565 while( z[n]==' ' || z[n]=='\t' ){
566 if( z[n]=='\t' ) i++;
567 i++;
568 n++;
569 }
570 if( i<2 || isspace(z[n]) ) return 0;
571 return n;
572 }
573
574 /*
575 ** Check to see if the z[] string is a wiki hyperlink. If it is,
@@ -612,16 +612,16 @@
612 if( z[0]=='\n' ){
613 n = paragraphBreakLength(z);
614 if( n>0 ){
615 *pTokenType = TOKEN_PARAGRAPH;
616 return n;
617 }else if( isspace(z[1]) ){
618 *pTokenType = TOKEN_NEWLINE;
619 return 1;
620 }
621 }
622 if( (p->state & AT_NEWLINE)!=0 && isspace(z[0]) ){
623 n = listItemLength(z, '*');
624 if( n>0 ){
625 *pTokenType = TOKEN_BUL_LI;
626 return n;
627 }
@@ -634,11 +634,11 @@
634 if( n>0 ){
635 *pTokenType = TOKEN_ENUM;
636 return n;
637 }
638 }
639 if( (p->state & AT_PARAGRAPH)!=0 && isspace(z[0]) ){
640 n = indentLength(z);
641 if( n>0 ){
642 *pTokenType = TOKEN_INDENT;
643 return n;
644 }
@@ -705,37 +705,37 @@
705 }else{
706 p->endTag = 0;
707 i = 1;
708 }
709 j = 0;
710 while( isalnum(z[i]) ){
711 if( j<sizeof(zTag)-1 ) zTag[j++] = tolower(z[i]);
712 i++;
713 }
714 zTag[j] = 0;
715 p->iCode = findTag(zTag);
716 p->iType = aMarkup[p->iCode].iType;
717 p->nAttr = 0;
718 while( isspace(z[i]) ){ i++; }
719 while( p->nAttr<8 && isalpha(z[i]) ){
720 int attrOk; /* True to preserver attribute. False to ignore it */
721 j = 0;
722 while( isalnum(z[i]) ){
723 if( j<sizeof(zTag)-1 ) zTag[j++] = tolower(z[i]);
724 i++;
725 }
726 zTag[j] = 0;
727 p->aAttr[p->nAttr].iACode = iACode = findAttr(zTag);
728 attrOk = iACode!=0 && (seen & aAttribute[iACode].iMask)==0;
729 while( isspace(z[i]) ){ z++; }
730 if( z[i]!='=' ){
731 p->aAttr[p->nAttr].zValue = 0;
732 p->aAttr[p->nAttr].cTerm = 0;
733 c = 0;
734 }else{
735 i++;
736 while( isspace(z[i]) ){ z++; }
737 if( z[i]=='"' ){
738 i++;
739 zValue = &z[i];
740 while( z[i] && z[i]!='"' ){ i++; }
741 }else if( z[i]=='\'' ){
@@ -742,11 +742,11 @@
742 i++;
743 zValue = &z[i];
744 while( z[i] && z[i]!='\'' ){ i++; }
745 }else{
746 zValue = &z[i];
747 while( !isspace(z[i]) && z[i]!='>' ){ z++; }
748 }
749 if( attrOk ){
750 p->aAttr[p->nAttr].zValue = zValue;
751 p->aAttr[p->nAttr].cTerm = c = z[i];
752 z[i] = 0;
@@ -755,11 +755,11 @@
755 }
756 if( attrOk ){
757 seen |= aAttribute[iACode].iMask;
758 p->nAttr++;
759 }
760 while( isspace(z[i]) ){ i++; }
761 if( z[i]=='>' || (z[i]=='/' && z[i+1]=='>') ) break;
762 }
763 }
764
765 /*
@@ -1067,11 +1067,11 @@
1067 }
1068 }
1069 }else if( g.okHistory ){
1070 blob_appendf(p->pOut, "<a href=\"%s/info/%s\">", g.zBaseURL, zTarget);
1071 }
1072 }else if( strlen(zTarget)>=10 && isdigit(zTarget[0]) && zTarget[4]=='-'
1073 && db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){
1074 blob_appendf(p->pOut, "<a href=\"%s/timeline?c=%T\">", g.zBaseURL, zTarget);
1075 }else if( strncmp(zTarget, "wiki:", 5)==0
1076 && wiki_name_is_wellformed((const unsigned char*)zTarget) ){
1077 zTarget += 5;
@@ -1245,18 +1245,18 @@
1245 zTarget = &z[1];
1246 for(i=1; z[i] && z[i]!=']'; i++){
1247 if( z[i]=='|' && zDisplay==0 ){
1248 zDisplay = &z[i+1];
1249 z[i] = 0;
1250 for(j=i-1; j>0 && isspace(z[j]); j--){ z[j] = 0; }
1251 }
1252 }
1253 z[i] = 0;
1254 if( zDisplay==0 ){
1255 zDisplay = zTarget;
1256 }else{
1257 while( isspace(*zDisplay) ) zDisplay++;
1258 }
1259 openHyperlink(p, zTarget, zClose, sizeof(zClose));
1260 savedState = p->state;
1261 p->state &= ~ALLOW_WIKI;
1262 p->state |= FONT_MARKUP_ONLY;
@@ -1265,11 +1265,11 @@
1265 blob_append(p->pOut, zClose, -1);
1266 break;
1267 }
1268 case TOKEN_TEXT: {
1269 int i;
1270 for(i=0; i<n && isspace(z[i]); i++){}
1271 if( i<n ) startAutoParagraph(p);
1272 blob_append(p->pOut, z, n);
1273 break;
1274 }
1275 case TOKEN_RAW: {
@@ -1521,11 +1521,11 @@
1521 int wiki_find_title(Blob *pIn, Blob *pTitle, Blob *pTail){
1522 char *z;
1523 int i;
1524 int iStart;
1525 z = skip_bom(blob_str(pIn));
1526 for(i=0; isspace(z[i]); i++){}
1527 if( z[i]!='<' ) return 0;
1528 i++;
1529 if( strncmp(&z[i],"title>", 6)!=0 ) return 0;
1530 iStart = i+6;
1531 for(i=iStart; z[i] && (z[i]!='<' || strncmp(&z[i],"</title>",8)!=0); i++){}
1532
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -412,15 +412,15 @@
412 static int markupLength(const char *z){
413 int n = 1;
414 int inparen = 0;
415 int c;
416 if( z[n]=='/' ){ n++; }
417 if( !fossil_isalpha(z[n]) ) return 0;
418 while( fossil_isalnum(z[n]) ){ n++; }
419 c = z[n];
420 if( c=='/' && z[n+1]=='>' ){ return n+2; }
421 if( c!='>' && !fossil_isspace(c) ) return 0;
422 while( (c = z[n])!=0 && (c!='>' || inparen) ){
423 if( c==inparen ){
424 inparen = 0;
425 }else if( inparen==0 && (c=='"' || c=='\'') ){
426 inparen = c;
@@ -437,11 +437,11 @@
437 ** of characters through the closing "\n". If not, return 0.
438 */
439 static int paragraphBreakLength(const char *z){
440 int i, n;
441 int nNewline = 1;
442 for(i=1, n=0; fossil_isspace(z[i]); i++){
443 if( z[i]=='\n' ){
444 nNewline++;
445 n = i;
446 }
447 }
@@ -482,14 +482,14 @@
482 */
483 static int isElement(const char *z){
484 int i;
485 assert( z[0]=='&' );
486 if( z[1]=='#' ){
487 for(i=2; fossil_isdigit(z[i]); i++){}
488 return i>2 && z[i]==';';
489 }else{
490 for(i=1; fossil_isalpha(z[i]); i++){}
491 return i>1 && z[i]==';';
492 }
493 }
494
495 /*
@@ -511,11 +511,11 @@
511 while( z[n]==' ' || z[n]=='\t' ){
512 if( z[n]=='\t' ) i++;
513 i++;
514 n++;
515 }
516 if( i<2 || fossil_isspace(z[n]) ) return 0;
517 return n;
518 }
519
520 /*
521 ** Check to see if the z[] string is the beginning of a enumeration value.
@@ -536,11 +536,11 @@
536 if( z[n]=='\t' ) i++;
537 i++;
538 n++;
539 }
540 if( i<2 ) return 0;
541 for(i=0; fossil_isdigit(z[n]); i++, n++){}
542 if( i==0 ) return 0;
543 if( z[n]=='.' ){
544 n++;
545 }
546 i = 0;
@@ -547,11 +547,11 @@
547 while( z[n]==' ' || z[n]=='\t' ){
548 if( z[n]=='\t' ) i++;
549 i++;
550 n++;
551 }
552 if( i<2 || fossil_isspace(z[n]) ) return 0;
553 return n;
554 }
555
556 /*
557 ** Check to see if the z[] string is the beginning of an indented
@@ -565,11 +565,11 @@
565 while( z[n]==' ' || z[n]=='\t' ){
566 if( z[n]=='\t' ) i++;
567 i++;
568 n++;
569 }
570 if( i<2 || fossil_isspace(z[n]) ) return 0;
571 return n;
572 }
573
574 /*
575 ** Check to see if the z[] string is a wiki hyperlink. If it is,
@@ -612,16 +612,16 @@
612 if( z[0]=='\n' ){
613 n = paragraphBreakLength(z);
614 if( n>0 ){
615 *pTokenType = TOKEN_PARAGRAPH;
616 return n;
617 }else if( fossil_isspace(z[1]) ){
618 *pTokenType = TOKEN_NEWLINE;
619 return 1;
620 }
621 }
622 if( (p->state & AT_NEWLINE)!=0 && fossil_isspace(z[0]) ){
623 n = listItemLength(z, '*');
624 if( n>0 ){
625 *pTokenType = TOKEN_BUL_LI;
626 return n;
627 }
@@ -634,11 +634,11 @@
634 if( n>0 ){
635 *pTokenType = TOKEN_ENUM;
636 return n;
637 }
638 }
639 if( (p->state & AT_PARAGRAPH)!=0 && fossil_isspace(z[0]) ){
640 n = indentLength(z);
641 if( n>0 ){
642 *pTokenType = TOKEN_INDENT;
643 return n;
644 }
@@ -705,37 +705,37 @@
705 }else{
706 p->endTag = 0;
707 i = 1;
708 }
709 j = 0;
710 while( fossil_isalnum(z[i]) ){
711 if( j<sizeof(zTag)-1 ) zTag[j++] = fossil_tolower(z[i]);
712 i++;
713 }
714 zTag[j] = 0;
715 p->iCode = findTag(zTag);
716 p->iType = aMarkup[p->iCode].iType;
717 p->nAttr = 0;
718 while( fossil_isspace(z[i]) ){ i++; }
719 while( p->nAttr<8 && fossil_isalpha(z[i]) ){
720 int attrOk; /* True to preserver attribute. False to ignore it */
721 j = 0;
722 while( fossil_isalnum(z[i]) ){
723 if( j<sizeof(zTag)-1 ) zTag[j++] = fossil_tolower(z[i]);
724 i++;
725 }
726 zTag[j] = 0;
727 p->aAttr[p->nAttr].iACode = iACode = findAttr(zTag);
728 attrOk = iACode!=0 && (seen & aAttribute[iACode].iMask)==0;
729 while( fossil_isspace(z[i]) ){ z++; }
730 if( z[i]!='=' ){
731 p->aAttr[p->nAttr].zValue = 0;
732 p->aAttr[p->nAttr].cTerm = 0;
733 c = 0;
734 }else{
735 i++;
736 while( fossil_isspace(z[i]) ){ z++; }
737 if( z[i]=='"' ){
738 i++;
739 zValue = &z[i];
740 while( z[i] && z[i]!='"' ){ i++; }
741 }else if( z[i]=='\'' ){
@@ -742,11 +742,11 @@
742 i++;
743 zValue = &z[i];
744 while( z[i] && z[i]!='\'' ){ i++; }
745 }else{
746 zValue = &z[i];
747 while( !fossil_isspace(z[i]) && z[i]!='>' ){ z++; }
748 }
749 if( attrOk ){
750 p->aAttr[p->nAttr].zValue = zValue;
751 p->aAttr[p->nAttr].cTerm = c = z[i];
752 z[i] = 0;
@@ -755,11 +755,11 @@
755 }
756 if( attrOk ){
757 seen |= aAttribute[iACode].iMask;
758 p->nAttr++;
759 }
760 while( fossil_isspace(z[i]) ){ i++; }
761 if( z[i]=='>' || (z[i]=='/' && z[i+1]=='>') ) break;
762 }
763 }
764
765 /*
@@ -1067,11 +1067,11 @@
1067 }
1068 }
1069 }else if( g.okHistory ){
1070 blob_appendf(p->pOut, "<a href=\"%s/info/%s\">", g.zBaseURL, zTarget);
1071 }
1072 }else if( strlen(zTarget)>=10 && fossil_isdigit(zTarget[0]) && zTarget[4]=='-'
1073 && db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){
1074 blob_appendf(p->pOut, "<a href=\"%s/timeline?c=%T\">", g.zBaseURL, zTarget);
1075 }else if( strncmp(zTarget, "wiki:", 5)==0
1076 && wiki_name_is_wellformed((const unsigned char*)zTarget) ){
1077 zTarget += 5;
@@ -1245,18 +1245,18 @@
1245 zTarget = &z[1];
1246 for(i=1; z[i] && z[i]!=']'; i++){
1247 if( z[i]=='|' && zDisplay==0 ){
1248 zDisplay = &z[i+1];
1249 z[i] = 0;
1250 for(j=i-1; j>0 && fossil_isspace(z[j]); j--){ z[j] = 0; }
1251 }
1252 }
1253 z[i] = 0;
1254 if( zDisplay==0 ){
1255 zDisplay = zTarget;
1256 }else{
1257 while( fossil_isspace(*zDisplay) ) zDisplay++;
1258 }
1259 openHyperlink(p, zTarget, zClose, sizeof(zClose));
1260 savedState = p->state;
1261 p->state &= ~ALLOW_WIKI;
1262 p->state |= FONT_MARKUP_ONLY;
@@ -1265,11 +1265,11 @@
1265 blob_append(p->pOut, zClose, -1);
1266 break;
1267 }
1268 case TOKEN_TEXT: {
1269 int i;
1270 for(i=0; i<n && fossil_isspace(z[i]); i++){}
1271 if( i<n ) startAutoParagraph(p);
1272 blob_append(p->pOut, z, n);
1273 break;
1274 }
1275 case TOKEN_RAW: {
@@ -1521,11 +1521,11 @@
1521 int wiki_find_title(Blob *pIn, Blob *pTitle, Blob *pTail){
1522 char *z;
1523 int i;
1524 int iStart;
1525 z = skip_bom(blob_str(pIn));
1526 for(i=0; fossil_isspace(z[i]); i++){}
1527 if( z[i]!='<' ) return 0;
1528 i++;
1529 if( strncmp(&z[i],"title>", 6)!=0 ) return 0;
1530 iStart = i+6;
1531 for(i=iStart; z[i] && (z[i]!='<' || strncmp(&z[i],"</title>",8)!=0); i++){}
1532

Keyboard Shortcuts

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