[fixed]CGUITable::deserialize() doesn't use correct string getter

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
chronologicaldot
Competition winner
Posts: 685
Joined: Mon Sep 10, 2012 8:51 am

[fixed]CGUITable::deserialize() doesn't use correct string getter

Post by chronologicaldot »

In my problems here [link]viewtopic.php?f=6&p=306532#p306532[/link], I inadvertently discovered that part of the reason Asian text doesn't show up is because getAttributeAsString() is being used where stringw is sought.
Code from line 1255 of CGUITable.cpp (of rev 6221):

Code: Select all

	cell.Text = core::stringw(in->getAttributeAsString(label.c_str()).c_str());
Should be:

Code: Select all

	cell.Text = in->getAttributeAsStringW(label.c_str());
This allows getAttributeAsStringW() to secretly perform any conversion from char to wchar_t if the string to be returned isn't already wchar_t.

I'm guessing the original code was probably written before there was a getAttributeAsStringW().

I checked the other GUI elements, and all but one other were fine. CGUIFileOpenDialog uses getAttributeAsString() regardless of platform. Should be stringw on Windows I would think, but then again it should be io::path for fschar_t, lol. Easiest thing would be to use the #ifdef _IRR_WCHAR_FILESYSTEM
I'm tired and going to bed.
CuteAlien
Admin
Posts: 9644
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: CGUITable::deserialize() doesn't use correct string getter

Post by CuteAlien »

Thanks, nice find! Will fix it next days.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
chronologicaldot
Competition winner
Posts: 685
Joined: Mon Sep 10, 2012 8:51 am

Re: CGUITable::deserialize() doesn't use correct string getter

Post by chronologicaldot »

I just found out line 1220 does it too.

Code: Select all

		column.Name = core::stringw(in->getAttributeAsString(label.c_str()).c_str());
CuteAlien
Admin
Posts: 9644
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: CGUITable::deserialize() doesn't use correct string getter

Post by CuteAlien »

OK, changed both in svn trunk [r6358].
Did not touch CGUIFileOpenDialog for now... that one is probably not a one minute thing to avoid messing it up.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
chronologicaldot
Competition winner
Posts: 685
Joined: Mon Sep 10, 2012 8:51 am

Re: CGUITable::deserialize() doesn't use correct string getter

Post by chronologicaldot »

Sadly, though it was part of the problem, it still doesn't fix the problem with Asian text not showing up, at least for me, but it seems the problem is still unique to CGUITable, maybe in breakText()? -\_(ツ)_/- I guess I just have bad luck in this area.
chronologicaldot
Competition winner
Posts: 685
Joined: Mon Sep 10, 2012 8:51 am

Re: CGUITable::deserialize() doesn't use correct string getter

Post by chronologicaldot »

Correction, my problem seems to be that I can't get my program to compile while recognizing new changes made to Irrlicht. UGH!
chronologicaldot
Competition winner
Posts: 685
Joined: Mon Sep 10, 2012 8:51 am

Re: CGUITable::deserialize() doesn't use correct string getter

Post by chronologicaldot »

Update: Ok, it all works now. I had some unrelated compilation issue getting in my way.
Post Reply