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

View file

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