Fossil SCM
Fix the mkbuiltin.c code generator so that it tolerates Windows-style backslash path separators on its arguments. This fixes the windows build that was busted by check-in [774bdc83556442c5].
Commit
030bf2002f64c3f30c4c49afab99fa221dda4d06b301bd467f32b24283d54844
Parent
74c908e709776cd…
1 file changed
+7
-3
+7
-3
| --- src/mkbuiltin.c | ||
| +++ src/mkbuiltin.c | ||
| @@ -60,11 +60,11 @@ | ||
| 60 | 60 | /* |
| 61 | 61 | ** There is an instance of the following for each file translated. |
| 62 | 62 | */ |
| 63 | 63 | typedef struct Resource Resource; |
| 64 | 64 | struct Resource { |
| 65 | - const char *zName; | |
| 65 | + char *zName; | |
| 66 | 66 | int nByte; |
| 67 | 67 | int idx; |
| 68 | 68 | }; |
| 69 | 69 | |
| 70 | 70 | /* |
| @@ -147,18 +147,22 @@ | ||
| 147 | 147 | printf(" const unsigned char *pData;\n"); |
| 148 | 148 | printf(" int nByte;\n"); |
| 149 | 149 | printf("};\n"); |
| 150 | 150 | printf("static const BuiltinFileTable aBuiltinFiles[] = {\n"); |
| 151 | 151 | for(i=0; i<nRes; i++){ |
| 152 | - const char *z = aRes[i].zName; | |
| 152 | + char *z = aRes[i].zName; | |
| 153 | 153 | if( strlen(z)>=nPrefix ) z += nPrefix; |
| 154 | - while( z[0]=='.' || z[0]=='/' ){ z++; } | |
| 154 | + while( z[0]=='.' || z[0]=='/' || z[0]=='\\' ){ z++; } | |
| 155 | 155 | aRes[i].zName = z; |
| 156 | + while( z[0] ){ | |
| 157 | + if( z[0]=='\\' ) z[0] = '/'; | |
| 158 | + z++; | |
| 159 | + } | |
| 156 | 160 | } |
| 157 | 161 | qsort(aRes, nRes, sizeof(aRes[0]), compareResource); |
| 158 | 162 | for(i=0; i<nRes; i++){ |
| 159 | 163 | printf(" { \"%s\", bidata%d, %d },\n", |
| 160 | 164 | aRes[i].zName, aRes[i].idx, aRes[i].nByte); |
| 161 | 165 | } |
| 162 | 166 | printf("};\n"); |
| 163 | 167 | return nErr; |
| 164 | 168 | } |
| 165 | 169 |
| --- src/mkbuiltin.c | |
| +++ src/mkbuiltin.c | |
| @@ -60,11 +60,11 @@ | |
| 60 | /* |
| 61 | ** There is an instance of the following for each file translated. |
| 62 | */ |
| 63 | typedef struct Resource Resource; |
| 64 | struct Resource { |
| 65 | const char *zName; |
| 66 | int nByte; |
| 67 | int idx; |
| 68 | }; |
| 69 | |
| 70 | /* |
| @@ -147,18 +147,22 @@ | |
| 147 | printf(" const unsigned char *pData;\n"); |
| 148 | printf(" int nByte;\n"); |
| 149 | printf("};\n"); |
| 150 | printf("static const BuiltinFileTable aBuiltinFiles[] = {\n"); |
| 151 | for(i=0; i<nRes; i++){ |
| 152 | const char *z = aRes[i].zName; |
| 153 | if( strlen(z)>=nPrefix ) z += nPrefix; |
| 154 | while( z[0]=='.' || z[0]=='/' ){ z++; } |
| 155 | aRes[i].zName = z; |
| 156 | } |
| 157 | qsort(aRes, nRes, sizeof(aRes[0]), compareResource); |
| 158 | for(i=0; i<nRes; i++){ |
| 159 | printf(" { \"%s\", bidata%d, %d },\n", |
| 160 | aRes[i].zName, aRes[i].idx, aRes[i].nByte); |
| 161 | } |
| 162 | printf("};\n"); |
| 163 | return nErr; |
| 164 | } |
| 165 |
| --- src/mkbuiltin.c | |
| +++ src/mkbuiltin.c | |
| @@ -60,11 +60,11 @@ | |
| 60 | /* |
| 61 | ** There is an instance of the following for each file translated. |
| 62 | */ |
| 63 | typedef struct Resource Resource; |
| 64 | struct Resource { |
| 65 | char *zName; |
| 66 | int nByte; |
| 67 | int idx; |
| 68 | }; |
| 69 | |
| 70 | /* |
| @@ -147,18 +147,22 @@ | |
| 147 | printf(" const unsigned char *pData;\n"); |
| 148 | printf(" int nByte;\n"); |
| 149 | printf("};\n"); |
| 150 | printf("static const BuiltinFileTable aBuiltinFiles[] = {\n"); |
| 151 | for(i=0; i<nRes; i++){ |
| 152 | char *z = aRes[i].zName; |
| 153 | if( strlen(z)>=nPrefix ) z += nPrefix; |
| 154 | while( z[0]=='.' || z[0]=='/' || z[0]=='\\' ){ z++; } |
| 155 | aRes[i].zName = z; |
| 156 | while( z[0] ){ |
| 157 | if( z[0]=='\\' ) z[0] = '/'; |
| 158 | z++; |
| 159 | } |
| 160 | } |
| 161 | qsort(aRes, nRes, sizeof(aRes[0]), compareResource); |
| 162 | for(i=0; i<nRes; i++){ |
| 163 | printf(" { \"%s\", bidata%d, %d },\n", |
| 164 | aRes[i].zName, aRes[i].idx, aRes[i].nByte); |
| 165 | } |
| 166 | printf("};\n"); |
| 167 | return nErr; |
| 168 | } |
| 169 |