Ticket #3990: t3990_allow_empty_strings_in_config_v1.patch
File t3990_allow_empty_strings_in_config_v1.patch, 1.7 KB (added by , 8 years ago) |
---|
-
source/ps/ConfigDB.cpp
bool CConfigDB::Reload(EConfigNamespace 334 334 case '\r': 335 335 case '\t': 336 336 break; // ignore 337 337 338 338 case ',': 339 if (!value.empty()) 340 values.push_back(value); 339 values.push_back(value); 341 340 value.clear(); 342 341 break; 343 342 344 343 default: 345 344 value.push_back(*pos); 346 345 break; 347 346 } 348 347 } 349 348 if (quoted) // We ignore the invalid parameter 350 349 LOGERROR("Unmatched quote while parsing config file '%s' on line %d", m_ConfigFile[ns].string8(), line); 351 else if (!value.empty()) 352 350 351 values.push_back(value); 353 352 value.clear(); 354 353 quoted = false; 355 354 break; // We are either at the end of the line, or we still have a comment to parse 356 355 357 356 default: … … bool CConfigDB::Reload(EConfigNamespace 361 360 362 361 // Consume the rest of the line 363 362 while (pos < filebufend && *pos != '\n') 364 363 ++pos; 365 364 // Store the setting 366 if (!name.empty() && !values.empty())365 if (!name.empty()) 367 366 { 368 367 CStr key(header + name); 369 368 newMap[key] = values; 370 369 if (key == "lobby.password") 371 370 LOGMESSAGE("Loaded config string \"%s\"", key); … … bool CConfigDB::Reload(EConfigNamespace 376 375 vals += "\"" + EscapeString(newMap[key][i]) + "\", "; 377 376 vals += "\"" + EscapeString(newMap[key][values.size()-1]) + "\""; 378 377 LOGMESSAGE("Loaded config string \"%s\" = %s", key, vals); 379 378 } 380 379 } 381 else if (!name.empty())382 LOGERROR("Encountered config setting '%s' without value while parsing '%s' on line %d", name, m_ConfigFile[ns].string8(), line);383 380 384 381 name.clear(); 385 382 values.clear(); 386 383 ++line; 387 384 }