[liblouis-liblouisxml] Re: [liblouis] r1162 committed - Fix a warning

  • From: "Michael Whapples" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "mwhapples@xxxxxxx" for DMARC)
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Tue, 06 May 2014 18:45:56 +0100

Refer to r1168 where I now have changed it so that lou_logPrint accepts const char *.


Michael Whapples
On 06/05/2014 17:03, Christian Egli wrote:
"Michael Whapples" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender
"mwhapples@xxxxxxx" for DMARC) writes:

The reason for copy is that lou_logPrint takes char * where as that
function has message defined as const char *.
Ah, ok that explains it.

It is wrong to cast from const char * to char *.
I agree.

If lou_logPrint does not modify format then I could have changed
lou_logPrint to take const char * but John Boyer has been reluctant
for API changes.
Can't we just do that. That seems like the best solution and we are
changing the api anyway (migrate from logprint to the logging callback),
so I don't see a problem in changing this.

If people are willing for lou_logPrint to change to taking const char
* then I will change that.
Yes, please do.

Why not use strdup? Wasn't fully sure of the status of it in Visual
Studio. When checking MSDN it says that strdup is depricated and to
use _strdup instead. I don't know whether GCC supports _strdup and did
not want conditional compilation. Advise which out of strdup and
_strdup I should use and I will change to it.
Ah, I didn't know that strdup was a problem in Visual Studio. Bert has
been using it in his table resolver. I would suggest that you just use
it and then I'll include the gnulib module for strdup which provides
its own implementation if the platform doesn't have it, so we should be
on the safe side.

Thanks
Christian


For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts: