Fossil SCM

More proposed fixes to the issues pointed out by Edward Berner.

mistachkin 2014-09-09 19:43 trunk merge
Commit 7807ec4e130b63651f0373683104504dcffb9f64
+3 -4
--- src/cgi.c
+++ src/cgi.c
@@ -1596,15 +1596,14 @@
15961596
void cgi_handle_scgi_request(void){
15971597
char *zHdr;
15981598
char *zToFree;
15991599
int nHdr = 0;
16001600
int nRead;
1601
- int n, m;
1602
- char c;
1601
+ int c, n, m;
16031602
1604
- while( (c = fgetc(g.httpIn))!=EOF && fossil_isdigit(c) ){
1605
- nHdr = nHdr*10 + c - '0';
1603
+ while( (c = fgetc(g.httpIn))!=EOF && fossil_isdigit((char)c) ){
1604
+ nHdr = nHdr*10 + (char)c - '0';
16061605
}
16071606
if( nHdr<16 ) malformed_request("SCGI header too short");
16081607
zToFree = zHdr = fossil_malloc(nHdr);
16091608
nRead = (int)fread(zHdr, 1, nHdr, g.httpIn);
16101609
if( nRead<nHdr ) malformed_request("cannot read entire SCGI header");
16111610
--- src/cgi.c
+++ src/cgi.c
@@ -1596,15 +1596,14 @@
1596 void cgi_handle_scgi_request(void){
1597 char *zHdr;
1598 char *zToFree;
1599 int nHdr = 0;
1600 int nRead;
1601 int n, m;
1602 char c;
1603
1604 while( (c = fgetc(g.httpIn))!=EOF && fossil_isdigit(c) ){
1605 nHdr = nHdr*10 + c - '0';
1606 }
1607 if( nHdr<16 ) malformed_request("SCGI header too short");
1608 zToFree = zHdr = fossil_malloc(nHdr);
1609 nRead = (int)fread(zHdr, 1, nHdr, g.httpIn);
1610 if( nRead<nHdr ) malformed_request("cannot read entire SCGI header");
1611
--- src/cgi.c
+++ src/cgi.c
@@ -1596,15 +1596,14 @@
1596 void cgi_handle_scgi_request(void){
1597 char *zHdr;
1598 char *zToFree;
1599 int nHdr = 0;
1600 int nRead;
1601 int c, n, m;
 
1602
1603 while( (c = fgetc(g.httpIn))!=EOF && fossil_isdigit((char)c) ){
1604 nHdr = nHdr*10 + (char)c - '0';
1605 }
1606 if( nHdr<16 ) malformed_request("SCGI header too short");
1607 zToFree = zHdr = fossil_malloc(nHdr);
1608 nRead = (int)fread(zHdr, 1, nHdr, g.httpIn);
1609 if( nRead<nHdr ) malformed_request("cannot read entire SCGI header");
1610
+1 -1
--- src/diff.c
+++ src/diff.c
@@ -594,11 +594,11 @@
594594
"<td><div class=\"diff%scol\">\n"
595595
"<pre>\n"
596596
"%s"
597597
"</pre>\n"
598598
"</div></td>\n",
599
- col % 3 ? (col == SBS_MKR ? "mkr" : "txt") : "ln",
599
+ (col % 3) ? (col == SBS_MKR ? "mkr" : "txt") : "ln",
600600
blob_str(pCol)
601601
);
602602
}
603603
604604
/*
605605
--- src/diff.c
+++ src/diff.c
@@ -594,11 +594,11 @@
594 "<td><div class=\"diff%scol\">\n"
595 "<pre>\n"
596 "%s"
597 "</pre>\n"
598 "</div></td>\n",
599 col % 3 ? (col == SBS_MKR ? "mkr" : "txt") : "ln",
600 blob_str(pCol)
601 );
602 }
603
604 /*
605
--- src/diff.c
+++ src/diff.c
@@ -594,11 +594,11 @@
594 "<td><div class=\"diff%scol\">\n"
595 "<pre>\n"
596 "%s"
597 "</pre>\n"
598 "</div></td>\n",
599 (col % 3) ? (col == SBS_MKR ? "mkr" : "txt") : "ln",
600 blob_str(pCol)
601 );
602 }
603
604 /*
605
+13 -1
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -28,10 +28,15 @@
2828
# define NULL_DEVICE "NUL"
2929
#else
3030
# define NULL_DEVICE "/dev/null"
3131
#endif
3232
33
+/*
34
+** Used when the name for the diff is unknown.
35
+*/
36
+#define DIFF_NO_NAME "(unknown)"
37
+
3338
/*
3439
** Print the "Index:" message that patches wants to see at the top of a diff.
3540
*/
3641
void diff_print_index(const char *zFile, u64 diffFlags){
3742
if( (diffFlags & (DIFF_SIDEBYSIDE|DIFF_BRIEF))==0 ){
@@ -489,11 +494,18 @@
489494
u64 diffFlags
490495
){
491496
Blob f1, f2;
492497
int isBin1, isBin2;
493498
int rid;
494
- const char *zName = pFrom ? pFrom->zName : pTo->zName;
499
+ const char *zName;
500
+ if( pFrom ){
501
+ zName = pFrom->zName;
502
+ }else if( pTo ){
503
+ zName = pTo->zName;
504
+ }else{
505
+ zName = DIFF_NO_NAME;
506
+ }
495507
if( diffFlags & DIFF_BRIEF ) return;
496508
diff_print_index(zName, diffFlags);
497509
if( pFrom ){
498510
rid = uuid_to_rid(pFrom->zUuid, 0);
499511
content_get(rid, &f1);
500512
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -28,10 +28,15 @@
28 # define NULL_DEVICE "NUL"
29 #else
30 # define NULL_DEVICE "/dev/null"
31 #endif
32
 
 
 
 
 
33 /*
34 ** Print the "Index:" message that patches wants to see at the top of a diff.
35 */
36 void diff_print_index(const char *zFile, u64 diffFlags){
37 if( (diffFlags & (DIFF_SIDEBYSIDE|DIFF_BRIEF))==0 ){
@@ -489,11 +494,18 @@
489 u64 diffFlags
490 ){
491 Blob f1, f2;
492 int isBin1, isBin2;
493 int rid;
494 const char *zName = pFrom ? pFrom->zName : pTo->zName;
 
 
 
 
 
 
 
495 if( diffFlags & DIFF_BRIEF ) return;
496 diff_print_index(zName, diffFlags);
497 if( pFrom ){
498 rid = uuid_to_rid(pFrom->zUuid, 0);
499 content_get(rid, &f1);
500
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -28,10 +28,15 @@
28 # define NULL_DEVICE "NUL"
29 #else
30 # define NULL_DEVICE "/dev/null"
31 #endif
32
33 /*
34 ** Used when the name for the diff is unknown.
35 */
36 #define DIFF_NO_NAME "(unknown)"
37
38 /*
39 ** Print the "Index:" message that patches wants to see at the top of a diff.
40 */
41 void diff_print_index(const char *zFile, u64 diffFlags){
42 if( (diffFlags & (DIFF_SIDEBYSIDE|DIFF_BRIEF))==0 ){
@@ -489,11 +494,18 @@
494 u64 diffFlags
495 ){
496 Blob f1, f2;
497 int isBin1, isBin2;
498 int rid;
499 const char *zName;
500 if( pFrom ){
501 zName = pFrom->zName;
502 }else if( pTo ){
503 zName = pTo->zName;
504 }else{
505 zName = DIFF_NO_NAME;
506 }
507 if( diffFlags & DIFF_BRIEF ) return;
508 diff_print_index(zName, diffFlags);
509 if( pFrom ){
510 rid = uuid_to_rid(pFrom->zUuid, 0);
511 content_get(rid, &f1);
512
+1 -1
--- src/markdown.c
+++ src/markdown.c
@@ -390,11 +390,11 @@
390390
&& data[i]!='>'
391391
&& data[i]!='\''
392392
&& data[i]!='"'
393393
&& data[i]!=' '
394394
&& data[i]!='\t'
395
- && data[i]!='\t'
395
+ && data[i]!='\n'
396396
){
397397
i++;
398398
}
399399
if( i>=size ) return 0;
400400
if( i>j && data[i]=='>' ) return i+1;
401401
--- src/markdown.c
+++ src/markdown.c
@@ -390,11 +390,11 @@
390 && data[i]!='>'
391 && data[i]!='\''
392 && data[i]!='"'
393 && data[i]!=' '
394 && data[i]!='\t'
395 && data[i]!='\t'
396 ){
397 i++;
398 }
399 if( i>=size ) return 0;
400 if( i>j && data[i]=='>' ) return i+1;
401
--- src/markdown.c
+++ src/markdown.c
@@ -390,11 +390,11 @@
390 && data[i]!='>'
391 && data[i]!='\''
392 && data[i]!='"'
393 && data[i]!=' '
394 && data[i]!='\t'
395 && data[i]!='\n'
396 ){
397 i++;
398 }
399 if( i>=size ) return 0;
400 if( i>j && data[i]=='>' ) return i+1;
401
+2
--- src/url.c
+++ src/url.c
@@ -238,10 +238,11 @@
238238
zFile = mprintf("%s/FOSSIL", zUrl);
239239
if( file_isfile(zFile) ){
240240
pUrlData->isFile = 1;
241241
}else{
242242
free(zFile);
243
+ zFile = 0;
243244
fossil_fatal("unknown repository: %s", zUrl);
244245
}
245246
}else{
246247
fossil_fatal("unknown repository: %s", zUrl);
247248
}
@@ -249,10 +250,11 @@
249250
if( pUrlData->isFile ){
250251
Blob cfile;
251252
dehttpize(zFile);
252253
file_canonical_name(zFile, &cfile, 0);
253254
free(zFile);
255
+ zFile = 0;
254256
pUrlData->protocol = "file";
255257
pUrlData->path = "";
256258
pUrlData->name = mprintf("%b", &cfile);
257259
pUrlData->canonical = mprintf("file://%T", pUrlData->name);
258260
blob_reset(&cfile);
259261
--- src/url.c
+++ src/url.c
@@ -238,10 +238,11 @@
238 zFile = mprintf("%s/FOSSIL", zUrl);
239 if( file_isfile(zFile) ){
240 pUrlData->isFile = 1;
241 }else{
242 free(zFile);
 
243 fossil_fatal("unknown repository: %s", zUrl);
244 }
245 }else{
246 fossil_fatal("unknown repository: %s", zUrl);
247 }
@@ -249,10 +250,11 @@
249 if( pUrlData->isFile ){
250 Blob cfile;
251 dehttpize(zFile);
252 file_canonical_name(zFile, &cfile, 0);
253 free(zFile);
 
254 pUrlData->protocol = "file";
255 pUrlData->path = "";
256 pUrlData->name = mprintf("%b", &cfile);
257 pUrlData->canonical = mprintf("file://%T", pUrlData->name);
258 blob_reset(&cfile);
259
--- src/url.c
+++ src/url.c
@@ -238,10 +238,11 @@
238 zFile = mprintf("%s/FOSSIL", zUrl);
239 if( file_isfile(zFile) ){
240 pUrlData->isFile = 1;
241 }else{
242 free(zFile);
243 zFile = 0;
244 fossil_fatal("unknown repository: %s", zUrl);
245 }
246 }else{
247 fossil_fatal("unknown repository: %s", zUrl);
248 }
@@ -249,10 +250,11 @@
250 if( pUrlData->isFile ){
251 Blob cfile;
252 dehttpize(zFile);
253 file_canonical_name(zFile, &cfile, 0);
254 free(zFile);
255 zFile = 0;
256 pUrlData->protocol = "file";
257 pUrlData->path = "";
258 pUrlData->name = mprintf("%b", &cfile);
259 pUrlData->canonical = mprintf("file://%T", pUrlData->name);
260 blob_reset(&cfile);
261

Keyboard Shortcuts

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