Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Consistently use the count(X) macro in place of sizeof(X)/sizeof(*X) throughout the Fossil core, excluding things that don't use makeheaders. Also use count(X) instead of ArraySize(X) which has the same definition. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
e5b62edb284c1e14b992ce384e2cb052 |
| User & Date: | andygoth 2016-11-04 22:37:21.750 |
References
|
2016-11-05
| ||
| 02:48 | Correct builtin text capability, broken by typo in [e5b62edb28] check-in: 584546fe77 user: andygoth tags: trunk | |
Context
|
2016-11-04
| ||
| 23:18 | Cherrypick [9b960af129], was supposed to have been checked into trunk in the first place check-in: bbafc013aa user: andygoth tags: trunk | |
| 22:37 | Consistently use the count(X) macro in place of sizeof(X)/sizeof(*X) throughout the Fossil core, excluding things that don't use makeheaders. Also use count(X) instead of ArraySize(X) which has the same definition. check-in: e5b62edb28 user: andygoth tags: trunk | |
| 21:39 | Use timeline_submenu() instead of style_submenu_element() check-in: c1a77615ca user: andygoth tags: trunk | |
Changes
Changes to src/bisect.c.
| ︙ | ︙ | |||
73 74 75 76 77 78 79 |
/*
** Return the value of a boolean bisect option.
*/
int bisect_option(const char *zName){
unsigned int i;
int r = -1;
| | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
/*
** Return the value of a boolean bisect option.
*/
int bisect_option(const char *zName){
unsigned int i;
int r = -1;
for(i=0; i<count(aBisectOption); i++){
if( fossil_strcmp(zName, aBisectOption[i].zName)==0 ){
char *zLabel = mprintf("bisect-%s", zName);
char *z = db_lget(zLabel, (char*)aBisectOption[i].zDefault);
if( is_truth(z) ) r = 1;
if( is_false(z) ) r = 0;
if( r<0 ) r = is_truth(aBisectOption[i].zDefault);
free(zLabel);
|
| ︙ | ︙ | |||
404 405 406 407 408 409 410 |
}else if( strncmp(zCmd, "log", n)==0 ){
bisect_chart(0);
}else if( strncmp(zCmd, "chart", n)==0 ){
bisect_chart(1);
}else if( strncmp(zCmd, "options", n)==0 ){
if( g.argc==3 ){
unsigned int i;
| | | | | 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
}else if( strncmp(zCmd, "log", n)==0 ){
bisect_chart(0);
}else if( strncmp(zCmd, "chart", n)==0 ){
bisect_chart(1);
}else if( strncmp(zCmd, "options", n)==0 ){
if( g.argc==3 ){
unsigned int i;
for(i=0; i<count(aBisectOption); i++){
char *z = mprintf("bisect-%s", aBisectOption[i].zName);
fossil_print(" %-15s %-6s ", aBisectOption[i].zName,
db_lget(z, (char*)aBisectOption[i].zDefault));
fossil_free(z);
comment_print(aBisectOption[i].zDesc, 0, 27, -1, g.comFmtFlags);
}
}else if( g.argc==4 || g.argc==5 ){
unsigned int i;
n = strlen(g.argv[3]);
for(i=0; i<count(aBisectOption); i++){
if( strncmp(g.argv[3], aBisectOption[i].zName, n)==0 ){
char *z = mprintf("bisect-%s", aBisectOption[i].zName);
if( g.argc==5 ){
db_lset(z, g.argv[4]);
}
fossil_print("%s\n", db_lget(z, (char*)aBisectOption[i].zDefault));
fossil_free(z);
break;
}
}
if( i>=count(aBisectOption) ){
fossil_fatal("no such bisect option: %s", g.argv[3]);
}
}else{
usage("options ?NAME? ?VALUE?");
}
}else if( strncmp(zCmd, "reset", n)==0 ){
db_multi_exec(
|
| ︙ | ︙ |
Changes to src/builtin.c.
| ︙ | ︙ | |||
31 32 33 34 35 36 37 |
/*
** Return a pointer to built-in content
*/
const unsigned char *builtin_file(const char *zFilename, int *piSize){
int lwr, upr, i, c;
lwr = 0;
| | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
/*
** Return a pointer to built-in content
*/
const unsigned char *builtin_file(const char *zFilename, int *piSize){
int lwr, upr, i, c;
lwr = 0;
upr = count(aBuiltinFiles)/ - 1;
while( upr>=lwr ){
i = (upr+lwr)/2;
c = strcmp(aBuiltinFiles[i].zName,zFilename);
if( c<0 ){
lwr = i+1;
}else if( c>0 ){
upr = i-1;
|
| ︙ | ︙ | |||
58 59 60 61 62 63 64 |
/*
** COMMAND: test-builtin-list
**
** List the names and sizes of all built-in resources.
*/
void test_builtin_list(void){
int i;
| | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
/*
** COMMAND: test-builtin-list
**
** List the names and sizes of all built-in resources.
*/
void test_builtin_list(void){
int i;
for(i=0; i<count(aBuiltinFiles); i++){
fossil_print("%-30s %6d\n", aBuiltinFiles[i].zName,aBuiltinFiles[i].nByte);
}
}
/*
** COMMAND: test-builtin-get
**
|
| ︙ | ︙ |
Changes to src/cgi.c.
| ︙ | ︙ | |||
717 718 719 720 721 722 723 |
cgi_set_parameter_nocopy(mprintf("%s:bytes", zName),
mprintf("%d",nContent), 1);
}
}
zName = 0;
showBytes = 0;
}else{
| | | 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 |
cgi_set_parameter_nocopy(mprintf("%s:bytes", zName),
mprintf("%d",nContent), 1);
}
}
zName = 0;
showBytes = 0;
}else{
nArg = tokenize_line(zLine, count(azArg), azArg);
for(i=0; i<nArg; i++){
int c = fossil_tolower(azArg[i][0]);
int n = strlen(azArg[i]);
if( c=='c' && sqlite3_strnicmp(azArg[i],"content-disposition:",n)==0 ){
i++;
}else if( c=='n' && sqlite3_strnicmp(azArg[i],"name=",n)==0 ){
zName = azArg[++i];
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
2797 2798 2799 2800 2801 2802 2803 |
** If allowPrefix is true, then the Setting returned is the first one for
** which zName is a prefix of the Setting name.
*/
const Setting *db_find_setting(const char *zName, int allowPrefix){
int lwr, mid, upr, c;
int n = (int)strlen(zName) + !allowPrefix;
lwr = 0;
| | | 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 |
** If allowPrefix is true, then the Setting returned is the first one for
** which zName is a prefix of the Setting name.
*/
const Setting *db_find_setting(const char *zName, int allowPrefix){
int lwr, mid, upr, c;
int n = (int)strlen(zName) + !allowPrefix;
lwr = 0;
upr = count(aSetting)-2;
while( upr>=lwr ){
mid = (upr+lwr)/2;
c = fossil_strncmp(zName, aSetting[mid].name, n);
if( c<0 ){
upr = mid - 1;
}else if( c>0 ){
lwr = mid + 1;
|
| ︙ | ︙ |
Changes to src/diff.c.
| ︙ | ︙ | |||
1066 1067 1068 1069 1070 1071 1072 |
if( nLeft*nRight>100000 ){
memset(aM, 4, mnLen);
if( nLeft>mnLen ) memset(aM+mnLen, 1, nLeft-mnLen);
if( nRight>mnLen ) memset(aM+mnLen, 2, nRight-mnLen);
return aM;
}
| | | 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 |
if( nLeft*nRight>100000 ){
memset(aM, 4, mnLen);
if( nLeft>mnLen ) memset(aM+mnLen, 1, nLeft-mnLen);
if( nRight>mnLen ) memset(aM+mnLen, 2, nRight-mnLen);
return aM;
}
if( nRight < count(aBuf)-1 ){
pToFree = 0;
a = aBuf;
}else{
a = pToFree = fossil_malloc( sizeof(a[0])*(nRight+1) );
}
/* Compute the best alignment */
|
| ︙ | ︙ |
Changes to src/dispatch.c.
| ︙ | ︙ | |||
67 68 69 70 71 72 73 | ** contain a few webpage entries at the beginning. ** ** The page_index.h file is generated by the mkindex program which scans all ** source code files looking for header comments on the functions that ** implement command and webpages. */ #include "page_index.h" | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | ** contain a few webpage entries at the beginning. ** ** The page_index.h file is generated by the mkindex program which scans all ** source code files looking for header comments on the functions that ** implement command and webpages. */ #include "page_index.h" #define MX_COMMAND count(aCommand) /* ** Given a command or webpage name in zName, find the corresponding CmdOrPage ** object and return a pointer to that object in *ppCmd. ** ** The eType field is CMDFLAG_COMMAND to lookup commands or CMDFLAG_WEBPAGE ** to look up webpages or CMDFLAG_ANY to look for either. If the CMDFLAG_PREFIX |
| ︙ | ︙ |
Changes to src/doc.c.
| ︙ | ︙ | |||
52 53 54 55 56 57 58 |
};
if( !looks_like_binary(pBlob) ) {
return 0; /* Plain text */
}
x = (const unsigned char*)blob_buffer(pBlob);
n = blob_size(pBlob);
| | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
};
if( !looks_like_binary(pBlob) ) {
return 0; /* Plain text */
}
x = (const unsigned char*)blob_buffer(pBlob);
n = blob_size(pBlob);
for(i=0; i<count(aMime); i++){
if( n>=aMime[i].size && memcmp(x, aMime[i].zPrefix, aMime[i].size)==0 ){
return aMime[i].zMimetype;
}
}
return "unknown/unknown";
}
|
| ︙ | ︙ | |||
291 292 293 294 295 296 297 |
/*
** Verify that all entries in the aMime[] table are in sorted order.
** Abort with a fatal error if any is out-of-order.
*/
static void mimetype_verify(void){
int i;
| | | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
/*
** Verify that all entries in the aMime[] table are in sorted order.
** Abort with a fatal error if any is out-of-order.
*/
static void mimetype_verify(void){
int i;
for(i=1; i<count(aMime); i++){
if( fossil_strcmp(aMime[i-1].zSuffix,aMime[i].zSuffix)>=0 ){
fossil_fatal("mimetypes out of sequence: %s before %s",
aMime[i-1].zSuffix, aMime[i].zSuffix);
}
}
}
|
| ︙ | ︙ | |||
329 330 331 332 333 334 335 |
if( zName[i]=='.' ) z = &zName[i+1];
}
len = strlen(z);
if( len<sizeof(zSuffix)-1 ){
sqlite3_snprintf(sizeof(zSuffix), zSuffix, "%s", z);
for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]);
first = 0;
| | | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
if( zName[i]=='.' ) z = &zName[i+1];
}
len = strlen(z);
if( len<sizeof(zSuffix)-1 ){
sqlite3_snprintf(sizeof(zSuffix), zSuffix, "%s", z);
for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]);
first = 0;
last = count(aMime) - 1;
while( first<=last ){
int c;
i = (first+last)/2;
c = fossil_strcmp(zSuffix, aMime[i].zSuffix);
if( c==0 ) return aMime[i].zMimetype;
if( c<0 ){
last = i-1;
|
| ︙ | ︙ | |||
382 383 384 385 386 387 388 | @ suffixes and the following table to guess at the appropriate mimetype @ for each document.</p> @ <table id='mimeTable' border=1 cellpadding=0 class='mimetypetable'> @ <thead> @ <tr><th>Suffix<th>Mimetype @ </thead> @ <tbody> | | | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
@ suffixes and the following table to guess at the appropriate mimetype
@ for each document.</p>
@ <table id='mimeTable' border=1 cellpadding=0 class='mimetypetable'>
@ <thead>
@ <tr><th>Suffix<th>Mimetype
@ </thead>
@ <tbody>
for(i=0; i<count(aMime); i++){
@ <tr><td>%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
}
@ </tbody></table>
output_table_sorting_javascript("mimeTable","tt",1);
style_footer();
}
|
| ︙ | ︙ | |||
591 592 593 594 595 596 597 |
};
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
blob_init(&title, 0, 0);
zDfltTitle = isUV ? "" : "Documentation";
db_begin_transaction();
| | | | | | 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 |
};
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
blob_init(&title, 0, 0);
zDfltTitle = isUV ? "" : "Documentation";
db_begin_transaction();
while( rid==0 && (++nMiss)<=count(azSuffix) ){
zName = P("name");
if( isUV ){
if( zName==0 ) zName = "index.wiki";
i = 0;
}else{
if( zName==0 || zName[0]==0 ) zName = "tip/index.wiki";
for(i=0; zName[i] && zName[i]!='/'; i++){}
zCheckin = mprintf("%.*s", i, zName);
if( fossil_strcmp(zCheckin,"ckout")==0 && g.localOpen==0 ){
zCheckin = "tip";
}
}
if( nMiss==count(azSuffix) ){
zName = "404.md";
}else if( zName[i]==0 ){
assert( nMiss>=0 && nMiss<count(azSuffix) );
zName = azSuffix[nMiss];
}else if( !isUV ){
zName += i;
}
while( zName[0]=='/' ){ zName++; }
if( isUV ){
g.zPath = mprintf("%s/%s", g.zPath, zName);
}else{
g.zPath = mprintf("%s/%s/%s", g.zPath, zCheckin, zName);
}
if( nMiss==0 ) zOrigName = zName;
if( !file_is_simple_pathname(zName, 1) ){
if( sqlite3_strglob("*/", zName)==0 ){
assert( nMiss>=0 && nMiss<count(azSuffix) );
zName = mprintf("%s%s", zName, azSuffix[nMiss]);
if( !file_is_simple_pathname(zName, 1) ){
goto doc_not_found;
}
}else{
goto doc_not_found;
}
|
| ︙ | ︙ | |||
684 685 686 687 688 689 690 |
style_footer();
}else if( fossil_strcmp(zMime, "text/x-markdown")==0 ){
Blob tail = BLOB_INITIALIZER;
markdown_to_html(&filebody, &title, &tail);
if( blob_size(&title)>0 ){
style_header("%s", blob_str(&title));
}else{
| | | 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 |
style_footer();
}else if( fossil_strcmp(zMime, "text/x-markdown")==0 ){
Blob tail = BLOB_INITIALIZER;
markdown_to_html(&filebody, &title, &tail);
if( blob_size(&title)>0 ){
style_header("%s", blob_str(&title));
}else{
style_header("%s", nMiss>=count(azSuffix)?
"Not Found" : zDfltTitle);
}
convert_href_and_output(&tail);
style_footer();
}else if( fossil_strcmp(zMime, "text/plain")==0 ){
style_header("%s", zDfltTitle);
@ <blockquote><pre>
|
| ︙ | ︙ | |||
717 718 719 720 721 722 723 |
style_footer();
}
#endif
}else{
cgi_set_content_type(zMime);
cgi_set_content(&filebody);
}
| | | 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 |
style_footer();
}
#endif
}else{
cgi_set_content_type(zMime);
cgi_set_content(&filebody);
}
if( nMiss>=count(azSuffix) ) cgi_set_status(404, "Not Found");
db_end_transaction(0);
return;
/* Jump here when unable to locate the document */
doc_not_found:
db_end_transaction(0);
if( isUV && P("name")==0 ){
|
| ︙ | ︙ |
Changes to src/file.c.
| ︙ | ︙ | |||
1288 1289 1290 1291 1292 1293 1294 |
}
azDirs[1] = fossil_getenv("TEMP");
azDirs[2] = fossil_getenv("TMP");
#endif
| | | 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 |
}
azDirs[1] = fossil_getenv("TEMP");
azDirs[2] = fossil_getenv("TMP");
#endif
for(i=0; i<count(azDirs); i++){
if( azDirs[i]==0 ) continue;
if( !file_isdir(azDirs[i]) ) continue;
zDir = azDirs[i];
break;
}
/* Check that the output buffer is large enough for the temporary file
|
| ︙ | ︙ | |||
1405 1406 1407 1408 1409 1410 1411 |
** path element.
*/
const char *file_is_win_reserved(const char *zPath){
static const char *azRes[] = { "CON", "PRN", "AUX", "NUL", "COM", "LPT" };
static char zReturn[5];
int i;
while( zPath[0] ){
| | | 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 |
** path element.
*/
const char *file_is_win_reserved(const char *zPath){
static const char *azRes[] = { "CON", "PRN", "AUX", "NUL", "COM", "LPT" };
static char zReturn[5];
int i;
while( zPath[0] ){
for(i=0; i<count(azRes); i++){
if( sqlite3_strnicmp(zPath, azRes[i], 3)==0
&& ((i>=4 && fossil_isdigit(zPath[3])
&& (zPath[4]=='/' || zPath[4]=='.' || zPath[4]==0))
|| (i<4 && (zPath[3]=='/' || zPath[3]=='.' || zPath[3]==0)))
){
sqlite3_snprintf(5,zReturn,"%.*s", i>=4 ? 4 : 3, zPath);
return zReturn;
|
| ︙ | ︙ |
Changes to src/finfo.c.
| ︙ | ︙ | |||
452 453 454 455 456 457 458 |
char zTime[10];
int nParent = 0;
int aParent[GR_MAX_RAIL];
db_bind_int(&qparent, ":fid", frid);
db_bind_int(&qparent, ":mid", fmid);
db_bind_int(&qparent, ":fnid", fnid);
| | | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
char zTime[10];
int nParent = 0;
int aParent[GR_MAX_RAIL];
db_bind_int(&qparent, ":fid", frid);
db_bind_int(&qparent, ":mid", fmid);
db_bind_int(&qparent, ":fnid", fnid);
while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){
aParent[nParent] = db_column_int(&qparent, 0);
nParent++;
}
db_reset(&qparent);
if( zBr==0 ) zBr = "trunk";
if( uBg ){
zBgClr = hash_color(zUser);
|
| ︙ | ︙ |
Changes to src/import.c.
| ︙ | ︙ | |||
1610 1611 1612 1613 1614 1615 1616 |
int format; /* 1=git, 2=svn, 3=any */
} renOpts[] = {
{"rename-branch", &gimport.zBranchPre, "", &gimport.zBranchSuf, "", 3},
{"rename-tag" , &gimport.zTagPre , "", &gimport.zTagSuf , "", 3},
{"rename-rev" , &gsvn.zRevPre, "svn-rev-", &gsvn.zRevSuf , "", 2},
}, *renOpt = renOpts;
int i;
| | | 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 |
int format; /* 1=git, 2=svn, 3=any */
} renOpts[] = {
{"rename-branch", &gimport.zBranchPre, "", &gimport.zBranchSuf, "", 3},
{"rename-tag" , &gimport.zTagPre , "", &gimport.zTagSuf , "", 3},
{"rename-rev" , &gsvn.zRevPre, "svn-rev-", &gsvn.zRevSuf , "", 2},
}, *renOpt = renOpts;
int i;
for( i = 0; i < count(renOpts); ++i, ++renOpt ){
if( 1 << svnFlag & renOpt->format ){
const char *zArgument = find_option(renOpt->zOpt, 0, 1);
if( zArgument ){
const char *sep = strchr(zArgument, '%');
if( !sep ){
fossil_fatal("missing '%%' in argument to --%s", renOpt->zOpt);
}else if( strchr(sep + 1, '%') ){
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
2246 2247 2248 2249 2250 2251 2252 |
{ "#d69b80", 0 },
{ "#d1d680", 0 },
{ "#91d680", 0 },
{ "custom", "##" },
};
| | | 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 |
{ "#d69b80", 0 },
{ "#d1d680", 0 },
{ "#91d680", 0 },
{ "custom", "##" },
};
int nColor = count(aColor)-1;
int stdClrFound = 0;
int i;
if( zIdPropagate ){
@ <div><label>
if( fPropagate ){
@ <input type="checkbox" name="%s(zIdPropagate)" checked="checked" />
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
2348 2349 2350 2351 2352 2353 2354 |
#if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__)
zBrowser = db_get("web-browser", 0);
if( zBrowser==0 ){
static const char *const azBrowserProg[] =
{ "xdg-open", "gnome-open", "firefox", "google-chrome" };
int i;
zBrowser = "echo";
| | | 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 |
#if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__)
zBrowser = db_get("web-browser", 0);
if( zBrowser==0 ){
static const char *const azBrowserProg[] =
{ "xdg-open", "gnome-open", "firefox", "google-chrome" };
int i;
zBrowser = "echo";
for(i=0; i<count(azBrowserProg); i++){
if( binaryOnPath(azBrowserProg[i]) ){
zBrowser = azBrowserProg[i];
break;
}
}
}
#else
|
| ︙ | ︙ |
Changes to src/markdown.c.
| ︙ | ︙ | |||
293 294 295 296 297 298 299 |
if( i>=size ) return 0;
/* binary search of the tag */
key.text = data;
key.size = i;
return bsearch(&key,
block_tags,
| | | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
if( i>=size ) return 0;
/* binary search of the tag */
key.text = data;
key.size = i;
return bsearch(&key,
block_tags,
count(block_tags),
sizeof block_tags[0],
cmp_html_tag);
}
/* new_work_buffer -- get a new working buffer from the stack or create one */
static struct Blob *new_work_buffer(struct render *rndr){
|
| ︙ | ︙ |
Changes to src/merge3.c.
| ︙ | ︙ | |||
314 315 316 317 318 319 320 | int i, j; int len = (int)strlen(mergeMarker[0]); const char *z = blob_buffer(p); int n = blob_size(p) - len + 1; assert( len==(int)strlen(mergeMarker[1]) ); assert( len==(int)strlen(mergeMarker[2]) ); assert( len==(int)strlen(mergeMarker[3]) ); | | | 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
int i, j;
int len = (int)strlen(mergeMarker[0]);
const char *z = blob_buffer(p);
int n = blob_size(p) - len + 1;
assert( len==(int)strlen(mergeMarker[1]) );
assert( len==(int)strlen(mergeMarker[2]) );
assert( len==(int)strlen(mergeMarker[3]) );
assert( count(mergeMarker)==4 );
for(i=0; i<n; ){
for(j=0; j<4; j++){
if( memcmp(&z[i], mergeMarker[j], len)==0 ) return 1;
}
while( i<n && z[i]!='\n' ){ i++; }
while( i<n && z[i]=='\n' ){ i++; }
}
|
| ︙ | ︙ |
Changes to src/moderate.c.
| ︙ | ︙ | |||
65 66 67 68 69 70 71 |
"modreq", "attachRid",
"mlink", "mid",
"mlink", "fid",
"tagxref", "srcid",
"tagxref", "rid",
};
int i;
| | | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
"modreq", "attachRid",
"mlink", "mid",
"mlink", "fid",
"tagxref", "srcid",
"tagxref", "rid",
};
int i;
for(i=0; i<count(aTabField); i+=2){
if( db_exists("SELECT 1 FROM \"%w\" WHERE \"%w\"=%d",
aTabField[i], aTabField[i+1], rid) ) return 1;
}
return 0;
}
/*
|
| ︙ | ︙ |
Changes to src/name.c.
| ︙ | ︙ | |||
1202 1203 1204 1205 1206 1207 1208 |
}
for(j=0; j<aCollide[i].cnt && j<MAX_COLLIDE; j++){
char *zId = aCollide[i].azHit[j];
if( zId==0 ) continue;
@ %z(href("%R/whatis/%s",zId))%h(zId)</a>
}
}
| | | 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 |
}
for(j=0; j<aCollide[i].cnt && j<MAX_COLLIDE; j++){
char *zId = aCollide[i].azHit[j];
if( zId==0 ) continue;
@ %z(href("%R/whatis/%s",zId))%h(zId)</a>
}
}
for(i=4; i<count(aCollide); i++){
for(j=0; j<aCollide[i].cnt && j<MAX_COLLIDE; j++){
fossil_free(aCollide[i].azHit[j]);
}
}
}
/*
|
| ︙ | ︙ |
Changes to src/printf.c.
| ︙ | ︙ | |||
156 157 158 159 160 161 162 |
{ 'G', 0, 1, etGENERIC, 14, 0 },
{ 'i', 10, 1, etRADIX, 0, 0 },
{ 'n', 0, 0, etSIZE, 0, 0 },
{ '%', 0, 0, etPERCENT, 0, 0 },
{ 'p', 16, 0, etPOINTER, 0, 1 },
{ '/', 0, 0, etPATH, 0, 0 },
};
| | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
{ 'G', 0, 1, etGENERIC, 14, 0 },
{ 'i', 10, 1, etRADIX, 0, 0 },
{ 'n', 0, 0, etSIZE, 0, 0 },
{ '%', 0, 0, etPERCENT, 0, 0 },
{ 'p', 16, 0, etPOINTER, 0, 1 },
{ '/', 0, 0, etPATH, 0, 0 },
};
#define etNINFO count(fmtinfo)
/*
** "*val" is a double such that 0.1 <= *val < 10.0
** Return the ascii code for the leading digit of *val, then
** multiply "*val" by 10.0 to renormalize.
**
** Example:
|
| ︙ | ︙ | |||
968 969 970 971 972 973 974 |
fprintf(out, "------------- %04d-%02d-%02d %02d:%02d:%02d UTC ------------\n",
pNow->tm_year+1900, pNow->tm_mon+1, pNow->tm_mday+1,
pNow->tm_hour, pNow->tm_min, pNow->tm_sec);
va_start(ap, zFormat);
vfprintf(out, zFormat, ap);
fprintf(out, "\n");
va_end(ap);
| | | 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 |
fprintf(out, "------------- %04d-%02d-%02d %02d:%02d:%02d UTC ------------\n",
pNow->tm_year+1900, pNow->tm_mon+1, pNow->tm_mday+1,
pNow->tm_hour, pNow->tm_min, pNow->tm_sec);
va_start(ap, zFormat);
vfprintf(out, zFormat, ap);
fprintf(out, "\n");
va_end(ap);
for(i=0; i<count(azEnv); i++){
char *p;
if( (p = fossil_getenv(azEnv[i]))!=0 ){
fprintf(out, "%s=%s\n", azEnv[i], p);
fossil_path_free(p);
}else if( (z = P(azEnv[i]))!=0 ){
fprintf(out, "%s=%s\n", azEnv[i], z);
}
|
| ︙ | ︙ |
Changes to src/regexp.c.
| ︙ | ︙ | |||
203 204 205 206 207 208 209 |
strncmp((const char*)zIn+in.i, (const char*)pRe->zInit, pRe->nInit)!=0)
){
in.i++;
}
if( in.i+pRe->nInit>in.mx ) return 0;
}
| | | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
strncmp((const char*)zIn+in.i, (const char*)pRe->zInit, pRe->nInit)!=0)
){
in.i++;
}
if( in.i+pRe->nInit>in.mx ) return 0;
}
if( pRe->nState<=count(aSpace)*2 ){
pToFree = 0;
aStateSet[0].aState = aSpace;
}else{
pToFree = fossil_malloc( sizeof(ReStateNumber)*2*pRe->nState );
if( pToFree==0 ) return -1;
aStateSet[0].aState = pToFree;
}
|
| ︙ | ︙ |
Changes to src/report.c.
| ︙ | ︙ | |||
196 197 198 199 200 201 202 |
"tagxref",
"unversioned",
};
int i;
if( fossil_strncmp(zArg1, "fx_", 3)==0 ){
break;
}
| | | | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
"tagxref",
"unversioned",
};
int i;
if( fossil_strncmp(zArg1, "fx_", 3)==0 ){
break;
}
for(i=0; i<count(azAllowed); i++){
if( fossil_stricmp(zArg1, azAllowed[i])==0 ) break;
}
if( i>=count(azAllowed) ){
*(char**)pError = mprintf("access to table \"%s\" is restricted",zArg1);
rc = SQLITE_DENY;
}else if( !g.perm.RdAddr && strncmp(zArg2, "private_", 8)==0 ){
rc = SQLITE_IGNORE;
}
break;
}
|
| ︙ | ︙ |
Changes to src/search.c.
| ︙ | ︙ | |||
416 417 418 419 420 421 422 |
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char *azDoc[5];
int nDoc;
int rc;
| | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char *azDoc[5];
int nDoc;
int rc;
for(nDoc=0; nDoc<count(azDoc) && nDoc<argc; nDoc++){
azDoc[nDoc] = (const char*)sqlite3_value_text(argv[nDoc]);
if( azDoc[nDoc]==0 ) azDoc[nDoc] = "";
}
rc = search_match(&gSearch, nDoc, azDoc);
sqlite3_result_int(context, rc);
}
|
| ︙ | ︙ | |||
655 656 657 658 659 660 661 |
{ SRCH_TKT, "search-tkt" },
{ SRCH_WIKI, "search-wiki" },
};
int i;
if( g.perm.Read==0 ) srchFlags &= ~(SRCH_CKIN|SRCH_DOC);
if( g.perm.RdTkt==0 ) srchFlags &= ~(SRCH_TKT);
if( g.perm.RdWiki==0 ) srchFlags &= ~(SRCH_WIKI);
| | | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 |
{ SRCH_TKT, "search-tkt" },
{ SRCH_WIKI, "search-wiki" },
};
int i;
if( g.perm.Read==0 ) srchFlags &= ~(SRCH_CKIN|SRCH_DOC);
if( g.perm.RdTkt==0 ) srchFlags &= ~(SRCH_TKT);
if( g.perm.RdWiki==0 ) srchFlags &= ~(SRCH_WIKI);
for(i=0; i<count(aSetng); i++){
unsigned int m = aSetng[i].m;
if( (srchFlags & m)==0 ) continue;
if( ((knownGood|knownBad) & m)!=0 ) continue;
if( db_get_boolean(aSetng[i].zKey,0) ){
knownGood |= m;
}else{
knownBad |= m;
|
| ︙ | ︙ | |||
890 891 892 893 894 895 896 |
static const struct { unsigned m; char c; } aMask[] = {
{ SRCH_CKIN, 'c' },
{ SRCH_DOC, 'd' },
{ SRCH_TKT, 't' },
{ SRCH_WIKI, 'w' },
};
int i;
| | | 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 |
static const struct { unsigned m; char c; } aMask[] = {
{ SRCH_CKIN, 'c' },
{ SRCH_DOC, 'd' },
{ SRCH_TKT, 't' },
{ SRCH_WIKI, 'w' },
};
int i;
for(i=0; i<count(aMask); i++){
if( srchFlags & aMask[i].m ){
blob_appendf(&sql, "%sftsdocs.type='%c'", zSep, aMask[i].c);
zSep = " OR ";
}
}
blob_append(&sql,")",1);
}
|
| ︙ | ︙ | |||
1068 1069 1070 1071 1072 1073 1074 |
{ "t", "Tickets", SRCH_TKT },
{ "w", "Wiki", SRCH_WIKI },
};
const char *zY = PD("y","all");
unsigned newFlags = srchFlags;
int i;
@ <select size='1' name='y'>
| | | 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 |
{ "t", "Tickets", SRCH_TKT },
{ "w", "Wiki", SRCH_WIKI },
};
const char *zY = PD("y","all");
unsigned newFlags = srchFlags;
int i;
@ <select size='1' name='y'>
for(i=0; i<count(aY); i++){
if( (aY[i].m & srchFlags)==0 ) continue;
cgi_printf("<option value='%s'", aY[i].z);
if( fossil_strcmp(zY,aY[i].z)==0 ){
newFlags &= aY[i].m;
cgi_printf(" selected");
}
cgi_printf(">%s</option>\n", aY[i].zNm);
|
| ︙ | ︙ | |||
1725 1726 1727 1728 1729 1730 1731 |
int i, j, n;
int iCmd = 0;
int iAction = 0;
db_find_and_open_repository(0, 0);
if( g.argc>2 ){
zSubCmd = g.argv[2];
n = (int)strlen(zSubCmd);
| | | | | 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 |
int i, j, n;
int iCmd = 0;
int iAction = 0;
db_find_and_open_repository(0, 0);
if( g.argc>2 ){
zSubCmd = g.argv[2];
n = (int)strlen(zSubCmd);
for(i=0; i<count(aCmd); i++){
if( fossil_strncmp(aCmd[i].z, zSubCmd, n)==0 ) break;
}
if( i>=count(aCmd) ){
Blob all;
blob_init(&all,0,0);
for(i=0; i<count(aCmd); i++) blob_appendf(&all, " %s", aCmd[i].z);
fossil_fatal("unknown \"%s\" - should be on of:%s",
zSubCmd, blob_str(&all));
return;
}
iCmd = aCmd[i].iCmd;
}
g.perm.Read = 1;
|
| ︙ | ︙ | |||
1755 1756 1757 1758 1759 1760 1761 |
db_begin_transaction();
/* Adjust search settings */
if( iCmd==3 || iCmd==4 ){
const char *zCtrl;
if( g.argc<4 ) usage(mprintf("%s STRING",zSubCmd));
zCtrl = g.argv[3];
| | | | 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 |
db_begin_transaction();
/* Adjust search settings */
if( iCmd==3 || iCmd==4 ){
const char *zCtrl;
if( g.argc<4 ) usage(mprintf("%s STRING",zSubCmd));
zCtrl = g.argv[3];
for(j=0; j<count(aSetng); j++){
if( strchr(zCtrl, aSetng[j].zSw[0])!=0 ){
db_set_int(aSetng[j].zSetting, iCmd-3, 0);
}
}
}
if( iCmd==5 ){
if( g.argc<4 ) usage("porter ON/OFF");
db_set_int("search-stemmer", is_truth(g.argv[3]), 0);
}
/* destroy or rebuild the index, if requested */
if( iAction>=1 ){
search_drop_index();
}
if( iAction>=2 ){
search_rebuild_index();
}
/* Always show the status before ending */
for(i=0; i<count(aSetng); i++){
fossil_print("%-16s %s\n", aSetng[i].zName,
db_get_boolean(aSetng[i].zSetting,0) ? "on" : "off");
}
fossil_print("%-16s %s\n", "Porter stemmer:",
db_get_boolean("search-stemmer",0) ? "on" : "off");
if( search_index_exists() ){
fossil_print("%-16s enabled\n", "full-text index:");
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
17 18 19 20 21 22 23 | ** ** Implementation of the Setup page */ #include "config.h" #include <assert.h> #include "setup.h" | < < < < | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ** ** Implementation of the Setup page */ #include "config.h" #include <assert.h> #include "setup.h" /* ** Output a single entry for a menu generated using an HTML table. ** If zLink is not NULL or an empty string, then it is the page that ** the menu entry will hyperlink to. If zLink is NULL or "", then ** the menu entry has no hyperlink - it is disabled. */ void setup_menu_entry( |
| ︙ | ︙ | |||
1429 1430 1431 1432 1433 1434 1435 |
@ %s(zTmDiff) hours behind UTC.</p>
}else{
@ %s(zTmDiff) hours ahead of UTC.</p>
}
@ <hr />
multiple_choice_attribute("Per-Item Time Format", "timeline-date-format",
| | | 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 |
@ %s(zTmDiff) hours behind UTC.</p>
}else{
@ %s(zTmDiff) hours ahead of UTC.</p>
}
@ <hr />
multiple_choice_attribute("Per-Item Time Format", "timeline-date-format",
"tdf", "0", count(azTimeFormats)/2, azTimeFormats);
@ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown
@ in a separate box (using CSS class "timelineDate") whenever the date changes.
@ With the "YYYY-MM-DD HH:MM" and "YYMMDD ..." formats, the complete date
@ and time is shown on every timeline entry (using the CSS class "timelineTime").</p>
@ <hr />
onoff_attribute("Show version differences by default",
|
| ︙ | ︙ |
Changes to src/skins.c.
| ︙ | ︙ | |||
98 99 100 101 102 103 104 |
char *skin_use_alternative(const char *zName){
int i;
Blob err = BLOB_INITIALIZER;
if( strchr(zName, '/')!=0 ){
zAltSkinDir = fossil_strdup(zName);
return 0;
}
| | | | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
char *skin_use_alternative(const char *zName){
int i;
Blob err = BLOB_INITIALIZER;
if( strchr(zName, '/')!=0 ){
zAltSkinDir = fossil_strdup(zName);
return 0;
}
for(i=0; i<count(aBuiltinSkin); i++){
if( fossil_strcmp(aBuiltinSkin[i].zLabel, zName)==0 ){
pAltSkin = &aBuiltinSkin[i];
return 0;
}
}
blob_appendf(&err, "available skins: %s", aBuiltinSkin[0].zLabel);
for(i=1; i<count(aBuiltinSkin); i++){
blob_append(&err, " ", 1);
blob_append(&err, aBuiltinSkin[i].zLabel, -1);
}
return blob_str(&err);
}
/*
|
| ︙ | ︙ | |||
161 162 163 164 165 166 167 |
}
/*
** Return a pointer to a SkinDetail element. Return 0 if not found.
*/
static struct SkinDetail *skin_detail_find(const char *zName){
int lwr = 0;
| | | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
}
/*
** Return a pointer to a SkinDetail element. Return 0 if not found.
*/
static struct SkinDetail *skin_detail_find(const char *zName){
int lwr = 0;
int upr = count(aSkinDetail);
while( upr>=lwr ){
int mid = (upr+lwr)/2;
int c = fossil_strcmp(aSkinDetail[mid].zName, zName);
if( c==0 ) return &aSkinDetail[mid];
if( c<0 ){
lwr = mid+1;
}else{
|
| ︙ | ︙ | |||
281 282 283 284 285 286 287 |
/*
** Return true if there exists a skin name "zSkinName".
*/
static int skinExists(const char *zSkinName){
int i;
if( zSkinName==0 ) return 0;
| | | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
/*
** Return true if there exists a skin name "zSkinName".
*/
static int skinExists(const char *zSkinName){
int i;
if( zSkinName==0 ) return 0;
for(i=0; i<count(aBuiltinSkin); i++){
if( fossil_strcmp(zSkinName, aBuiltinSkin[i].zDesc)==0 ) return 1;
}
return db_exists("SELECT 1 FROM config WHERE name='skin:%q'", zSkinName);
}
/*
** Construct and return an string of SQL statements that represents
** a "skin" setting. If zName==0 then return the skin currently
** installed. Otherwise, return one of the built-in skins designated
** by zName.
**
** Memory to hold the returned string is obtained from malloc.
*/
static char *getSkin(const char *zName){
const char *z;
char *zLabel;
static const char *azType[] = { "css", "header", "footer", "details" };
int i;
Blob val;
blob_zero(&val);
for(i=0; i<count(azType); i++){
if( zName ){
zLabel = mprintf("skins/%s/%s.txt", zName, azType[i]);
z = builtin_text(zLabel);
fossil_free(zLabel);
}else{
z = db_get(azType[i], 0);
if( z==0 ){
|
| ︙ | ︙ | |||
425 426 427 428 429 430 431 |
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
zCurrent = getSkin(0);
| | | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
zCurrent = getSkin(0);
for(i=0; i<count(aBuiltinSkin); i++){
aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel);
}
/* Process requests to delete a user-defined skin */
if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){
style_header("Confirm Custom Skin Delete");
@ <form action="%s(g.zTop)/setup_skin" method="post"><div>
|
| ︙ | ︙ | |||
456 457 458 459 460 461 462 |
/* The user pressed one of the "Install" buttons. */
if( P("load") && (z = P("sn"))!=0 && z[0] ){
int seen = 0;
/* Check to see if the current skin is already saved. If it is, there
** is no need to create a backup */
zCurrent = getSkin(0);
| | | | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
/* The user pressed one of the "Install" buttons. */
if( P("load") && (z = P("sn"))!=0 && z[0] ){
int seen = 0;
/* Check to see if the current skin is already saved. If it is, there
** is no need to create a backup */
zCurrent = getSkin(0);
for(i=0; i<count(aBuiltinSkin); i++){
if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){
seen = 1;
break;
}
}
if( !seen ){
seen = db_exists("SELECT 1 FROM config WHERE name GLOB 'skin:*'"
" AND value=%Q", zCurrent);
if( !seen ){
db_multi_exec(
"INSERT INTO config(name,value,mtime) VALUES("
" strftime('skin:Backup On %%Y-%%m-%%d %%H:%%M:%%S'),"
" %Q,now())", zCurrent
);
}
}
seen = 0;
for(i=0; i<count(aBuiltinSkin); i++){
if( fossil_strcmp(aBuiltinSkin[i].zDesc, z)==0 ){
seen = 1;
zCurrent = aBuiltinSkin[i].zSQL;
db_multi_exec("%s", zCurrent/*safe-for-%s*/);
break;
}
}
|
| ︙ | ︙ | |||
511 512 513 514 515 516 517 |
@ "%h(pAltSkin->zLabel)". You can change the skin configuration
@ below, but the changes will not take effect until the Fossil server
@ is restarted without the override.</p>
@
}
@ <h2>Available Skins:</h2>
@ <table border="0">
| | | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
@ "%h(pAltSkin->zLabel)". You can change the skin configuration
@ below, but the changes will not take effect until the Fossil server
@ is restarted without the override.</p>
@
}
@ <h2>Available Skins:</h2>
@ <table border="0">
for(i=0; i<count(aBuiltinSkin); i++){
z = aBuiltinSkin[i].zDesc;
@ <tr><td>%d(i+1).<td>%h(z)<td> <td>
if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){
@ (Currently In Use)
seenCurrent = 1;
}else{
@ <form action="%s(g.zTop)/setup_skin" method="post">
|
| ︙ | ︙ | |||
595 596 597 598 599 600 601 |
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
ii = atoi(PD("w","0"));
| | | | | 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 |
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
ii = atoi(PD("w","0"));
if( ii<0 || ii>count(aSkinAttr) ) ii = 0;
zBasis = PD("basis","default");
zDflt = mprintf("skins/%s/%s.txt", zBasis, aSkinAttr[ii].zFile);
db_begin_transaction();
if( P("revert")!=0 ){
db_multi_exec("DELETE FROM config WHERE name=%Q", aSkinAttr[ii].zFile);
cgi_replace_parameter(aSkinAttr[ii].zFile, builtin_text(zDflt));
}
style_header("%s", aSkinAttr[ii].zTitle);
for(j=0; j<count(aSkinAttr); j++){
if( j==ii ) continue;
style_submenu_element(aSkinAttr[j].zSubmenu,
"%R/setup_skinedit?w=%d&basis=%h",j,zBasis);
}
style_submenu_element("Skins", "%R/setup_skin");
@ <form action="%s(g.zTop)/setup_skinedit" method="post"><div>
login_insert_csrf_secret();
@ <input type='hidden' name='w' value='%d(ii)'>
@ <h2>Edit %s(aSkinAttr[ii].zTitle):</h2>
zContent = textarea_attribute("", 10, 80, aSkinAttr[ii].zFile,
aSkinAttr[ii].zFile, builtin_text(zDflt), 0);
@ <br />
@ <input type="submit" name="submit" value="Apply Changes" />
@ <hr />
@ Baseline: <select size='1' name='basis'>
for(j=0; j<count(aBuiltinSkin); j++){
cgi_printf("<option value='%h'%s>%h</option>\n",
aBuiltinSkin[j].zLabel,
fossil_strcmp(zBasis,aBuiltinSkin[j].zLabel)==0 ? " selected" : "",
aBuiltinSkin[j].zDesc
);
}
@ </select>
|
| ︙ | ︙ |
Changes to src/statrep.c.
| ︙ | ︙ | |||
704 705 706 707 708 709 710 |
zUserName = P("user");
if( zUserName==0 ) zUserName = P("u");
if( zUserName && zUserName[0]==0 ) zUserName = 0;
if( zView==0 ){
zView = "byuser";
cgi_replace_query_parameter("view","byuser");
}
| | | | | 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 |
zUserName = P("user");
if( zUserName==0 ) zUserName = P("u");
if( zUserName && zUserName[0]==0 ) zUserName = 0;
if( zView==0 ){
zView = "byuser";
cgi_replace_query_parameter("view","byuser");
}
for(i=0; i<count(aViewType); i++){
if( fossil_strcmp(zView, aViewType[i].zVal)==0 ){
eType = aViewType[i].eType;
break;
}
}
if( eType!=RPT_NONE ){
int nView = 0; /* Slots used in azView[] */
for(i=0; i<count(aViewType); i++){
azView[nView++] = aViewType[i].zVal;
azView[nView++] = aViewType[i].zName;
}
if( eType!=RPT_BYFILE ){
style_submenu_multichoice("type", count(azType)/2, azType, 0);
}
style_submenu_multichoice("view", nView/2, azView, 0);
if( eType!=RPT_BYUSER ){
style_submenu_sql("user","User:",
"SELECT '', 'All Users' UNION ALL "
"SELECT x, x FROM ("
" SELECT DISTINCT trim(coalesce(euser,user)) AS x FROM event %s"
|
| ︙ | ︙ |
Changes to src/style.c.
| ︙ | ︙ | |||
231 232 233 234 235 236 237 |
*/
void style_submenu_element(
const char *zLabel,
const char *zLink,
...
){
va_list ap;
| | | | | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
*/
void style_submenu_element(
const char *zLabel,
const char *zLink,
...
){
va_list ap;
assert( nSubmenu < count(aSubmenu) );
aSubmenu[nSubmenu].zLabel = zLabel;
va_start(ap, zLink);
aSubmenu[nSubmenu].zLink = vmprintf(zLink, ap);
va_end(ap);
nSubmenu++;
}
void style_submenu_entry(
const char *zName, /* Query parameter name */
const char *zLabel, /* Label before the entry box */
int iSize, /* Size of the entry box */
int isDisabled /* True if disabled */
){
assert( nSubmenuCtrl < count(aSubmenuCtrl) );
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
aSubmenuCtrl[nSubmenuCtrl].iSize = iSize;
aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
aSubmenuCtrl[nSubmenuCtrl].eType = FF_ENTRY;
nSubmenuCtrl++;
}
void style_submenu_binary(
const char *zName, /* Query parameter name */
const char *zTrue, /* Label to show when parameter is true */
const char *zFalse, /* Label to show when the parameter is false */
int isDisabled /* True if this control is disabled */
){
assert( nSubmenuCtrl < count(aSubmenuCtrl) );
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
aSubmenuCtrl[nSubmenuCtrl].zLabel = zTrue;
aSubmenuCtrl[nSubmenuCtrl].zFalse = zFalse;
aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
aSubmenuCtrl[nSubmenuCtrl].eType = FF_BINARY;
nSubmenuCtrl++;
}
void style_submenu_multichoice(
const char *zName, /* Query parameter name */
int nChoice, /* Number of options */
const char *const *azChoice,/* value/display pairs. 2*nChoice entries */
int isDisabled /* True if this control is disabled */
){
assert( nSubmenuCtrl < count(aSubmenuCtrl) );
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
aSubmenuCtrl[nSubmenuCtrl].iSize = nChoice;
aSubmenuCtrl[nSubmenuCtrl].azChoice = azChoice;
aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
aSubmenuCtrl[nSubmenuCtrl].eType = FF_MULTI;
nSubmenuCtrl++;
}
|
| ︙ | ︙ |
Changes to src/th_main.c.
| ︙ | ︙ | |||
2003 2004 2005 2006 2007 2008 2009 |
db_get_boolean("tcl", 0) ){
if( !g.tcl.setup ){
g.tcl.setup = db_get("tcl-setup", 0); /* Grab Tcl setup script. */
}
th_register_tcl(g.interp, &g.tcl); /* Tcl integration commands. */
}
#endif
| | | 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 |
db_get_boolean("tcl", 0) ){
if( !g.tcl.setup ){
g.tcl.setup = db_get("tcl-setup", 0); /* Grab Tcl setup script. */
}
th_register_tcl(g.interp, &g.tcl); /* Tcl integration commands. */
}
#endif
for(i=0; i<count(aCommand); i++){
if ( !aCommand[i].zName || !aCommand[i].xProc ) continue;
Th_CreateCommand(g.interp, aCommand[i].zName, aCommand[i].xProc,
aCommand[i].pContext, 0);
}
}else{
wasInit = 1;
}
|
| ︙ | ︙ |
Changes to src/th_tcl.c.
| ︙ | ︙ | |||
831 832 833 834 835 836 837 |
Tcl_Interp *interp
){
int i;
Th_Interp *th1Interp = (Th_Interp *)clientData;
if( !th1Interp ) return;
/* Remove the Tcl integration commands. */
| | | 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 |
Tcl_Interp *interp
){
int i;
Th_Interp *th1Interp = (Th_Interp *)clientData;
if( !th1Interp ) return;
/* Remove the Tcl integration commands. */
for(i=0; i<count(aCommand); i++){
Th_RenameCommand(th1Interp, aCommand[i].zName, -1, NULL, 0);
}
}
/*
** When Tcl stubs support is enabled, attempts to dynamically load the Tcl
** shared library and fetch the function pointers necessary to create an
|
| ︙ | ︙ | |||
1259 1260 1261 1262 1263 1264 1265 |
int th_register_tcl(
Th_Interp *interp,
void *pContext
){
int i;
/* Add the Tcl integration commands to TH1. */
| | | 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 |
int th_register_tcl(
Th_Interp *interp,
void *pContext
){
int i;
/* Add the Tcl integration commands to TH1. */
for(i=0; i<count(aCommand); i++){
void *ctx;
if( !aCommand[i].zName || !aCommand[i].xProc ) continue;
ctx = aCommand[i].pContext;
/* Use Tcl interpreter for context? */
if( !ctx ) ctx = pContext;
Th_CreateCommand(interp, aCommand[i].zName, aCommand[i].xProc, ctx, 0);
}
return TH_OK;
}
#endif /* FOSSIL_ENABLE_TCL */
|
Changes to src/timeline.c.
| ︙ | ︙ | |||
388 389 390 391 392 393 394 |
static Stmt qparent;
db_static_prepare(&qparent,
"SELECT pid FROM plink"
" WHERE cid=:rid AND pid NOT IN phantom"
" ORDER BY isprim DESC /*sort*/"
);
db_bind_int(&qparent, ":rid", rid);
| | | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
static Stmt qparent;
db_static_prepare(&qparent,
"SELECT pid FROM plink"
" WHERE cid=:rid AND pid NOT IN phantom"
" ORDER BY isprim DESC /*sort*/"
);
db_bind_int(&qparent, ":rid", rid);
while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){
aParent[nParent++] = db_column_int(&qparent, 0);
}
db_reset(&qparent);
gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr,
zUuid, isLeaf);
db_reset(&qbranch);
@ <div id="m%d(gidx)" class="tl-nodemark"></div>
|
| ︙ | ︙ | |||
1184 1185 1186 1187 1188 1189 1190 |
az[i++] = "t";
az[i++] = "Tickets";
}
if( g.perm.RdWiki ){
az[i++] = "w";
az[i++] = "Wiki";
}
| | | 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 |
az[i++] = "t";
az[i++] = "Tickets";
}
if( g.perm.RdWiki ){
az[i++] = "w";
az[i++] = "Wiki";
}
assert( i<=count(az) );
}
if( i>2 ){
style_submenu_multichoice("y", i/2, az, isDisabled);
}
}
/*
|
| ︙ | ︙ |
Changes to src/unicode.c.
| ︙ | ︙ | |||
142 143 144 145 146 147 148 |
};
if( (unsigned int)c<128 ){
return ( (aAscii[c >> 5] & (1 << (c & 0x001F)))==0 );
}else if( (unsigned int)c<(1<<22) ){
unsigned int key = (((unsigned int)c)<<10) | 0x000003FF;
int iRes = 0;
| | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
};
if( (unsigned int)c<128 ){
return ( (aAscii[c >> 5] & (1 << (c & 0x001F)))==0 );
}else if( (unsigned int)c<(1<<22) ){
unsigned int key = (((unsigned int)c)<<10) | 0x000003FF;
int iRes = 0;
int iHi = count(aEntry) - 1;
int iLo = 0;
while( iHi>=iLo ){
int iTest = (iHi + iLo) / 2;
if( key >= aEntry[iTest] ){
iRes = iTest;
iLo = iTest+1;
}else{
|
| ︙ | ︙ | |||
199 200 201 202 203 204 205 |
'h', 'i', 'k', 'l', 'l', 'm', 'n', 'p', 'r', 'r', 's', 't',
'u', 'v', 'w', 'w', 'x', 'y', 'z', 'h', 't', 'w', 'y', 'a',
'e', 'i', 'o', 'u', 'y',
};
unsigned int key = (((unsigned int)c)<<3) | 0x00000007;
int iRes = 0;
| | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
'h', 'i', 'k', 'l', 'l', 'm', 'n', 'p', 'r', 'r', 's', 't',
'u', 'v', 'w', 'w', 'x', 'y', 'z', 'h', 't', 'w', 'y', 'a',
'e', 'i', 'o', 'u', 'y',
};
unsigned int key = (((unsigned int)c)<<3) | 0x00000007;
int iRes = 0;
int iHi = count(aDia) - 1;
int iLo = 0;
while( iHi>=iLo ){
int iTest = (iHi + iLo) / 2;
if( key >= aDia[iTest] ){
iRes = iTest;
iLo = iTest+1;
}else{
|
| ︙ | ︙ | |||
346 347 348 349 350 351 352 |
assert( sizeof(unsigned short)==2 && sizeof(unsigned char)==1 );
if( c<128 ){
if( c>='A' && c<='Z' ) ret = c + ('a' - 'A');
}else if( c<65536 ){
const struct TableEntry *p;
| | | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
assert( sizeof(unsigned short)==2 && sizeof(unsigned char)==1 );
if( c<128 ){
if( c>='A' && c<='Z' ) ret = c + ('a' - 'A');
}else if( c<65536 ){
const struct TableEntry *p;
int iHi = count(aEntry) - 1;
int iLo = 0;
int iRes = -1;
assert( c>aEntry[0].iCode );
while( iHi>=iLo ){
int iTest = (iHi + iLo) / 2;
int cmp = (c - aEntry[iTest].iCode);
|
| ︙ | ︙ |
Changes to src/vfile.c.
| ︙ | ︙ | |||
433 434 435 436 437 438 439 |
if( sqlite3_strglob("ci-comment-????????????.txt", zName)==0 ) return 1;
for(; zName[0]!=0; zName++){
if( zName[0]=='/' && sqlite3_strglob("/ci-comment-????????????.txt", zName)==0 ){
return 1;
}
if( zName[0]!='-' ) continue;
| | | 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
if( sqlite3_strglob("ci-comment-????????????.txt", zName)==0 ) return 1;
for(; zName[0]!=0; zName++){
if( zName[0]=='/' && sqlite3_strglob("/ci-comment-????????????.txt", zName)==0 ){
return 1;
}
if( zName[0]!='-' ) continue;
for(i=0; i<count(azTemp); i++){
n = (int)strlen(azTemp[i]);
if( memcmp(azTemp[i], zName+1, n) ) continue;
if( zName[n+1]==0 ) return 1;
if( zName[n+1]=='-' ){
for(j=n+2; zName[j] && fossil_isdigit(zName[j]); j++){}
if( zName[j]==0 ) return 1;
}
|
| ︙ | ︙ |
Changes to src/wiki.c.
| ︙ | ︙ | |||
136 137 138 139 140 141 142 |
/*
** Only allow certain mimetypes through.
** All others become "text/x-fossil-wiki"
*/
const char *wiki_filter_mimetypes(const char *zMimetype){
if( zMimetype!=0 ){
int i;
| | | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
/*
** Only allow certain mimetypes through.
** All others become "text/x-fossil-wiki"
*/
const char *wiki_filter_mimetypes(const char *zMimetype){
if( zMimetype!=0 ){
int i;
for(i=0; i<count(azStyles); i+=3){
if( fossil_strcmp(zMimetype,azStyles[i+2])==0 ){
return azStyles[i];
}
}
if( fossil_strcmp(zMimetype, "text/x-markdown")==0
|| fossil_strcmp(zMimetype, "text/plain")==0 ){
return zMimetype;
|
| ︙ | ︙ | |||
426 427 428 429 430 431 432 |
/*
** Output a selection box from which the user can select the
** wiki mimetype.
*/
void mimetype_option_menu(const char *zMimetype){
unsigned i;
@ <select name="mimetype" size="1">
| | | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
/*
** Output a selection box from which the user can select the
** wiki mimetype.
*/
void mimetype_option_menu(const char *zMimetype){
unsigned i;
@ <select name="mimetype" size="1">
for(i=0; i<count(azStyles); i+=3){
if( fossil_strcmp(zMimetype,azStyles[i])==0 ){
@ <option value="%s(azStyles[i])" selected>%s(azStyles[i+1])</option>
}else{
@ <option value="%s(azStyles[i])">%s(azStyles[i+1])</option>
}
}
@ </select>
|
| ︙ | ︙ |
Changes to src/wikiformat.c.
| ︙ | ︙ | |||
143 144 145 146 147 148 149 |
/*
** Use binary search to locate a tag in the aAttribute[] table.
*/
static int findAttr(const char *z){
int i, c, first, last;
first = 1;
| | | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
/*
** Use binary search to locate a tag in the aAttribute[] table.
*/
static int findAttr(const char *z){
int i, c, first, last;
first = 1;
last = count(aAttribute) - 1;
while( first<=last ){
i = (first+last)/2;
c = fossil_strcmp(aAttribute[i].zName, z);
if( c==0 ){
return i;
}else if( c<0 ){
first = i+1;
|
| ︙ | ︙ | |||
370 371 372 373 374 375 376 |
{ "var", MARKUP_VAR, MUTYPE_FONT, AMSK_STYLE },
{ "verbatim", MARKUP_VERBATIM, MUTYPE_SPECIAL,
AMSK_ID|AMSK_TYPE },
};
void show_allowed_wiki_markup( void ){
int i; /* loop over allowedAttr */
| | | | 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
{ "var", MARKUP_VAR, MUTYPE_FONT, AMSK_STYLE },
{ "verbatim", MARKUP_VERBATIM, MUTYPE_SPECIAL,
AMSK_ID|AMSK_TYPE },
};
void show_allowed_wiki_markup( void ){
int i; /* loop over allowedAttr */
for( i=1 ; i<=count(aMarkup) - 1 ; i++ ){
@ <%s(aMarkup[i].zName)>
}
}
/*
** Use binary search to locate a tag in the aMarkup[] table.
*/
static int findTag(const char *z){
int i, c, first, last;
first = 1;
last = count(aMarkup) - 1;
while( first<=last ){
i = (first+last)/2;
c = fossil_strcmp(aMarkup[i].zName, z);
if( c==0 ){
assert( aMarkup[i].iCode==i );
return i;
}else if( c<0 ){
|
| ︙ | ︙ | |||
2185 2186 2187 2188 2189 2190 2191 |
static const struct { int n; char c; char *z; } aEntity[] = {
{ 5, '&', "&" },
{ 4, '<', "<" },
{ 4, '>', ">" },
{ 6, ' ', " " },
};
int jj;
| | | 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 |
static const struct { int n; char c; char *z; } aEntity[] = {
{ 5, '&', "&" },
{ 4, '<', "<" },
{ 4, '>', ">" },
{ 6, ' ', " " },
};
int jj;
for(jj=0; jj<count(aEntity); jj++){
if( aEntity[jj].n==n && strncmp(aEntity[jj].z,zIn,n)==0 ){
c = aEntity[jj].c;
break;
}
}
}
if( fossil_isspace(c) ){
|
| ︙ | ︙ |