KDE/kdelibs/kdecore/services

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Mon Nov 5 17:25:28 CET 2007


Paulo Moura Guedes schrieb:
> On 11/5/07, Christian Ehrlicher <Ch.Ehrlicher at gmx.de> wrote:
>>> Von: Paulo Moura Guedes <moura at kdewebdev.org>
>>> SVN commit 733109 by mojo:
>>>
>>> Fix build for win32, GetDriveType receives a LPCTSTR parameter.
>>>
>>> CCMAIL: kde-windows at kde.org
>>>
>>>  M  +1 -1      kmimetype.cpp
>>>
>>>
>>> --- trunk/KDE/kdelibs/kdecore/services/kmimetype.cpp #733108:733109
>>> @@ -206,7 +206,7 @@
>>>      // FIXME: distinguish between mounted & unmounted
>>>      int size = path.size();
>>>      if ( size == 2 || size == 3 ) {
>>> -        unsigned int type = GetDriveType( (LPCWSTR) path.utf16() );
>>> +        unsigned int type = GetDriveType( (LPCTSTR) path.utf16() );
>>>          switch( type ) {
>>>              case DRIVE_REMOVABLE:
>>>                  return KMimeType::mimeType( "media/floppy_mounted" );
>> Happy crash with mingw ...
> 
> Can you explain why?
> 
yes... do you want to know? ;-)

path.utf16() returns LPCWSTR (or unsigned short* or WCHAR*) and we want
to call the unicode version of GetDriveType.
What you did is to cast LPCWSTR to a char* and call the ansi version
(GetDriveTypeA)
It's a mingw issue (bug?) to not use the unicode win32api by default.
Maybe we should add -DUNICODE for kde. But on the other side it's a good
testcase when I forget adding 'W' again.


Christian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://mail.kde.org/pipermail/kde-windows/attachments/20071105/670ede1e/attachment.pgp 


More information about the Kde-windows mailing list