config/Param: make "line" signed

This commit is contained in:
Max Kellermann 2015-01-21 22:19:36 +01:00
parent fdba76ba47
commit a38f02541d
3 changed files with 7 additions and 7 deletions

View File

@ -72,14 +72,14 @@ open_log_file(void)
} }
static bool static bool
log_init_file(unsigned line, Error &error) log_init_file(int line, Error &error)
{ {
assert(!out_path.IsNull()); assert(!out_path.IsNull());
out_fd = open_log_file(); out_fd = open_log_file();
if (out_fd < 0) { if (out_fd < 0) {
const std::string out_path_utf8 = out_path.ToUTF8(); const std::string out_path_utf8 = out_path.ToUTF8();
error.FormatErrno("failed to open log file \"%s\" (config line %u)", error.FormatErrno("failed to open log file \"%s\" (config line %d)",
out_path_utf8.c_str(), line); out_path_utf8.c_str(), line);
return false; return false;
} }
@ -89,7 +89,7 @@ log_init_file(unsigned line, Error &error)
} }
static inline LogLevel static inline LogLevel
parse_log_level(const char *value, unsigned line) parse_log_level(const char *value, int line)
{ {
if (0 == strcmp(value, "default")) if (0 == strcmp(value, "default"))
return LogLevel::DEFAULT; return LogLevel::DEFAULT;
@ -98,7 +98,7 @@ parse_log_level(const char *value, unsigned line)
else if (0 == strcmp(value, "verbose")) else if (0 == strcmp(value, "verbose"))
return LogLevel::DEBUG; return LogLevel::DEBUG;
else { else {
FormatFatalError("unknown log level \"%s\" at line %u", FormatFatalError("unknown log level \"%s\" at line %d",
value, line); value, line);
} }
} }

View File

@ -38,7 +38,7 @@ struct config_param {
std::string value; std::string value;
unsigned int line; int line;
std::vector<BlockParam> block_params; std::vector<BlockParam> block_params;
@ -66,7 +66,7 @@ struct config_param {
* configuration file. * configuration file.
*/ */
bool IsNull() const { bool IsNull() const {
return line == unsigned(-1); return line < 0;
} }
gcc_nonnull_all gcc_nonnull_all

View File

@ -97,7 +97,7 @@ require_block_string(const config_param &param, const char *name)
const char *value = param.GetBlockValue(name); const char *value = param.GetBlockValue(name);
if (value == nullptr) if (value == nullptr)
FormatFatalError("no \"%s\" defined for shout device defined " FormatFatalError("no \"%s\" defined for shout device defined "
"at line %u\n", name, param.line); "at line %d\n", name, param.line);
return value; return value;
} }