mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
Core: LoadFile fixed
This commit is contained in:
parent
3fdd8be072
commit
9b1472ba70
2 changed files with 7 additions and 1 deletions
|
|
@ -8,4 +8,10 @@ CONSOLE_APP_MAIN
|
|||
Cout() << s;
|
||||
ASSERT(s.GetCount() > 0);
|
||||
ASSERT(LoadFile("/proc/this_file_does_not_exist").IsVoid());
|
||||
String path = GetHomeDirFile("empty_file");
|
||||
SaveFile(path, String());
|
||||
s = LoadFile(path);
|
||||
DDUMP(s.GetCount());
|
||||
ASSERT(!s.IsVoid() && s.GetCount() == 0);
|
||||
DeleteFile(path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1227,7 +1227,7 @@ String LoadFile(const char *filename) {
|
|||
s.SetCount(n + CHUNK);
|
||||
int len = read(fd, ~s + n, CHUNK);
|
||||
if(len != CHUNK) {
|
||||
if(len > 0)
|
||||
if(len >= 0)
|
||||
s.SetCount(n + len);
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue