[ghemical-devel] cvs BRANCH updated

Tommi Hassinen thassine at messi.uku.fi
Mon Feb 20 02:28:20 EST 2006


On Fri, 17 Feb 2006, Geoffrey Hutchison wrote:

> Hi all,
>
> Following Tommi's comments, I had some free time to fix all the "backwards 
> compatibility" warnings with strstream in ghemical VERSION_2_BRANCH and 
> libghemical HEAD.

Thanks, the warnings are gone now...

However, I saw some strange behaviour at VERSION_2_BRANCH while the same 
code at HEAD seems to work. So this is an odd situation...

When I start the VERSION_2_BRANCH executable and try to open a glade 
dialog box (for example if I select Geometry Optimization from the popup 
menu) the program crashes with console messages like these:

(ghemical:14909): libglade-WARNING **: could not find glade file 
'\xa8\xe8\xff\xbf\xdf~'
ERROR : could not read glade XML file : ¨èÿ¿ß~

The reason is at glade_dialog.cpp file around line 23:

 	char filename[256];
 	ostringstream str(filename);
 	str << project::appdata_path << DIR_SEPARATOR << project::appversion << DIR_SEPARATOR << xmlfile << ends;

This code seems to fail at writing the filename properly, causing the 
error. The strange thing is that the same code at HEAD seems to work... 
Could this be a synchronization issue or something like that? A missing 
"flush" command or something?

After looking at some docs, I ended up into this alternative way to do the 
same thing : first do an ostringstream object, write into it, then ask a 
std::string object using a .str() call, then ask it to give a C string 
using the .c_str() call:

 	ostringstream str;
 	str << project::appdata_path << DIR_SEPARATOR << project::appversion << DIR_SEPARATOR << xmlfile << ends;
 	const char * filename = str.str().c_str();

This seems to work for me at VERSION_2_BRANCH ; I have not yet made any 
further testing.

> I'll be glad to make the change to ghemical HEAD when it's a bit more useful 
> for day-to-day use.

Yep, I know that the HEAD version is still incomplete. Now it's 
architecture is stable enough so that you can start figuring out how to 
port your own changes there, if needed.

Regards,

 	Tommi


More information about the ghemical-devel mailing list