mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 02:02:24 +00:00
Enhancements
Add mutex lock to prevent reading and writing a cached file at the same time. Optimize codes.
This commit is contained in:
3 files changed
+10
-2
No files matched your search
+2
-1
@@ -711,10 +711,11 @@ std::string fileGet(const std::string &path, bool scope_limit)
|
||||
std::fseek(fp, 0, SEEK_END);
|
||||
long tot = std::ftell(fp);
|
||||
char *data = new char[tot + 1];
|
||||
data[tot] = '\0';
|
||||
std::rewind(fp);
|
||||
std::fread(&data[0], 1, tot, fp);
|
||||
std::fclose(fp);
|
||||
content.append(data, 0, tot);
|
||||
content.assign(data, tot);
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user