Fossil SCM

Clear compiler warnings on OpenBSD. No functional code changes.

drh 2010-12-19 02:09 trunk
Commit bbbb35a3c68f96f01bcae4700d8b23bb9ecaa936
+2 -2
--- src/db.c
+++ src/db.c
@@ -777,11 +777,11 @@
777777
strncpy(zPwd, zPwdConv, 2000-20);
778778
free(zPwdConv);
779779
while( n>0 ){
780780
if( access(zPwd, W_OK) ) break;
781781
for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){
782
- strcpy(&zPwd[n], aDbName[i]);
782
+ sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]);
783783
if( isValidLocalDb(zPwd) ){
784784
/* Found a valid checkout database file */
785785
zPwd[n] = 0;
786786
while( n>1 && zPwd[n-1]=='/' ){
787787
n--;
@@ -1227,11 +1227,11 @@
12271227
memcpy(zHash, zContent, n);
12281228
zHash[n] = 0;
12291229
}else{
12301230
sha1sum_step_text(zContent, n);
12311231
sha1sum_finish(&out);
1232
- strcpy(zHash, blob_str(&out));
1232
+ sqlite3_snprintf(sizeof(zHash), zHash, "%s", blob_str(&out));
12331233
blob_reset(&out);
12341234
db_multi_exec(
12351235
"INSERT OR IGNORE INTO concealed VALUES(%Q,%#Q)",
12361236
zHash, n, zContent
12371237
);
12381238
--- src/db.c
+++ src/db.c
@@ -777,11 +777,11 @@
777 strncpy(zPwd, zPwdConv, 2000-20);
778 free(zPwdConv);
779 while( n>0 ){
780 if( access(zPwd, W_OK) ) break;
781 for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){
782 strcpy(&zPwd[n], aDbName[i]);
783 if( isValidLocalDb(zPwd) ){
784 /* Found a valid checkout database file */
785 zPwd[n] = 0;
786 while( n>1 && zPwd[n-1]=='/' ){
787 n--;
@@ -1227,11 +1227,11 @@
1227 memcpy(zHash, zContent, n);
1228 zHash[n] = 0;
1229 }else{
1230 sha1sum_step_text(zContent, n);
1231 sha1sum_finish(&out);
1232 strcpy(zHash, blob_str(&out));
1233 blob_reset(&out);
1234 db_multi_exec(
1235 "INSERT OR IGNORE INTO concealed VALUES(%Q,%#Q)",
1236 zHash, n, zContent
1237 );
1238
--- src/db.c
+++ src/db.c
@@ -777,11 +777,11 @@
777 strncpy(zPwd, zPwdConv, 2000-20);
778 free(zPwdConv);
779 while( n>0 ){
780 if( access(zPwd, W_OK) ) break;
781 for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){
782 sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]);
783 if( isValidLocalDb(zPwd) ){
784 /* Found a valid checkout database file */
785 zPwd[n] = 0;
786 while( n>1 && zPwd[n-1]=='/' ){
787 n--;
@@ -1227,11 +1227,11 @@
1227 memcpy(zHash, zContent, n);
1228 zHash[n] = 0;
1229 }else{
1230 sha1sum_step_text(zContent, n);
1231 sha1sum_finish(&out);
1232 sqlite3_snprintf(sizeof(zHash), zHash, "%s", blob_str(&out));
1233 blob_reset(&out);
1234 db_multi_exec(
1235 "INSERT OR IGNORE INTO concealed VALUES(%Q,%#Q)",
1236 zHash, n, zContent
1237 );
1238
+2 -2
--- src/doc.c
+++ src/doc.c
@@ -290,11 +290,11 @@
290290
for(i=0; zName[i]; i++){
291291
if( zName[i]=='.' ) z = &zName[i+1];
292292
}
293293
len = strlen(z);
294294
if( len<sizeof(zSuffix)-1 ){
295
- strcpy(zSuffix, z);
295
+ sqlite3_snprintf(sizeof(zSuffix), zSuffix, "%s", z);
296296
for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]);
297297
first = 0;
298298
last = sizeof(aMime)/sizeof(aMime[0]);
299299
while( first<=last ){
300300
int c;
@@ -347,11 +347,11 @@
347347
while( zName[0]=='/' ){ zName++; }
348348
if( !file_is_simple_pathname(zName) ){
349349
goto doc_not_found;
350350
}
351351
if( strcmp(zBaseline,"ckout")==0 && db_open_local()==0 ){
352
- strcpy(zBaseline,"tip");
352
+ sqlite3_snprintf(sizeof(zBaseline), zBaseline, "tip");
353353
}
354354
if( strcmp(zBaseline,"ckout")==0 ){
355355
/* Read from the local checkout */
356356
char *zFullpath;
357357
db_must_be_within_tree();
358358
--- src/doc.c
+++ src/doc.c
@@ -290,11 +290,11 @@
290 for(i=0; zName[i]; i++){
291 if( zName[i]=='.' ) z = &zName[i+1];
292 }
293 len = strlen(z);
294 if( len<sizeof(zSuffix)-1 ){
295 strcpy(zSuffix, z);
296 for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]);
297 first = 0;
298 last = sizeof(aMime)/sizeof(aMime[0]);
299 while( first<=last ){
300 int c;
@@ -347,11 +347,11 @@
347 while( zName[0]=='/' ){ zName++; }
348 if( !file_is_simple_pathname(zName) ){
349 goto doc_not_found;
350 }
351 if( strcmp(zBaseline,"ckout")==0 && db_open_local()==0 ){
352 strcpy(zBaseline,"tip");
353 }
354 if( strcmp(zBaseline,"ckout")==0 ){
355 /* Read from the local checkout */
356 char *zFullpath;
357 db_must_be_within_tree();
358
--- src/doc.c
+++ src/doc.c
@@ -290,11 +290,11 @@
290 for(i=0; zName[i]; i++){
291 if( zName[i]=='.' ) z = &zName[i+1];
292 }
293 len = strlen(z);
294 if( len<sizeof(zSuffix)-1 ){
295 sqlite3_snprintf(sizeof(zSuffix), zSuffix, "%s", z);
296 for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]);
297 first = 0;
298 last = sizeof(aMime)/sizeof(aMime[0]);
299 while( first<=last ){
300 int c;
@@ -347,11 +347,11 @@
347 while( zName[0]=='/' ){ zName++; }
348 if( !file_is_simple_pathname(zName) ){
349 goto doc_not_found;
350 }
351 if( strcmp(zBaseline,"ckout")==0 && db_open_local()==0 ){
352 sqlite3_snprintf(sizeof(zBaseline), zBaseline, "tip");
353 }
354 if( strcmp(zBaseline,"ckout")==0 ){
355 /* Read from the local checkout */
356 char *zFullpath;
357 db_must_be_within_tree();
358
+1 -1
--- src/finfo.c
+++ src/finfo.c
@@ -248,11 +248,11 @@
248248
char zShort[20];
249249
char zShortCkin[20];
250250
if( zBr==0 ) zBr = "trunk";
251251
gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr);
252252
if( memcmp(zDate, zPrevDate, 10) ){
253
- sprintf(zPrevDate, "%.10s", zDate);
253
+ sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate);
254254
@ <tr><td>
255255
@ <div class="divider">%s(zPrevDate)</div>
256256
@ </td></tr>
257257
}
258258
memcpy(zTime, &zDate[11], 5);
259259
--- src/finfo.c
+++ src/finfo.c
@@ -248,11 +248,11 @@
248 char zShort[20];
249 char zShortCkin[20];
250 if( zBr==0 ) zBr = "trunk";
251 gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr);
252 if( memcmp(zDate, zPrevDate, 10) ){
253 sprintf(zPrevDate, "%.10s", zDate);
254 @ <tr><td>
255 @ <div class="divider">%s(zPrevDate)</div>
256 @ </td></tr>
257 }
258 memcpy(zTime, &zDate[11], 5);
259
--- src/finfo.c
+++ src/finfo.c
@@ -248,11 +248,11 @@
248 char zShort[20];
249 char zShortCkin[20];
250 if( zBr==0 ) zBr = "trunk";
251 gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr);
252 if( memcmp(zDate, zPrevDate, 10) ){
253 sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate);
254 @ <tr><td>
255 @ <div class="divider">%s(zPrevDate)</div>
256 @ </td></tr>
257 }
258 memcpy(zTime, &zDate[11], 5);
259
+3 -3
--- src/info.c
+++ src/info.c
@@ -975,11 +975,11 @@
975975
zLine[0] = zHex[(i>>24)&0xf];
976976
zLine[1] = zHex[(i>>16)&0xf];
977977
zLine[2] = zHex[(i>>8)&0xf];
978978
zLine[3] = zHex[i&0xf];
979979
zLine[4] = ':';
980
- sprintf(zLine, "%04x: ", i);
980
+ sqlite3_snprintf(sizeof(zLine), zLine, "%04x: ", i);
981981
for(j=0; j<16; j++){
982982
k = 5+j*3;
983983
zLine[k] = ' ';
984984
if( i+j<n ){
985985
unsigned char c = x[i+j];
@@ -1478,11 +1478,11 @@
14781478
);
14791479
while( db_step(&q)==SQLITE_ROW ){
14801480
int tagid = db_column_int(&q, 0);
14811481
const char *zTag = db_column_text(&q, 1);
14821482
char zLabel[30];
1483
- sprintf(zLabel, "c%d", tagid);
1483
+ sqlite3_snprintf(sizeof(zLabel), zLabel, "c%d", tagid);
14841484
if( P(zLabel) ){
14851485
db_multi_exec("REPLACE INTO newtags VALUES(%Q,'-',NULL)", zTag);
14861486
}
14871487
}
14881488
db_finalize(&q);
@@ -1613,11 +1613,11 @@
16131613
);
16141614
while( db_step(&q)==SQLITE_ROW ){
16151615
int tagid = db_column_int(&q, 0);
16161616
const char *zTagName = db_column_text(&q, 1);
16171617
char zLabel[30];
1618
- sprintf(zLabel, "c%d", tagid);
1618
+ sqlite3_snprintf(sizeof(zLabel), zLabel, "c%d", tagid);
16191619
if( P(zLabel) ){
16201620
@ <br /><input type="checkbox" name="c%d(tagid)" checked="checked" />
16211621
}else{
16221622
@ <br /><input type="checkbox" name="c%d(tagid)" />
16231623
}
16241624
--- src/info.c
+++ src/info.c
@@ -975,11 +975,11 @@
975 zLine[0] = zHex[(i>>24)&0xf];
976 zLine[1] = zHex[(i>>16)&0xf];
977 zLine[2] = zHex[(i>>8)&0xf];
978 zLine[3] = zHex[i&0xf];
979 zLine[4] = ':';
980 sprintf(zLine, "%04x: ", i);
981 for(j=0; j<16; j++){
982 k = 5+j*3;
983 zLine[k] = ' ';
984 if( i+j<n ){
985 unsigned char c = x[i+j];
@@ -1478,11 +1478,11 @@
1478 );
1479 while( db_step(&q)==SQLITE_ROW ){
1480 int tagid = db_column_int(&q, 0);
1481 const char *zTag = db_column_text(&q, 1);
1482 char zLabel[30];
1483 sprintf(zLabel, "c%d", tagid);
1484 if( P(zLabel) ){
1485 db_multi_exec("REPLACE INTO newtags VALUES(%Q,'-',NULL)", zTag);
1486 }
1487 }
1488 db_finalize(&q);
@@ -1613,11 +1613,11 @@
1613 );
1614 while( db_step(&q)==SQLITE_ROW ){
1615 int tagid = db_column_int(&q, 0);
1616 const char *zTagName = db_column_text(&q, 1);
1617 char zLabel[30];
1618 sprintf(zLabel, "c%d", tagid);
1619 if( P(zLabel) ){
1620 @ <br /><input type="checkbox" name="c%d(tagid)" checked="checked" />
1621 }else{
1622 @ <br /><input type="checkbox" name="c%d(tagid)" />
1623 }
1624
--- src/info.c
+++ src/info.c
@@ -975,11 +975,11 @@
975 zLine[0] = zHex[(i>>24)&0xf];
976 zLine[1] = zHex[(i>>16)&0xf];
977 zLine[2] = zHex[(i>>8)&0xf];
978 zLine[3] = zHex[i&0xf];
979 zLine[4] = ':';
980 sqlite3_snprintf(sizeof(zLine), zLine, "%04x: ", i);
981 for(j=0; j<16; j++){
982 k = 5+j*3;
983 zLine[k] = ' ';
984 if( i+j<n ){
985 unsigned char c = x[i+j];
@@ -1478,11 +1478,11 @@
1478 );
1479 while( db_step(&q)==SQLITE_ROW ){
1480 int tagid = db_column_int(&q, 0);
1481 const char *zTag = db_column_text(&q, 1);
1482 char zLabel[30];
1483 sqlite3_snprintf(sizeof(zLabel), zLabel, "c%d", tagid);
1484 if( P(zLabel) ){
1485 db_multi_exec("REPLACE INTO newtags VALUES(%Q,'-',NULL)", zTag);
1486 }
1487 }
1488 db_finalize(&q);
@@ -1613,11 +1613,11 @@
1613 );
1614 while( db_step(&q)==SQLITE_ROW ){
1615 int tagid = db_column_int(&q, 0);
1616 const char *zTagName = db_column_text(&q, 1);
1617 char zLabel[30];
1618 sqlite3_snprintf(sizeof(zLabel), zLabel, "c%d", tagid);
1619 if( P(zLabel) ){
1620 @ <br /><input type="checkbox" name="c%d(tagid)" checked="checked" />
1621 }else{
1622 @ <br /><input type="checkbox" name="c%d(tagid)" />
1623 }
1624
+2 -2
--- src/login.c
+++ src/login.c
@@ -346,11 +346,11 @@
346346
){
347347
uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'");
348348
g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid);
349349
zCap = "s";
350350
g.noPswd = 1;
351
- strcpy(g.zCsrfToken, "localhost");
351
+ sqlite3_snprintf(sizeof(g.zCsrfToken), g.zCsrfToken, "localhost");
352352
}
353353
354354
/* Check the login cookie to see if it matches a known valid user.
355355
*/
356356
if( uid==0 && (zCookie = P(login_cookie_name()))!=0 ){
@@ -411,11 +411,11 @@
411411
if( uid==0 ){
412412
/* If there is no user "nobody", then make one up - with no privileges */
413413
uid = -1;
414414
zCap = "";
415415
}
416
- strcpy(g.zCsrfToken, "none");
416
+ sqlite3_snprintf(sizeof(g.zCsrfToken), g.zCsrfToken, "none");
417417
}
418418
419419
/* At this point, we know that uid!=0. Find the privileges associated
420420
** with user uid.
421421
*/
422422
--- src/login.c
+++ src/login.c
@@ -346,11 +346,11 @@
346 ){
347 uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'");
348 g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid);
349 zCap = "s";
350 g.noPswd = 1;
351 strcpy(g.zCsrfToken, "localhost");
352 }
353
354 /* Check the login cookie to see if it matches a known valid user.
355 */
356 if( uid==0 && (zCookie = P(login_cookie_name()))!=0 ){
@@ -411,11 +411,11 @@
411 if( uid==0 ){
412 /* If there is no user "nobody", then make one up - with no privileges */
413 uid = -1;
414 zCap = "";
415 }
416 strcpy(g.zCsrfToken, "none");
417 }
418
419 /* At this point, we know that uid!=0. Find the privileges associated
420 ** with user uid.
421 */
422
--- src/login.c
+++ src/login.c
@@ -346,11 +346,11 @@
346 ){
347 uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'");
348 g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid);
349 zCap = "s";
350 g.noPswd = 1;
351 sqlite3_snprintf(sizeof(g.zCsrfToken), g.zCsrfToken, "localhost");
352 }
353
354 /* Check the login cookie to see if it matches a known valid user.
355 */
356 if( uid==0 && (zCookie = P(login_cookie_name()))!=0 ){
@@ -411,11 +411,11 @@
411 if( uid==0 ){
412 /* If there is no user "nobody", then make one up - with no privileges */
413 uid = -1;
414 zCap = "";
415 }
416 sqlite3_snprintf(sizeof(g.zCsrfToken), g.zCsrfToken, "none");
417 }
418
419 /* At this point, we know that uid!=0. Find the privileges associated
420 ** with user uid.
421 */
422
+1 -1
--- src/search.c
+++ src/search.c
@@ -44,11 +44,11 @@
4444
char *z;
4545
int i;
4646
4747
p = fossil_malloc( nPattern + sizeof(*p) + 1);
4848
z = (char*)&p[1];
49
- strcpy(z, zPattern);
49
+ memcpy(z, zPattern, nPattern+1);
5050
memset(p, 0, sizeof(*p));
5151
while( *z && p->nTerm<sizeof(p->a)/sizeof(p->a[0]) ){
5252
while( !fossil_isalnum(*z) && *z ){ z++; }
5353
if( *z==0 ) break;
5454
p->a[p->nTerm].z = z;
5555
--- src/search.c
+++ src/search.c
@@ -44,11 +44,11 @@
44 char *z;
45 int i;
46
47 p = fossil_malloc( nPattern + sizeof(*p) + 1);
48 z = (char*)&p[1];
49 strcpy(z, zPattern);
50 memset(p, 0, sizeof(*p));
51 while( *z && p->nTerm<sizeof(p->a)/sizeof(p->a[0]) ){
52 while( !fossil_isalnum(*z) && *z ){ z++; }
53 if( *z==0 ) break;
54 p->a[p->nTerm].z = z;
55
--- src/search.c
+++ src/search.c
@@ -44,11 +44,11 @@
44 char *z;
45 int i;
46
47 p = fossil_malloc( nPattern + sizeof(*p) + 1);
48 z = (char*)&p[1];
49 memcpy(z, zPattern, nPattern+1);
50 memset(p, 0, sizeof(*p));
51 while( *z && p->nTerm<sizeof(p->a)/sizeof(p->a[0]) ){
52 while( !fossil_isalnum(*z) && *z ){ z++; }
53 if( *z==0 ) break;
54 p->a[p->nTerm].z = z;
55
+2 -2
--- src/timeline.c
+++ src/timeline.c
@@ -232,11 +232,11 @@
232232
if( strcmp(zType,"div")==0 ){
233233
@ <tr><td colspan="3"><hr /></td></tr>
234234
continue;
235235
}
236236
if( memcmp(zDate, zPrevDate, 10) ){
237
- sprintf(zPrevDate, "%.10s", zDate);
237
+ sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate);
238238
@ <tr><td>
239239
@ <div class="divider">%s(zPrevDate)</div>
240240
@ </td></tr>
241241
}
242242
memcpy(zTime, &zDate[11], 5);
@@ -1020,11 +1020,11 @@
10201020
char *zFree = 0;
10211021
int n = 0;
10221022
char zPrefix[80];
10231023
char zUuid[UUID_SIZE+1];
10241024
1025
- sprintf(zUuid, "%.10s", zId);
1025
+ sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId);
10261026
if( memcmp(zDate, zPrevDate, 10) ){
10271027
printf("=== %.10s ===\n", zDate);
10281028
memcpy(zPrevDate, zDate, 10);
10291029
nLine++;
10301030
}
10311031
--- src/timeline.c
+++ src/timeline.c
@@ -232,11 +232,11 @@
232 if( strcmp(zType,"div")==0 ){
233 @ <tr><td colspan="3"><hr /></td></tr>
234 continue;
235 }
236 if( memcmp(zDate, zPrevDate, 10) ){
237 sprintf(zPrevDate, "%.10s", zDate);
238 @ <tr><td>
239 @ <div class="divider">%s(zPrevDate)</div>
240 @ </td></tr>
241 }
242 memcpy(zTime, &zDate[11], 5);
@@ -1020,11 +1020,11 @@
1020 char *zFree = 0;
1021 int n = 0;
1022 char zPrefix[80];
1023 char zUuid[UUID_SIZE+1];
1024
1025 sprintf(zUuid, "%.10s", zId);
1026 if( memcmp(zDate, zPrevDate, 10) ){
1027 printf("=== %.10s ===\n", zDate);
1028 memcpy(zPrevDate, zDate, 10);
1029 nLine++;
1030 }
1031
--- src/timeline.c
+++ src/timeline.c
@@ -232,11 +232,11 @@
232 if( strcmp(zType,"div")==0 ){
233 @ <tr><td colspan="3"><hr /></td></tr>
234 continue;
235 }
236 if( memcmp(zDate, zPrevDate, 10) ){
237 sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate);
238 @ <tr><td>
239 @ <div class="divider">%s(zPrevDate)</div>
240 @ </td></tr>
241 }
242 memcpy(zTime, &zDate[11], 5);
@@ -1020,11 +1020,11 @@
1020 char *zFree = 0;
1021 int n = 0;
1022 char zPrefix[80];
1023 char zUuid[UUID_SIZE+1];
1024
1025 sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId);
1026 if( memcmp(zDate, zPrevDate, 10) ){
1027 printf("=== %.10s ===\n", zDate);
1028 memcpy(zPrevDate, zDate, 10);
1029 nLine++;
1030 }
1031
+5 -5
--- src/vfile.c
+++ src/vfile.c
@@ -61,11 +61,11 @@
6161
6262
sz = strlen(zUuid);
6363
if( sz!=UUID_SIZE || !validate16(zUuid, sz) ){
6464
return 0;
6565
}
66
- strcpy(z, zUuid);
66
+ memcpy(z, zUuid, UUID_SIZE+1);
6767
canonical16(z, sz);
6868
rid = fast_uuid_to_rid(z);
6969
if( rid==0 && phantomize ){
7070
rid = content_new(zUuid);
7171
}
@@ -366,11 +366,11 @@
366366
if( in==0 ){
367367
md5sum_step_text(" 0\n", -1);
368368
continue;
369369
}
370370
fseek(in, 0L, SEEK_END);
371
- sprintf(zBuf, " %ld\n", ftell(in));
371
+ sqlite3_snprintf(sizeof(zBuf), zBuf, " %ld\n", ftell(in));
372372
fseek(in, 0L, SEEK_SET);
373373
md5sum_step_text(zBuf, -1);
374374
/*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/
375375
for(;;){
376376
int n;
@@ -388,11 +388,11 @@
388388
if( zOrigName ) zName = zOrigName;
389389
if( rid>0 ){
390390
md5sum_step_text(zName, -1);
391391
blob_zero(&file);
392392
content_get(rid, &file);
393
- sprintf(zBuf, " %d\n", blob_size(&file));
393
+ sqlite3_snprintf(sizeof(zBuf), zBuf, " %d\n", blob_size(&file));
394394
md5sum_step_text(zBuf, -1);
395395
md5sum_step_blob(&file);
396396
blob_reset(&file);
397397
}
398398
}
@@ -476,11 +476,11 @@
476476
int rid = db_column_int(&q, 2);
477477
int isSelected = db_column_int(&q, 3);
478478
if( zOrigName && !isSelected ) zName = zOrigName;
479479
md5sum_step_text(zName, -1);
480480
content_get(rid, &file);
481
- sprintf(zBuf, " %d\n", blob_size(&file));
481
+ sqlite3_snprintf(sizeof(zBuf), zBuf, " %d\n", blob_size(&file));
482482
md5sum_step_text(zBuf, -1);
483483
/*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/
484484
md5sum_step_blob(&file);
485485
blob_reset(&file);
486486
}
@@ -520,11 +520,11 @@
520520
manifest_file_rewind(pManifest);
521521
while( (pFile = manifest_file_next(pManifest,0))!=0 ){
522522
fid = uuid_to_rid(pFile->zUuid, 0);
523523
md5sum_step_text(pFile->zName, -1);
524524
content_get(fid, &file);
525
- sprintf(zBuf, " %d\n", blob_size(&file));
525
+ sqlite3_snprintf(sizeof(zBuf), zBuf, " %d\n", blob_size(&file));
526526
md5sum_step_text(zBuf, -1);
527527
md5sum_step_blob(&file);
528528
blob_reset(&file);
529529
}
530530
if( pManOut ){
531531
--- src/vfile.c
+++ src/vfile.c
@@ -61,11 +61,11 @@
61
62 sz = strlen(zUuid);
63 if( sz!=UUID_SIZE || !validate16(zUuid, sz) ){
64 return 0;
65 }
66 strcpy(z, zUuid);
67 canonical16(z, sz);
68 rid = fast_uuid_to_rid(z);
69 if( rid==0 && phantomize ){
70 rid = content_new(zUuid);
71 }
@@ -366,11 +366,11 @@
366 if( in==0 ){
367 md5sum_step_text(" 0\n", -1);
368 continue;
369 }
370 fseek(in, 0L, SEEK_END);
371 sprintf(zBuf, " %ld\n", ftell(in));
372 fseek(in, 0L, SEEK_SET);
373 md5sum_step_text(zBuf, -1);
374 /*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/
375 for(;;){
376 int n;
@@ -388,11 +388,11 @@
388 if( zOrigName ) zName = zOrigName;
389 if( rid>0 ){
390 md5sum_step_text(zName, -1);
391 blob_zero(&file);
392 content_get(rid, &file);
393 sprintf(zBuf, " %d\n", blob_size(&file));
394 md5sum_step_text(zBuf, -1);
395 md5sum_step_blob(&file);
396 blob_reset(&file);
397 }
398 }
@@ -476,11 +476,11 @@
476 int rid = db_column_int(&q, 2);
477 int isSelected = db_column_int(&q, 3);
478 if( zOrigName && !isSelected ) zName = zOrigName;
479 md5sum_step_text(zName, -1);
480 content_get(rid, &file);
481 sprintf(zBuf, " %d\n", blob_size(&file));
482 md5sum_step_text(zBuf, -1);
483 /*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/
484 md5sum_step_blob(&file);
485 blob_reset(&file);
486 }
@@ -520,11 +520,11 @@
520 manifest_file_rewind(pManifest);
521 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
522 fid = uuid_to_rid(pFile->zUuid, 0);
523 md5sum_step_text(pFile->zName, -1);
524 content_get(fid, &file);
525 sprintf(zBuf, " %d\n", blob_size(&file));
526 md5sum_step_text(zBuf, -1);
527 md5sum_step_blob(&file);
528 blob_reset(&file);
529 }
530 if( pManOut ){
531
--- src/vfile.c
+++ src/vfile.c
@@ -61,11 +61,11 @@
61
62 sz = strlen(zUuid);
63 if( sz!=UUID_SIZE || !validate16(zUuid, sz) ){
64 return 0;
65 }
66 memcpy(z, zUuid, UUID_SIZE+1);
67 canonical16(z, sz);
68 rid = fast_uuid_to_rid(z);
69 if( rid==0 && phantomize ){
70 rid = content_new(zUuid);
71 }
@@ -366,11 +366,11 @@
366 if( in==0 ){
367 md5sum_step_text(" 0\n", -1);
368 continue;
369 }
370 fseek(in, 0L, SEEK_END);
371 sqlite3_snprintf(sizeof(zBuf), zBuf, " %ld\n", ftell(in));
372 fseek(in, 0L, SEEK_SET);
373 md5sum_step_text(zBuf, -1);
374 /*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/
375 for(;;){
376 int n;
@@ -388,11 +388,11 @@
388 if( zOrigName ) zName = zOrigName;
389 if( rid>0 ){
390 md5sum_step_text(zName, -1);
391 blob_zero(&file);
392 content_get(rid, &file);
393 sqlite3_snprintf(sizeof(zBuf), zBuf, " %d\n", blob_size(&file));
394 md5sum_step_text(zBuf, -1);
395 md5sum_step_blob(&file);
396 blob_reset(&file);
397 }
398 }
@@ -476,11 +476,11 @@
476 int rid = db_column_int(&q, 2);
477 int isSelected = db_column_int(&q, 3);
478 if( zOrigName && !isSelected ) zName = zOrigName;
479 md5sum_step_text(zName, -1);
480 content_get(rid, &file);
481 sqlite3_snprintf(sizeof(zBuf), zBuf, " %d\n", blob_size(&file));
482 md5sum_step_text(zBuf, -1);
483 /*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/
484 md5sum_step_blob(&file);
485 blob_reset(&file);
486 }
@@ -520,11 +520,11 @@
520 manifest_file_rewind(pManifest);
521 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
522 fid = uuid_to_rid(pFile->zUuid, 0);
523 md5sum_step_text(pFile->zName, -1);
524 content_get(fid, &file);
525 sqlite3_snprintf(sizeof(zBuf), zBuf, " %d\n", blob_size(&file));
526 md5sum_step_text(zBuf, -1);
527 md5sum_step_blob(&file);
528 blob_reset(&file);
529 }
530 if( pManOut ){
531
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1078,11 +1078,11 @@
10781078
}else{
10791079
blob_appendf(p->pOut, "[bad-link: %h]", zTarget);
10801080
zTerm = "";
10811081
}
10821082
assert( strlen(zTerm)<nClose );
1083
- strcpy(zClose, zTerm);
1083
+ sqlite3_snprintf(nClose, zClose, "%s", zTerm);
10841084
}
10851085
10861086
/*
10871087
** Check to see if the given parsed markup is the correct
10881088
** </verbatim> tag.
10891089
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1078,11 +1078,11 @@
1078 }else{
1079 blob_appendf(p->pOut, "[bad-link: %h]", zTarget);
1080 zTerm = "";
1081 }
1082 assert( strlen(zTerm)<nClose );
1083 strcpy(zClose, zTerm);
1084 }
1085
1086 /*
1087 ** Check to see if the given parsed markup is the correct
1088 ** </verbatim> tag.
1089
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1078,11 +1078,11 @@
1078 }else{
1079 blob_appendf(p->pOut, "[bad-link: %h]", zTarget);
1080 zTerm = "";
1081 }
1082 assert( strlen(zTerm)<nClose );
1083 sqlite3_snprintf(nClose, zClose, "%s", zTerm);
1084 }
1085
1086 /*
1087 ** Check to see if the given parsed markup is the correct
1088 ** </verbatim> tag.
1089
+5 -3
--- src/winhttp.c
+++ src/winhttp.c
@@ -71,12 +71,14 @@
7171
char zRequestFName[100];
7272
char zReplyFName[100];
7373
char zCmd[2000]; /* Command-line to process the request */
7474
char zHdr[2000]; /* The HTTP request header */
7575
76
- sprintf(zRequestFName, "%s_in%d.txt", zTempPrefix, p->id);
77
- sprintf(zReplyFName, "%s_out%d.txt", zTempPrefix, p->id);
76
+ sqlite3_snprintf(sizeof(zRequestFName), zRequestFName,
77
+ "%s_in%d.txt", zTempPrefix, p->id);
78
+ sqlite3_snprintf(sizeof(zReplyFName), zReplyFName,
79
+ "%s_out%d.txt", zTempPrefix, p->id);
7880
amt = 0;
7981
while( amt<sizeof(zHdr) ){
8082
got = recv(p->s, &zHdr[amt], sizeof(zHdr)-1-amt, 0);
8183
if( got==SOCKET_ERROR ) goto end_request;
8284
if( got==0 ){
@@ -105,11 +107,11 @@
105107
}
106108
wanted -= got;
107109
}
108110
fclose(out);
109111
out = 0;
110
- sprintf(zCmd, "\"%s\" http \"%s\" %s %s %s%s",
112
+ sqlite3_snprintf(sizeof(zCmd), zCmd, "\"%s\" http \"%s\" %s %s %s%s",
111113
fossil_nameofexe(), g.zRepositoryName, zRequestFName, zReplyFName,
112114
inet_ntoa(p->addr.sin_addr), p->zNotFound
113115
);
114116
fossil_system(zCmd);
115117
in = fopen(zReplyFName, "rb");
116118
--- src/winhttp.c
+++ src/winhttp.c
@@ -71,12 +71,14 @@
71 char zRequestFName[100];
72 char zReplyFName[100];
73 char zCmd[2000]; /* Command-line to process the request */
74 char zHdr[2000]; /* The HTTP request header */
75
76 sprintf(zRequestFName, "%s_in%d.txt", zTempPrefix, p->id);
77 sprintf(zReplyFName, "%s_out%d.txt", zTempPrefix, p->id);
 
 
78 amt = 0;
79 while( amt<sizeof(zHdr) ){
80 got = recv(p->s, &zHdr[amt], sizeof(zHdr)-1-amt, 0);
81 if( got==SOCKET_ERROR ) goto end_request;
82 if( got==0 ){
@@ -105,11 +107,11 @@
105 }
106 wanted -= got;
107 }
108 fclose(out);
109 out = 0;
110 sprintf(zCmd, "\"%s\" http \"%s\" %s %s %s%s",
111 fossil_nameofexe(), g.zRepositoryName, zRequestFName, zReplyFName,
112 inet_ntoa(p->addr.sin_addr), p->zNotFound
113 );
114 fossil_system(zCmd);
115 in = fopen(zReplyFName, "rb");
116
--- src/winhttp.c
+++ src/winhttp.c
@@ -71,12 +71,14 @@
71 char zRequestFName[100];
72 char zReplyFName[100];
73 char zCmd[2000]; /* Command-line to process the request */
74 char zHdr[2000]; /* The HTTP request header */
75
76 sqlite3_snprintf(sizeof(zRequestFName), zRequestFName,
77 "%s_in%d.txt", zTempPrefix, p->id);
78 sqlite3_snprintf(sizeof(zReplyFName), zReplyFName,
79 "%s_out%d.txt", zTempPrefix, p->id);
80 amt = 0;
81 while( amt<sizeof(zHdr) ){
82 got = recv(p->s, &zHdr[amt], sizeof(zHdr)-1-amt, 0);
83 if( got==SOCKET_ERROR ) goto end_request;
84 if( got==0 ){
@@ -105,11 +107,11 @@
107 }
108 wanted -= got;
109 }
110 fclose(out);
111 out = 0;
112 sqlite3_snprintf(sizeof(zCmd), zCmd, "\"%s\" http \"%s\" %s %s %s%s",
113 fossil_nameofexe(), g.zRepositoryName, zRequestFName, zReplyFName,
114 inet_ntoa(p->addr.sin_addr), p->zNotFound
115 );
116 fossil_system(zCmd);
117 in = fopen(zReplyFName, "rb");
118

Keyboard Shortcuts

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