mirror of
https://github.com/fmang/opustags.git
synced 2024-11-10 07:27:22 +01:00
fix ot::read_comments when handling empty lines
This commit is contained in:
parent
26411d3843
commit
bfa46273b9
@ -159,7 +159,7 @@ std::list<std::string> ot::read_comments(FILE* input)
|
||||
{
|
||||
std::list<std::string> comments;
|
||||
auto raw_tags = std::make_unique<char[]>(16383);
|
||||
size_t raw_len = fread(raw_tags.get(), 1, 16382, stdin);
|
||||
size_t raw_len = fread(raw_tags.get(), 1, 16382, input);
|
||||
if (raw_len == 16382)
|
||||
fputs("warning: truncating comment to 16 KiB\n", stderr);
|
||||
raw_tags[raw_len] = '\0';
|
||||
@ -169,8 +169,10 @@ std::list<std::string> ot::read_comments(FILE* input)
|
||||
for (size_t i = 0; i <= raw_len; ++i) {
|
||||
if (raw_tags[i] == '\n' || raw_tags[i] == '\0') {
|
||||
raw_tags[i] = '\0';
|
||||
if (field_len == 0)
|
||||
if (field_len == 0) {
|
||||
cursor = raw_tags.get() + i + 1;
|
||||
continue;
|
||||
}
|
||||
if (caught_eq)
|
||||
comments.emplace_back(cursor);
|
||||
else
|
||||
|
@ -152,6 +152,7 @@ EOF
|
||||
is_deeply(opustags(qw(out.opus --set-all -a A=B -s X=Z -d OK), {in => <<'END_IN'}), [<<'END_OUT', '', 0], 'set all');
|
||||
OK=yes again
|
||||
ARTIST=七面鳥
|
||||
|
||||
A=A
|
||||
X=Y
|
||||
END_IN
|
||||
|
Loading…
Reference in New Issue
Block a user