Convert the identifier to an std::string from wxString. For whatever reason wxString is producing addresses rather than strings when automatically converting. I've seen this behaviour before and it seems quite random. This will solve that problem.

Originally committed to SVN as r4342.
This commit is contained in:
Amar Takhar 2010-05-22 01:22:53 +00:00
parent cb1a82baaa
commit 810ffa09c7

View file

@ -40,7 +40,6 @@
#include <wx/string.h> #include <wx/string.h>
#include <wx/regex.h> #include <wx/regex.h>
#include <wx/arrstr.h> #include <wx/arrstr.h>
using namespace std; using namespace std;
class FileIterator { class FileIterator {
@ -56,7 +55,7 @@ public:
FileIterator::FileIterator(int argc, const char **argv) FileIterator::FileIterator(int argc, const char **argv)
: currentItem(2), inDir(false), currentDir(), items(argc, argv) { : currentItem(2), inDir(false), currentDir(), items(argc, argv) {
if (argc == 2) { if (argc == 2) {
// No names passed on the command line, so read them from stdin // No names passed on the command line, so read them from stdin
char buffer[1024]; char buffer[1024];
while (cin.getline(buffer, 1024), cin.good()) { while (cin.getline(buffer, 1024), cin.good()) {
@ -81,7 +80,6 @@ bool FileIterator::Next(wxString *filename) {
wxFileName next; wxFileName next;
wxString current = items[currentItem]; wxString current = items[currentItem];
currentItem++; currentItem++;
// Test if it's a directory // Test if it's a directory
@ -135,8 +133,9 @@ int main(int argc, const char *argv[]) {
nameCleaner.ReplaceAll(&identifier, "_"); nameCleaner.ReplaceAll(&identifier, "_");
std::string tmp(identifier.mb_str());
outC << "#include \"libresrc.h\"" << endl; outC << "#include \"libresrc.h\"" << endl;
outC << "const unsigned char " << identifier << "[] = {"; outC << "const unsigned char " << tmp << "[] = {";
bool first = true; bool first = true;
char c[1]; char c[1];
while (infile.read(c, 1).gcount() > 0) { while (infile.read(c, 1).gcount() > 0) {
@ -145,7 +144,7 @@ int main(int argc, const char *argv[]) {
first = false; first = false;
} }
outC << "};" << endl; outC << "};" << endl;
outH << "extern const unsigned char " << identifier << "[" << infile_end << "];" << endl; outH << "extern const unsigned char " << tmp << "[" << infile_end << "];" << endl;
} }
return 0; return 0;