54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
** Return a pointer to built-in content
**
** If the filename contains "-vNNNNNNNN" just before the final file
** suffix, where each N is a random digit, then omit that part of the
** filename before doing the lookup. The extra -vNNNNNNNN was added
** to defeat overly aggressive caching by web browsers.
*/
const unsigned char *builtin_file(const char *zFilename, int *piSize){
int i = builtin_file_index(zFilename);
if( i>=0 ){
if( piSize ) *piSize = aBuiltinFiles[i].nByte;
return aBuiltinFiles[i].pData;
}else{
char *zV = strstr(zFilename, "-v");
if( zV!=0 ){
for(i=0; i<8 && fossil_isdigit(zV[i+2]); i++){}
if( i==8 && zV[10]=='.' ){
char *zNew = mprintf("%.*s%s", (int)(zV-zFilename), zFilename, zV+10);
const unsigned char *pRes = builtin_file(zNew, piSize);
fossil_free(zNew);
return pRes;
}
}
if( piSize ) *piSize = 0;
return 0;
|
|
>
|
|
|
|
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/*
** Return a pointer to built-in content
**
** If the filename contains "-vNNNNNNNN" just before the final file
** suffix, where each N is a random digit, then omit that part of the
** filename before doing the lookup. The extra -vNNNNNNNN was added
** to defeat overly aggressive caching by web browsers. There must be
** at least 8 digits in NNNNNNNN but more than 8 are allowed.
*/
const unsigned char *builtin_file(const char *zFilename, int *piSize){
int i = builtin_file_index(zFilename);
if( i>=0 ){
if( piSize ) *piSize = aBuiltinFiles[i].nByte;
return aBuiltinFiles[i].pData;
}else{
char *zV = strstr(zFilename, "-v");
if( zV!=0 ){
for(i=0; fossil_isdigit(zV[i+2]); i++){}
if( i>=8 && zV[i+2]=='.' ){
char *zNew = mprintf("%.*s%s", (int)(zV-zFilename), zFilename, zV+i+2);
const unsigned char *pRes = builtin_file(zNew, piSize);
fossil_free(zNew);
return pRes;
}
}
if( piSize ) *piSize = 0;
return 0;
|