mirror of https://github.com/odrling/Aegisub
Use agi::line_iterator for loading keyframe files
line_iterator supports Windows newlines on non-Windows platforms, unlike istream_iterator.
This commit is contained in:
parent
1b96bf748f
commit
0638af6825
|
@ -37,15 +37,15 @@ std::vector<int> agi_keyframes(std::istream &file) {
|
||||||
file >> fps_str;
|
file >> fps_str;
|
||||||
file >> fps;
|
file >> fps;
|
||||||
|
|
||||||
return std::vector<int>(std::istream_iterator<int>(file), std::istream_iterator<int>());
|
return std::vector<int>(agi::line_iterator<int>(file), agi::line_iterator<int>());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> other_keyframes(std::istream &file, char (*func)(std::string const&)) {
|
std::vector<int> other_keyframes(std::istream &file, char (*func)(std::string const&)) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
std::vector<int> ret;
|
std::vector<int> ret;
|
||||||
agi::line_iterator<std::string> end;
|
agi::line_iterator<std::string> end;
|
||||||
for (agi::line_iterator<std::string> iter(file); iter != end; ++iter) {
|
for (auto line : agi::line_iterator<std::string>(file)) {
|
||||||
char c = tolower(func(*iter));
|
char c = tolower(func(line));
|
||||||
if (c == 'i')
|
if (c == 'i')
|
||||||
ret.push_back(count++);
|
ret.push_back(count++);
|
||||||
else if (c == 'p' || c == 'b')
|
else if (c == 'p' || c == 'b')
|
||||||
|
|
Loading…
Reference in New Issue