*: let libfmt quote strings

This commit is contained in:
Max Kellermann
2024-04-16 11:06:34 +02:00
parent 39c9e92f42
commit 0c1ecc96a8
71 changed files with 160 additions and 160 deletions

View File

@@ -12,7 +12,7 @@
void
BlockParam::ThrowWithNested() const
{
std::throw_with_nested(FmtRuntimeError("Error in setting \"{}\" on line {}",
std::throw_with_nested(FmtRuntimeError("Error in setting {:?} on line {}",
name, line));
}

View File

@@ -18,7 +18,7 @@ Check(const ConfigBlock &block)
for (const auto &i : block.block_params) {
if (!i.used)
FmtWarning(config_domain,
"option '{}' on line {} was not recognized",
"option {:?} on line {} was not recognized",
i.name, i.line);
}
}

View File

@@ -141,7 +141,7 @@ ConfigData::FindBlock(ConfigBlockOption option,
for (const auto &block : GetBlockList(option)) {
const char *value2 = block.GetBlockValue(key);
if (value2 == nullptr)
throw FmtRuntimeError("block without '{}' in line {}",
throw FmtRuntimeError("block without {:?} in line {}",
key, block.line);
if (StringIsEqual(value2, value))

View File

@@ -54,7 +54,7 @@ config_read_name_value(ConfigBlock &block, char *input, unsigned line)
const BlockParam *bp = block.GetBlockParam(name);
if (bp != nullptr)
throw FmtRuntimeError("\"{}\" is duplicate, first defined on line {}",
throw FmtRuntimeError("{:?} is duplicate, first defined on line {}",
name, bp->line);
block.AddBlockParam(name, value, line);
@@ -102,12 +102,12 @@ ReadConfigBlock(ConfigData &config_data, BufferedReader &reader,
if (option.deprecated)
FmtWarning(config_file_domain,
"config parameter \"{}\" on line {} is deprecated",
"config parameter {:?} on line {} is deprecated",
name, reader.GetLineNumber());
if (!option.repeatable)
if (const auto *block = config_data.GetBlock(o))
throw FmtRuntimeError("config parameter \"{}\" is first defined "
throw FmtRuntimeError("config parameter {:?} is first defined "
"on line {} and redefined on line {}",
name, block->line,
reader.GetLineNumber());
@@ -134,7 +134,7 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader,
if (option.deprecated)
FmtWarning(config_file_domain,
"config parameter \"{}\" on line {} is deprecated",
"config parameter {:?} on line {} is deprecated",
name, reader.GetLineNumber());
if (!option.repeatable)

View File

@@ -20,7 +20,7 @@ ParseBool(const char *value)
if (StringArrayContainsCase(f, value))
return false;
throw FmtRuntimeError(R"(Not a valid boolean ("yes" or "no"): "{}")", value);
throw FmtRuntimeError(R"(Not a valid boolean ("yes" or "no"): {:?})", value);
}
long

View File

@@ -22,7 +22,7 @@ GetBufferChunks(const ConfigData &config)
buffer_size = param->With([](const char *s){
size_t result = ParseSize(s, KILOBYTE);
if (result <= 0)
throw FmtRuntimeError("buffer size \"{}\" is not a "
throw FmtRuntimeError("buffer size {:?} is not a "
"positive integer", s);
if (result < MIN_BUFFER_SIZE) {
@@ -37,7 +37,7 @@ GetBufferChunks(const ConfigData &config)
unsigned buffer_chunks = buffer_size / CHUNK_SIZE;
if (buffer_chunks >= 1 << 15)
throw FmtRuntimeError("buffer size \"{}\" is too big",
throw FmtRuntimeError("buffer size {:?} is too big",
buffer_size);
return buffer_chunks;