[Live-devel] [patch] fix or suppress compiler warnings

Erik Hovland erik at hovland.org
Wed Jul 9 09:45:24 PDT 2008


On Tue, Jul 08, 2008 at 09:56:45PM -0700, Ross Finlayson wrote:
>> On Tue, Jul 08, 2008 at 05:31:59PM -0700, Ross Finlayson wrote:
>>>>  This patch has been checked for
>>>>   > memory leaks since it almost always heap allocates a duplicate string
>>>>   > instead of the = "".
>>>
>>>  I see no reason not to continue to use static string constants. Copying
>>>  them into heap-allocated memory instead (using "strDup()") is  
>>> inefficient and pointless.
>>
>> Understood. I'll submit a new patch that doesn't fix that. When gcc 4.4
>> and the feature is truly deprecated I can rework it.
>
> Perhaps what your compiler is really complaining about is the fact that 
> these string constants are declared
> 	char*
> instead of
> 	char const*
> or
> 	char const* const
>
> Perhaps that's all that's needed to satisfy it?

Yeah, 90% of the time this is true. Here is a new patch that doesn't do
strDup(). Instead it does the const/char* combo that is not deprecated
(and it includes the change because of the deprecated strstream).

There are still warnings because of the const/char* combo. But they are
not has easily fixed. For these few would strDup() be accepted?

For example in liveMedia/RTSPClient.cpp at or about line 849 there is
the line:
char* transportFmt;

And then an if clause that has this a couple of times:
transportFmt = "Transport: RAW/RAW/UDP%s%s%s=%d-%d\r\n";

This throws a compiler warning because this sort of assignment has been
marked deprecated in C99 and C++.

Thanks for the hint, the compiler warning patch is much more reasonable
now.

E

-- 
Erik Hovland
mail: erik at hovland.org
web: http://hovland.org/
PGP/GPG public key available on request
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compiler-warnings.patch
Type: text/x-diff
Size: 16533 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20080709/96ab6902/attachment-0001.bin>


More information about the live-devel mailing list