Changeset 69432 in vbox for trunk/src/bldprogs
- Timestamp:
- Oct 27, 2017 1:32:38 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bldprogs/scm.cpp
r69425 r69432 542 542 SCM_CFG_ENTRY(g_aRewritersFor_Makefile_kup, false, "Makefile.kup" ), 543 543 SCM_CFG_ENTRY(g_aRewritersFor_Makefile_kmk, false, "*.kmk" ), 544 SCM_CFG_ENTRY(g_aRewritersFor_OtherMakefiles, false, "Makefile" ),545 544 SCM_CFG_ENTRY(g_aRewritersFor_C_and_CPP, false, "*.c|*.cpp|*.C|*.CPP|*.cxx|*.cc|*.m|*.mm" ), 546 545 SCM_CFG_ENTRY(g_aRewritersFor_H_and_HPP, false, "*.h|*.hpp" ), … … 569 568 SCM_CFG_ENTRY(g_aRewritersFor_QtUiFiles, false, "*.ui" ), 570 569 SCM_CFG_ENTRY(g_aRewritersFor_SifFiles, false, "*.sif" ), 570 /* Should be last. */ 571 SCM_CFG_ENTRY(g_aRewritersFor_OtherMakefiles, false, "Makefile|makefile|GNUmakefile|SMakefile" ), 571 572 /* Must be be last: */ 572 573 SCM_CFG_ENTRY(g_aRewritersFor_FileLists, false, "files_*" ), … … 1232 1233 continue; 1233 1234 1235 /* Deal with escaped newlines. */ 1236 size_t iFirstLine = ~(size_t)0; 1237 char *pszFreeLine = NULL; 1238 if ( pchLine[cchLine - 1] == '\\' 1239 && ( cchLine < 2 1240 || pchLine[cchLine - 2] != '\\') ) 1241 { 1242 iFirstLine = ScmStreamTellLine(&Stream); 1243 1244 cchLine--; 1245 while (cchLine > 0 && RT_C_IS_SPACE(pchLine[cchLine - 1])) 1246 cchLine--; 1247 1248 size_t cchTotal = cchLine; 1249 pszFreeLine = RTStrDupN(pchLine, cchLine); 1250 if (pszFreeLine) 1251 { 1252 /* Append following lines. */ 1253 while ((pchLine = ScmStreamGetLine(&Stream, &cchLine, &enmEol)) != NULL) 1254 { 1255 while (cchLine > 0 && RT_C_IS_SPACE(*pchLine)) 1256 pchLine++, cchLine--; 1257 1258 bool const fDone = cchLine == 0 1259 || pchLine[cchLine - 1] != '\\' 1260 || (cchLine >= 2 && pchLine[cchLine - 2] == '\\'); 1261 if (!fDone) 1262 { 1263 cchLine--; 1264 while (cchLine > 0 && RT_C_IS_SPACE(pchLine[cchLine - 1])) 1265 cchLine--; 1266 } 1267 1268 rc = RTStrRealloc(&pszFreeLine, cchTotal + 1 + cchLine + 1); 1269 if (RT_FAILURE(rc)) 1270 break; 1271 pszFreeLine[cchTotal++] = ' '; 1272 memcpy(&pszFreeLine[cchTotal], pchLine, cchLine); 1273 cchTotal += cchLine; 1274 pszFreeLine[cchTotal] = '\0'; 1275 1276 if (fDone) 1277 break; 1278 } 1279 } 1280 else 1281 rc = VERR_NO_STR_MEMORY; 1282 1283 if (RT_FAILURE(rc)) 1284 { 1285 RTStrFree(pszFreeLine); 1286 rc = RTMsgErrorRc(VERR_NO_MEMORY, "%s: Ran out of memory deal with escaped newlines"); 1287 break; 1288 } 1289 1290 pchLine = pszFreeLine; 1291 cchLine = cchTotal; 1292 } 1293 1234 1294 /* What kind of line is it? */ 1235 1295 const char *pchColon = (const char *)memchr(pchLine, ':', cchLine); … … 1238 1298 else 1239 1299 rc = scmSettingsBaseParseStringN(&pSettings->Base, pchLine, cchLine, szAbsPath, cchDir); 1300 if (pszFreeLine) 1301 RTStrFree(pszFreeLine); 1240 1302 if (RT_FAILURE(rc)) 1241 1303 { 1242 RTMsgError("%s:%d: %Rrc\n", pszFilename, ScmStreamTellLine(&Stream), rc); 1304 RTMsgError("%s:%d: %Rrc\n", 1305 pszFilename, iFirstLine == ~(size_t)0 ? ScmStreamTellLine(&Stream) : iFirstLine, rc); 1243 1306 break; 1244 1307 }
Note:
See TracChangeset
for help on using the changeset viewer.