← Back to team overview

kicad-developers team mailing list archive

Re: Libcurl patch.

 

>From the wxWidgets 3 docs, it appears the correct way to deal with this is:

But a better solution is to use wxWidgets-provided functions, if
possible, as is the case for printf family of functions:

// This is the recommended way.
wxPrintf("You can do just this: %s", s);
wxPrintf("And this (but it is redundant): %s", s.c_str());
wxPrintf("And this (not using Unicode): %s", s.mb_str());
wxPrintf("And this (always Unicode): %s", s.wc_str());

I just used option 1 and it seemed to work just fine.  If the
documentation is correct it should work.  I'll commit it like this and
if breaks on osx, let me know.

On 1/10/2016 11:15 AM, Bernhard Stegmaier wrote:
> wxWidgets docs also used a cast:
> 
> Using an explicit conversion to narrow, multibyte, string:
> printf("Hello, %s", (const char *)s.mb_str
> <http://docs.wxwidgets.org/trunk/classwx_string.html#adcfd12e6d0765b1d74bccc3d63d02e98>())
> 
> 
> So, I didn’t further think about it… :)
> 
> 
>> On 10.01.2016, at 17:11, Chris Pavlina <pavlina.chris@xxxxxxxxx
>> <mailto:pavlina.chris@xxxxxxxxx>> wrote:
>>
>> Yeah, you can't static_cast wxString to const char*, no idea why GCC
>> allowed that, if it even did. Nothing wrong with the approach you used
>> to replace it, though the static_cast<const char*> in that case is
>> unnecessary (no reason you can't just pass canonicalName.mb_str()
>> directly to StrPrintf).
>>
>> On Sun, Jan 10, 2016 at 05:08:42PM +0100, Bernhard Stegmaier wrote:
>>> Thanks, it applied now.
>>>
>>> clang doesn’t like the static_cast:
>>>                std::string msg = StrPrintf( "%s not
>>> wxDynamicLibrary::Load()ed",
>>>                                             static_cast<const char*>(
>>> canonicalName ) );
>>> and also the same some lines below.
>>>
>>> [ 35%] Building CXX object
>>> common/CMakeFiles/common.dir/kicad_curl/kicad_curl.cpp.o
>>> /Volumes/OSXData/Users/bstegmaier/Temp/KiCad/kicad/common/kicad_curl/kicad_curl.cpp:108:46:
>>> error: cannot cast from type
>>>      'wxString' to pointer type 'const char *'
>>>                                             static_cast<const char*>(
>>> canonicalName ) );
>>>                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>> I can remember there was a discussion about that (or sth similar?) on
>>> the list… I can’t remember what the agreement was, though.
>>>
>>> I worked around changing those 2 spots to (as suggested by wxWidgets
>>> docs):
>>>                std::string msg = StrPrintf( "%s not
>>> wxDynamicLibrary::Load()ed",
>>>                                             static_cast<const char*>(
>>> canonicalName.mb_str() ) );
>>>
>>> Therewith it compiles and works fine.
>>> At least, it did load Github footprints.
>>>
>>>
>>> Regards,
>>> Bernhard
>>>
>>>> On 10.01.2016, at 16:49, Wayne Stambaugh <stambaughw@xxxxxxxxx
>>>> <mailto:stambaughw@xxxxxxxxx>> wrote:
>>>>
>>>> Patch rebased against r6437.  I just rebuild this on windows without any
>>>> issues.
>>>>
>>>> On 1/10/2016 10:28 AM, Bernhard Stegmaier wrote:
>>>>> Do you have an up-to-date version of the patch?
>>>>> It doesn’t apply to pcbnew/github/github_plugin.cpp anymore, but
>>>>> doesn’t seem compile without resolving the rejects.
>>>>>
>>>>>
>>>>> Regards,
>>>>> Bernhard
>>>>>
>>>>>
>>>>>> On 10.01.2016, at 16:19, Wayne Stambaugh <stambaughw@xxxxxxxxx
>>>>>> <mailto:stambaughw@xxxxxxxxx>> wrote:
>>>>>>
>>>>>> I just need to make sure it compiles and loads the github footprint
>>>>>> libraries correctly.  It loads libcurl on demand, I need to make sure
>>>>>> that is working on osx.  I've got it tested and working on linux and
>>>>>> windows and I want to make sure we don't introduce any bugs in osx
>>>>>> if I
>>>>>> can avoid it.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Wayne
>>>>>>
>>>>>> On 1/10/2016 10:15 AM, Bernhard Stegmaier wrote:
>>>>>>> What specifically should be tested?
>>>>>>> I can give it a try right now, but I didn’t follow this so I
>>>>>>> don’t know what to look for…
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>> Bernhard
>>>>>>>
>>>>>>>> On 10 Jan 2016, at 16:10, Wayne Stambaugh <stambaughw@xxxxxxxxx
>>>>>>>> <mailto:stambaughw@xxxxxxxxx>> wrote:
>>>>>>>>
>>>>>>>> Did anyone get a chance to test this on OSX?  I didn't see any
>>>>>>>> response
>>>>>>>> since I sent out the original message.  I got bit by the libcurl bug
>>>>>>>> that this patch fixes twice in the last week so I would like to
>>>>>>>> get it
>>>>>>>> committed.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Wayne
>>>>>>>>
>>>>>>>> -------- Forwarded Message --------
>>>>>>>> Subject: Libcurl patch.
>>>>>>>> Date: Sat, 26 Dec 2015 10:50:08 -0500
>>>>>>>> From: Wayne Stambaugh <stambaughw@xxxxxxxxx
>>>>>>>> <mailto:stambaughw@xxxxxxxxx>>
>>>>>>>> To: KiCad Developers <kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>>>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>>
>>>>>>>>
>>>>>>>> Dick discovered an issue with the libcurl patch for the github
>>>>>>>> plugin.
>>>>>>>> Attached is his patch to fix these issues.  One thing he did that I
>>>>>>>> asked him to do was make libcurl dynamically loadable since it isn't
>>>>>>>> always necessary to load it at run time.  I've tested the patch on
>>>>>>>> windows and linux but I would like one of our osx devs to please
>>>>>>>> test it
>>>>>>>> to make sure it works on osx when you get a chance.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Wayne
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> <libcurl-dynload.patch>_______________________________________________
>>>>>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>>>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>>>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>>>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>> <libcurl-dynload.patch>
>>>
>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>
> 



Follow ups

References