Browse Source

Bug fix

release/0.19
JustinAJ 10 years ago
parent
commit
70a98b1b9c
  1. 27
      Jupiter/File.cpp

27
Jupiter/File.cpp

@ -132,22 +132,22 @@ bool Jupiter::File::load(const Jupiter::ReadableString &file)
bool Jupiter::File::load(FILE *file) bool Jupiter::File::load(FILE *file)
{ {
Jupiter::String buffer(defaultBufferSize); Jupiter::String buffer(defaultBufferSize);
int c; int c = fgetc(file);
for (;;) if (c == EOF)
return false;
if (containsSymbol(ENDL, static_cast<char>(c)))
{ {
Jupiter::File::data_->lines.add(new Jupiter::StringS(buffer));
c = fgetc(file); c = fgetc(file);
if (c == EOF) if (c == EOF)
return false; return true;
if (containsSymbol(ENDL, static_cast<char>(c))) if (containsSymbol(ENDL, static_cast<char>(c)) == false)
{
Jupiter::File::data_->lines.add(new Jupiter::StringS(buffer));
buffer.truncate(buffer.size());
break;
}
else
buffer.concat(static_cast<char>(c)); buffer.concat(static_cast<char>(c));
} }
else
buffer.concat(static_cast<char>(c));
for (;;) for (;;)
{ {
c = fgetc(file); c = fgetc(file);
@ -157,12 +157,17 @@ bool Jupiter::File::load(FILE *file)
{ {
Jupiter::File::data_->lines.add(new Jupiter::StringS(buffer)); Jupiter::File::data_->lines.add(new Jupiter::StringS(buffer));
buffer.truncate(buffer.size()); buffer.truncate(buffer.size());
c = fgetc(file);
if (c == EOF)
return true;
if (containsSymbol(ENDL, static_cast<char>(c)) == false)
buffer.concat(static_cast<char>(c));
} }
else else
buffer.concat(static_cast<char>(c)); buffer.concat(static_cast<char>(c));
} }
return false; return true;
} }
void Jupiter::File::unload() void Jupiter::File::unload()

Loading…
Cancel
Save