bug in 0.6 with config.xml

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
kgraser
Posts: 2
Joined: Mon Jan 26, 2004 8:50 am
Location: San Jose, CA USA

bug in 0.6 with config.xml

Post by kgraser »

Hi there,

first since this is my first post, I really appreciate everything going on with irrlicht. Of course I downloaded 0.6 yesterday and started playing with it (Especially with the meshviewer) right away.

Then I figured out when I modified the config.xml file that the program froze. (Debugging revealed it never finds the way out of the

while(xml && xml->read())
{
}

loop).

I also realized that the size of the modified config.xml is smaller (half to be excact). When I looked at the binary filecontens (using hexworkshop)
I could see immedeatly why, -> in the original config.xml there is a '0' byte
after every character, and that is gone in the modified one, probably by saving the file (with VC.net).

Conclusion: without the '0' characters it's not working, but I think they are not ok if any xml editor removes them.

I havn't checked the XML Reader code yet, and I think you guys can do this much better than me. But somewhere there you have a problem (maybe by writing and reading a 16bit instead if 8bit, or something like that).

Anyway I hope you can fix that soon, because I (and I think I'm not alone) like the XML feature a lot.

best regards

Klaus
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hm, strange, seems that I haven't tested it out with simple ascii files after I finished the loader..
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

Post by Gorgon Zola »

hi, i had some problems with the xmlreader.
this is what if done to resolve the problem. i don't know if this is a good way, but anyhow. the problem i had was that the xmlreader didn't terminate. because for some reason or the other? don't know why, xml->read() always returned true.

so i first did what was suggested in the thread about "segfault" in "Bug reports"

and since that didn't work for me either, i guess larger wchar_t is really a unix specialty i changed the cmlreader a little bit.

CXMLReader.h

1 ) make "parseCurrentNode()" return a boolean value

2 ) "read()" must return the value from parseCurrentNode()

Code: Select all

bool CXMLReader::read()
{
  if ((u32)(P - TextBegin) < TextSize - 1)
  {
    return parseCurrentNode();
  }
  return false;
}
3 ) change CXMLReader::parseCurrentNode()

Code: Select all

bool CXMLReader::parseCurrentNode()
{
wchar_t* start = P;
while(*P != L'<' && *P && ( (u32)(P - TextBegin) < TextSize - 1 ) ) ++P;
if (!*P)
{
os::Printer::print("CXMLReader::parseCurrentNode() bail out!");
return false;
}
if (P - start > 2)
{
// we found some text
setText(start, P);
--P;
return true;
}
++P;
switch(*P)
{
case L'/':
parseClosingXMLElement(); break;
case L'?':
ignoreDefinition();	break;
case L'!':
parseComment();	break;
default:
parseOpeningXMLElement();  break;
}
return true;
}
these changes work for me but i only work with ascii files

hope that help some other desperate xml fans :)
cheers
tom
MasterD
Posts: 153
Joined: Sun Feb 15, 2004 4:17 pm
Location: Lübeck, Germany
Contact:

xml error

Post by MasterD »

Hi,
I had the same problem with my xml file ( i think it's the same).
Try saving it as simple unicode format (open with notepad and save it again as unicode). It worked for me.
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

Post by Gorgon Zola »

Thanks MasterD that worked, do you know if visual studio can save special files in unicode?
MasterD
Posts: 153
Joined: Sun Feb 15, 2004 4:17 pm
Location: Lübeck, Germany
Contact:

Saving as Unicode in Visual Studio ?

Post by MasterD »

I work with MSVC++ 6 (educ. Version) and there it seems that you can't save as unicode.
In the Help File you can find that special libraries support unicode, but i could not find any information for saving as unicode :?.
Post Reply