View previous topic :: View next topic |
Author |
Message |
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Sun Jan 14, 2007 13:26 Post subject: |
|
|
size_t size = strlen(buffer) is working as designed. (returns 1024)
sizeof() returns the size of the pointer (char*) which is 4 (on Win32)
My issue is that it's copying the contents of the pointer, not the contents of the memory that is being pointed to.
This is strange as it's the same code that is used for the existing plugins.
the other thing is sqlite3_column_text() returns a "const unsigned char*" (UTF8 complient)
Cheers
Gryphyn |
|
Back to top |
|
|
kungfoowiz
Joined: 12 Oct 2006 Posts: 61
|
Posted: Sun Jan 14, 2007 13:50 Post subject: |
|
|
It may not be a problem with memcpy( ) then, rather with NWN2 itself. Certain UTF8 characters may cause it to truncate the variable string, and if the logfile isn't UTF8-encoded that may be indicating false results. Have you tried printing out the strings with SendMessageToPC( )? |
|
Back to top |
|
|
kungfoowiz
Joined: 12 Oct 2006 Posts: 61
|
Posted: Sun Jan 14, 2007 14:05 Post subject: |
|
|
The string should also be terminated by 4 nulls in UTF8: buffer[len(-1,2,3)] = 0x0; |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Sun Jan 14, 2007 23:13 Post subject: |
|
|
Hmm.. interesting one.
What is your character set (Project - Properties - General) set to ? You'd have to set it to a multibyte encoding in order for the code to be UTF-8 compatible. I do not know how the SQLite code would react in this case, however. _________________ Papillon |
|
Back to top |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Mon Jan 15, 2007 1:42 Post subject: |
|
|
Papillon wrote: | Hmm.. interesting one.
What is your character set (Project - Properties - General) set to ? You'd have to set it to a multibyte encoding in order for the code to be UTF-8 compatible. I do not know how the SQLite code would react in this case, however. |
Character Set = Not Set (the same as your SQLite project)
The project builds with UTF8 complience until I try the 2nd output of my data value.
That is my log file etc. shows my UTF8 encoded characters. when I add the 2nd output, my log file reverts to ASCII encoding.
I don't want to play too much with Project properties. I'll make the change and hopefully it fixes the issue and doesn't break anything else...
The SQLite bit should be OK, by default it's all encoded as UTF8.
Cheers
Gryphyn |
|
Back to top |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Mon Jan 15, 2007 14:05 Post subject: |
|
|
Still don't know why the encoding is flaky.
The 'switch' only happens if I log an entry AFTER copying the memory.
On a better note I'm using
Code: | _mbsnbcpy((unsigned char*)buffer,(const unsigned char*)value.ToAscii(),value.Len());
buffer[value.length()] = 0x0; |
to manage the UTF8 copy.
(const unsigned char*)value is exactly what I need for the sqlite3 functions.
Cheers
Gryphyn |
|
Back to top |
|
|
buu
Joined: 19 Jan 2007 Posts: 2
|
Posted: Wed Jan 24, 2007 15:46 Post subject: |
|
|
I'm not really proficient with VC as it's the first time that i use it. While linking i get these errors
Code: |
1>bicrenamer.obj : error LNK2019: unresolved external symbol "public: void __thiscall Plugin::SetPluginFullPath(char *)" (?SetPluginFullPath@Plugin@@QAEXPAD@Z) referenced in function _DllMain@12
[...]
1>wxbase26d.lib(utils.obj) : error LNK2019: unresolved external symbol __imp__LookupPrivilegeValueA@12 referenced in function "bool __cdecl wxShutdown(enum wxShutdownFlags)" (?wxShutdown@@YA_NW4wxShutdownFlags@@@Z)
|
|
|
Back to top |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Wed Jan 24, 2007 22:30 Post subject: |
|
|
buu wrote: | I'm not really proficient with VC as it's the first time that i use it. While linking i get these errors |
This just indicates that your path (environment variable) is not set up correctly. Had the same issue myself. Closely follow the instructions on setting up your environment and it should fix itself.
The defining event that enabled my build environment was having NWNX4 (root) installed on the same drive as my Visual Studio(s) -- I still don't know exactly what was missing.
Cheers
Gryphyn |
|
Back to top |
|
|
Last_Yuzong
Joined: 01 Apr 2007 Posts: 11 Location: Germany
|
Posted: Fri Apr 13, 2007 22:01 Post subject: |
|
|
Hi,
I had allready some posts here http://www.nwnx.org/phpBB2/viewtopic.php?t=89&postdays=0&postorder=asc&start=60.
Now there seems to be one little problem left.
Code: | c++\vc\include\wx\wx\setup.h(26) : fatal error C1083: Datei (Include) kann nicht geöffnet werden: "../../../lib/vc_lib/mswud/wx/setup.h": No such file or directory |
I use Visual C++ 2005 Express Edition and while compiling, it shows me this twice.
In the setup.h, it is this:
Code: | #ifdef WXUSINGDLL
#ifdef _DEBUG
#include "../../../lib/vc_dll/mswud/wx/setup.h"
#else
#include "../../../lib/vc_dll/mswu/wx/setup.h"
#endif
#else
#ifdef _DEBUG
#include "../../../lib/vc_lib/mswud/wx/setup.h"
#else
#include "../../../lib/vc_lib/mswu/wx/setup.h"
#endif
#endif |
I looked it up in every folder which belongs to this but I did not find vc_dll/. |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Sun Apr 15, 2007 14:36 Post subject: |
|
|
Quote: | c++\vc\include\wx\wx\setup.h(26) : fatal error C1083: Datei (Include) kann nicht geöffnet werden: "../../../lib/vc_lib/mswud/wx/setup.h": No such file or directory |
You are trying to compile against the unicode (debug) version of wxWidgets, which is not included in the NWNX subversion repository. Please set your character set to "not set" in the project general properties. _________________ Papillon |
|
Back to top |
|
|
Last_Yuzong
Joined: 01 Apr 2007 Posts: 11 Location: Germany
|
Posted: Sun Apr 15, 2007 20:47 Post subject: |
|
|
I hope, i did as you said, but now i have another error:
Code: | LINK : fatal error LNK1104: Datei "wxmsw26d_core.lib" kann nicht geöffnet werden. |
Thank you very much for helping a C++ Newbie . |
|
Back to top |
|
|
Last_Yuzong
Joined: 01 Apr 2007 Posts: 11 Location: Germany
|
Posted: Tue May 01, 2007 17:56 Post subject: |
|
|
Please help me, i have absolutly no idear why this do not work. The file seems to be in the right place and I have no experiences with Visual Studio 5 Express, which I use. |
|
Back to top |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Tue May 01, 2007 23:48 Post subject: |
|
|
Last_Yuzong wrote: | Please help me, i have absolutly no idear why this do not work. The file seems to be in the right place and I have no experiences with Visual Studio 5 Express, which I use. |
Open Visual Studio.
Open the Solution
Select the Project
Right-Click -> Select Properties
**You should have
In the tree.
- Configuration Properties
- - General
In the listview
- Project defaults
- - Character Set
Make sure the Character Set value is "Not Set"
*Do this for BOTH Debug and Release configurations.
Cheers
Gryphyn |
|
Back to top |
|
|
Last_Yuzong
Joined: 01 Apr 2007 Posts: 11 Location: Germany
|
Posted: Wed May 02, 2007 19:06 Post subject: |
|
|
Thank you, now I know that this is not faulty. I have allready done it exactly like this and it solved my problem above, but this seems to be another one. |
|
Back to top |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Thu May 03, 2007 0:38 Post subject: |
|
|
Last_Yuzong wrote: | Thank you, now I know that this is not faulty. I have already done it exactly like this and it solved my problem above, but this seems to be another one. |
Next: how recently did you download the source?
The very latest had some issues (I downloaded two nights ago).
Papillon has updated wxWidgets, however some of the project files didn't get updated in source control.
look in ..."\nwnx4\lib\wxwidgets\lib\vc_lib"
check for wxbase<n>.lib (where <n> is a number, either 26 or 28 )
*in your case I think it may be 28.
Now open your project properties.
Configuration properties
- Linker
- - Input
The List in "Additional Dependencies" should have all the wx___.lib's with the same number as discovered earlier.
If not...
For every Project, for both Debug & Release
you need to change the number to match what you discovered.
that is if you found wxbase28.lib all the wx__.lib's should have a 28 in their names.
Cheers
Gryphyn |
|
Back to top |
|
|
|