Is this a bug?
Is this a bug?
| Kevin Yuan |
Nov 4 2005, 02:21 AM
Post
#1
|
|
Member ![]() ![]() Group: Members Posts: 21 Joined: 4-November 05 Member No.: 182 |
I am new here and this is my first post
I found VCF yesterday very accidentally, but I am loving it now! It is GREAT! I have seen several frameworks, but this one is the most comfortable to me. <I am using VCF-0.6.8 on Window XP(Chinese version) sp2, Visual Studio.NET 2003> After trying some hello-wolds I found a problem: When I adding DefaultMenuItems to MenuBar on the MainWindow using some MBCS characters(such as Chinese, Japanese) as captions, the strings on menu items appear incompletely. I tried to read the source and found sth suspicious: CODE // \src\vcf\ApplicationKit\Win32MenuItem.cpp // line 117 ~ 127 // function Win32MenuItem::insertSimpleMenuItem info.cch = itemName.size();//!! size of the string is calc unicode way #if defined(VCF_CW) && defined(UNICODE) wchar_t* tmpName = new wchar_t[info.cch+1]; memset( tmpName, 0, (info.cch+1)*sizeof(wchar_t) ); itemName.copy( tmpName, info.cch );//OK #else char* tmpName = new char[info.cch+1]; memset( tmpName, 0, (info.cch+1)*sizeof(char) ); itemName.copy( tmpName, info.cch );//Buggy!! #endif info.dwTypeData = tmpName; if ( InsertMenuItem( menu, child->getIndex()/*info.wID*/, TRUE, &info ) ) Here they use #if...#else...#endif to deal with unicode and ansi which is not OK I think. As we know, the pre-compile directives are solved at compile time rather than at run time, so the menu item string pointed by info.dwTypeData is unicode or ansi is fixed when the library is built. This is not what we desired. BTW, the size of item string(info.cch) is calculated always unicode way, this is buggy when UNICODE is not defined(the info.cch may be shorter than the actual size in case MBCS characters). I also find other code this style in VCF source . |
![]() ![]() ![]() |
| ddiego |
Nov 4 2005, 06:00 PM
Post
#2
|
|
VCF Lead Developer ![]() ![]() ![]() Group: Lead Developer Posts: 2834 Joined: 2-August 03 Member No.: 2 |
QUOTE(Kevin Yuan @ Nov 3 2005, 10:21 PM) I am new here and this is my first post By the way, welcome! OK I just checked in some fixes that address all the various VCF_CW && UNICODE issues. If you'd like, feel free to grab this from the current CVS development branch like so: CODE cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/vcf login (hit enter when prompted) cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/vcf co -r devmain-0-6-9 vcf This should get the code and then you can build it. Cheers Jim |
| Kevin Yuan |
Nov 6 2005, 07:33 AM
Post
#3
|
|
Member ![]() ![]() Group: Members Posts: 21 Joined: 4-November 05 Member No.: 182 |
QUOTE(ddiego @ Nov 5 2005, 02:00 AM) QUOTE(Kevin Yuan @ Nov 3 2005, 10:21 PM) I am new here and this is my first post By the way, welcome! OK I just checked in some fixes that address all the various VCF_CW && UNICODE issues. If you'd like, feel free to grab this from the current CVS development branch like so: CODE cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/vcf login (hit enter when prompted) cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/vcf co -r devmain-0-6-9 vcf This should get the code and then you can build it. Cheers Jim Thank you!! But I am still trying to learn the CVS things To tell the truth I do not know how to use CVS and I have to download the entire package |
Kevin Yuan Is this a bug? Nov 4 2005, 02:21 AM
ddiego Yes this would most certainly appear to be a bug. ... Nov 4 2005, 03:41 AM
Kevin Yuan
But I found twenties of "#if defined(VCF_CW... Nov 4 2005, 05:07 AM
ddiego Thanks! I'll look into this. You might wan... Nov 4 2005, 02:10 PM
ddiego Can you try replacing the code in your version of ... Nov 4 2005, 02:12 PM
Fraggle Lol - I knew this would come back to bite me!
... Nov 4 2005, 05:06 PM
ddiego
Ouch! I'm sorry - too many pans in the f... Nov 4 2005, 05:42 PM
Fraggle
Who knows? Hopefully! I'm still trying t... Nov 4 2005, 05:51 PM
ddiego
There's some help here:
http://vcf-online.or... Nov 6 2005, 06:07 PM
Fraggle
I can offically state that it didn't, but I... Nov 5 2005, 06:44 PM
ddiego
I can offically state that it didn't, but I... Nov 5 2005, 09:03 PM
Kevin Yuan Thank you!! Nov 7 2005, 12:36 AM
Kevin Yuan My cvs.exe commandline works now!
Thanks you a... Nov 7 2005, 01:36 AM![]() ![]() ![]() |
| Lo-fi Version | : 19th May 2013 - 05:22 AM |