[ wxwindows-Patches-1692003 ] [wxOS2]Build failure with wxCStrData conversion

SourceForge.net noreply at sourceforge.net
Sun Apr 1 01:46:49 PDT 2007


Patches item #1692003, was opened at 2007-03-31 17:26
Message generated for change (Comment added) made by vaclavslavik
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1692003&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: OS2 specific
Group: bug fix
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Dave Parsons (dwparsons)
Assigned to: Vaclav Slavik (vaclavslavik)
Summary: [wxOS2]Build failure with wxCStrData conversion

Initial Comment:
Currently the OS/2 port fails to build with errors like the following:-

I:/wxbuildtest/wxdev/wxWidgets/src/common/dynlib.cpp: In member function `bool
   wxDynamicLibrary::Load(const wxString&, int)':
I:/wxbuildtest/wxdev/wxWidgets/src/common/dynlib.cpp:123: error: conversion
   from `wxCStrData' to `char*' is ambiguous
I:/wxbuildtest/wxdev/wxWidgets/include/wx/string.h:198: error: candidates are:
   wxCStrData::operator const void*() const <near match>
I:/wxbuildtest/wxdev/wxWidgets/include/wx/string.h:199: error:
   wxCStrData::operator const char*() const <near match>
I:/wxbuildtest/wxdev/wxWidgets/include/wx/string.h:200: error:
   wxCStrData::operator const unsigned char*() const <near match>

The attached patch corrects this problem.



----------------------------------------------------------------------

>Comment By: Vaclav Slavik (vaclavslavik)
Date: 2007-04-01 10:46

Message:
Logged In: YES 
user_id=80834
Originator: NO

> double casts often, is  not very pretty. Is there any cleaner approach
to
> this or am I stuck with the casts?

If OS/2 doesn't support Unicode, then any "(PSZ)str.c_str()" can be simply
replaced by "str.char_str()" (this is newly added method that returns a
buffer convertible to non-const char*).

----------------------------------------------------------------------

Comment By: Dave Parsons (dwparsons)
Date: 2007-04-01 10:43

Message:
Logged In: YES 
user_id=970101
Originator: YES

After I submitted stringimpl.cpp report it revealed yet more problems of
the PSZ type.
I've started wading through them but there are a lot and the solution,
double casts often, is  not very pretty. Is there any cleaner approach to
this or am I stuck with the casts?

>From the OS/2 toolkit headers:-
D:\os2tk45\h\os2def.h
typedef char *PSZ;

Re Unicode, OS/2 does support unicode I believe, but I don't know whether
there is sufficient in the compiler and the OS/2 files in wx to use it, nor
do I know whether it is new enough or complete enough. I've never used it.

I'll try setting enable-unicode and see what happens.


----------------------------------------------------------------------

Comment By: Vaclav Slavik (vaclavslavik)
Date: 2007-04-01 09:59

Message:
Logged In: YES 
user_id=80834
Originator: NO

So these functions actually don't need non-const char* argument? Also, do
you think you could do similar patch for the rest of wxOS2 sources? It
looks like (PSZ) cast is used all over the place...

BTW, what is PSZ defined as? And does OS/2 build support Unicode?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1692003&group_id=9863




More information about the wx-dev mailing list