Move tellg() usage to the start of the block rather than at the end, otherwise it would always return -1. This should be harmless for windows.

Originally committed to SVN as r3269.
This commit is contained in:
Amar Takhar 2009-07-25 08:32:21 +00:00
parent 2522102465
commit ffe628f29a
1 changed files with 5 additions and 2 deletions

View File

@ -128,6 +128,10 @@ int main(int argc, const char *argv[]) {
while (iter.Next(&filename)) { while (iter.Next(&filename)) {
ifstream infile(filename.char_str(), ios::binary); ifstream infile(filename.char_str(), ios::binary);
infile.seekg(0, ios::end);
int infile_end = infile.tellg();
infile.seekg(0, ios::beg);
wxFileName file(filename); wxFileName file(filename);
wxString identifier = file.GetName() + "_" + file.GetDirs().Last(); wxString identifier = file.GetName() + "_" + file.GetDirs().Last();
nameCleaner.ReplaceAll(&identifier, "_"); nameCleaner.ReplaceAll(&identifier, "_");
@ -141,8 +145,7 @@ int main(int argc, const char *argv[]) {
first = false; first = false;
} }
outC << "};" << endl; outC << "};" << endl;
infile.seekg(ios_base::end); outH << "extern const unsigned char " << identifier << "[" << infile_end << "];" << endl;
outH << "extern const unsigned char " << identifier << "[" << infile.tellg() << "];" << endl;
} }
return 0; return 0;