mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-07-04 16:42:14 +02:00
Merge 5eee257e50
into cae107557d
This commit is contained in:
commit
9ec75d29c5
@ -67,14 +67,6 @@ static char* find_chars_or_comment(const char* s, const char* chars)
|
|||||||
return (char*)s;
|
return (char*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
|
|
||||||
static char* strncpy0(char* dest, const char* src, size_t size)
|
|
||||||
{
|
|
||||||
strncpy(dest, src, size);
|
|
||||||
dest[size - 1] = '\0';
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See documentation in header file. */
|
/* See documentation in header file. */
|
||||||
int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
||||||
void* user)
|
void* user)
|
||||||
@ -164,7 +156,7 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
end = find_chars_or_comment(start + 1, "]");
|
end = find_chars_or_comment(start + 1, "]");
|
||||||
if (*end == ']') {
|
if (*end == ']') {
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
strncpy0(section, start + 1, sizeof(section));
|
strlcpy(section, start + 1, sizeof(section));
|
||||||
*prev_name = '\0';
|
*prev_name = '\0';
|
||||||
}
|
}
|
||||||
else if (!error) {
|
else if (!error) {
|
||||||
@ -188,7 +180,7 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
rstrip(value);
|
rstrip(value);
|
||||||
|
|
||||||
/* Valid name[=:]value pair found, call handler */
|
/* Valid name[=:]value pair found, call handler */
|
||||||
strncpy0(prev_name, name, sizeof(prev_name));
|
strlcpy(prev_name, name, sizeof(prev_name));
|
||||||
if (!HANDLER(user, section, name, value) && !error)
|
if (!HANDLER(user, section, name, value) && !error)
|
||||||
error = lineno;
|
error = lineno;
|
||||||
}
|
}
|
||||||
|
@ -67,14 +67,6 @@ static char* find_chars_or_comment(const char* s, const char* chars)
|
|||||||
return (char*)s;
|
return (char*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
|
|
||||||
static char* strncpy0(char* dest, const char* src, size_t size)
|
|
||||||
{
|
|
||||||
strncpy(dest, src, size);
|
|
||||||
dest[size - 1] = '\0';
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See documentation in header file. */
|
/* See documentation in header file. */
|
||||||
int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
||||||
void* user)
|
void* user)
|
||||||
@ -164,7 +156,7 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
end = find_chars_or_comment(start + 1, "]");
|
end = find_chars_or_comment(start + 1, "]");
|
||||||
if (*end == ']') {
|
if (*end == ']') {
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
strncpy0(section, start + 1, sizeof(section));
|
strlcpy(section, start + 1, sizeof(section));
|
||||||
*prev_name = '\0';
|
*prev_name = '\0';
|
||||||
}
|
}
|
||||||
else if (!error) {
|
else if (!error) {
|
||||||
@ -188,7 +180,7 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
rstrip(value);
|
rstrip(value);
|
||||||
|
|
||||||
/* Valid name[=:]value pair found, call handler */
|
/* Valid name[=:]value pair found, call handler */
|
||||||
strncpy0(prev_name, name, sizeof(prev_name));
|
strlcpy(prev_name, name, sizeof(prev_name));
|
||||||
if (!HANDLER(user, section, name, value) && !error)
|
if (!HANDLER(user, section, name, value) && !error)
|
||||||
error = lineno;
|
error = lineno;
|
||||||
}
|
}
|
||||||
|
@ -67,14 +67,6 @@ static char* find_chars_or_comment(const char* s, const char* chars)
|
|||||||
return (char*)s;
|
return (char*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
|
|
||||||
static char* strncpy0(char* dest, const char* src, size_t size)
|
|
||||||
{
|
|
||||||
strncpy(dest, src, size);
|
|
||||||
dest[size - 1] = '\0';
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See documentation in header file. */
|
/* See documentation in header file. */
|
||||||
int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
||||||
void* user)
|
void* user)
|
||||||
@ -164,7 +156,7 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
end = find_chars_or_comment(start + 1, "]");
|
end = find_chars_or_comment(start + 1, "]");
|
||||||
if (*end == ']') {
|
if (*end == ']') {
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
strncpy0(section, start + 1, sizeof(section));
|
strlcpy(section, start + 1, sizeof(section));
|
||||||
*prev_name = '\0';
|
*prev_name = '\0';
|
||||||
}
|
}
|
||||||
else if (!error) {
|
else if (!error) {
|
||||||
@ -188,7 +180,7 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
rstrip(value);
|
rstrip(value);
|
||||||
|
|
||||||
/* Valid name[=:]value pair found, call handler */
|
/* Valid name[=:]value pair found, call handler */
|
||||||
strncpy0(prev_name, name, sizeof(prev_name));
|
strlcpy(prev_name, name, sizeof(prev_name));
|
||||||
if (!HANDLER(user, section, name, value) && !error)
|
if (!HANDLER(user, section, name, value) && !error)
|
||||||
error = lineno;
|
error = lineno;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user