Browse Source

Making use of new print and println functions.

release/0.19
JustinAJ 11 years ago
parent
commit
053a491817
  1. 3
      Jupiter/File.cpp
  2. 12
      Jupiter/INIFile.cpp

3
Jupiter/File.cpp

@ -199,8 +199,7 @@ bool Jupiter::File::sync(FILE *file)
{ {
for (unsigned int i = 0; i < Jupiter::File::data_->lineCount; i++) for (unsigned int i = 0; i < Jupiter::File::data_->lineCount; i++)
{ {
fputs(Jupiter::File::data_->lines[i].c_str(), file); Jupiter::File::data_->lines[i].println(file);
fputs(ENDL, file);
} }
return true; return true;
} }

12
Jupiter/INIFile.cpp

@ -328,11 +328,7 @@ void Jupiter::INIFile::flushData()
// TODO: Rewrite this. // TODO: Rewrite this.
unsigned int Jupiter::INIFile::readFile(const char *fileName) unsigned int Jupiter::INIFile::readFile(const char *fileName)
{ {
int count = 0; unsigned int count = 0;
if (Jupiter::INIFile::data_->fName.size() != 0)
{
Jupiter::INIFile::data_->fName = "";
}
Jupiter::INIFile::data_->fName = fileName; Jupiter::INIFile::data_->fName = fileName;
FILE *file = fopen(Jupiter::INIFile::data_->fName.c_str(), "rb"); FILE *file = fopen(Jupiter::INIFile::data_->fName.c_str(), "rb");
if (file == nullptr) return Jupiter::ERROR_INDICATOR; if (file == nullptr) return Jupiter::ERROR_INDICATOR;
@ -394,16 +390,16 @@ bool Jupiter::INIFile::sync(const char *fileName)
{ {
section = Jupiter::INIFile::data_->data.get(a); section = Jupiter::INIFile::data_->data.get(a);
fputc('[', file); fputc('[', file);
fputs(section->getName().c_str(), file); section->getName().print(file);
fputs("]" ENDL, file); fputs("]" ENDL, file);
sectionSize = section->size(); sectionSize = section->size();
for (unsigned int b = 0; b < sectionSize; b++) for (unsigned int b = 0; b < sectionSize; b++)
{ {
pair = section->getPair(b); pair = section->getPair(b);
fputs(pair->getKey().c_str(), file); pair->getKey().print(file);
fputc('=', file); fputc('=', file);
fputs(pair->getValue().c_str(), file); pair->getValue().print(file);
fputs(ENDL, file); fputs(ENDL, file);
} }
fputs(ENDL, file); fputs(ENDL, file);

Loading…
Cancel
Save