Hi:
 
I trust that many of you fellow Win32 coders have used the 'UNICODE'
preprocessor definition to support Unicode in your apps or components.  If
so, you've probably discovered that this preprocessor definition breaks
Sqlite.  Specifically, the following Win32 functions in os.c will lead to
exceptions and other problems:

*       DeleteFile()
*       GetFileAttributes()
*       MoveFile()
        
*       CreateFile()
*       GetTempPath()
*       GetVersionEx()
        
*       GetFullPathName()

The problem revolves around the fact that when 'UNICODE' is defined, these
functions require wide characters for input and output. The calling
functions in os.c require narrow characters.  I would like to offer a
suggestion for fixing this problem.
 
As you may know, the above 'functions' are not really functions but rather
preprocessor definitions themselves.  Depending on whether or not UNICODE is
defined, the 'real' function, which ends with an 'A' or a 'W', will be
called.  For example, for the GetFullPathName() 'function', if UNICODE is
not defined, GetFullPathNameA() is called, but if UNICODE is defined,
GetFullPathNameW() is called.  As you might guess, the functions ending with
'A' use narrow characters, while the functions ending with 'W' use wide
characters.
 
I think you can see where I'm going with this.  To fix the problem, I
propose that for the functions listed above, os.c should always call the
'real' function name, and it should be the one ending with an 'A'.  As it
stands, the os.c has no ability to deal with wide characters, so there is no
reason it should ever call the wide version of these Win32 functions.
 
Thoughts?
 
Regards,
Rob Fowler

Reply via email to