[Bro-Dev] fixing compiler warnings

Gregor Maier gregor at icir.org
Fri Jan 21 15:04:12 PST 2011


On 1/21/11 13:44 , Seth Hall wrote:
> 
> On Jan 20, 2011, at 8:33 PM, Gregor Maier wrote:
> 
>> On 1/20/11 12:12 , Seth Hall wrote:
>>>
>>> [ 36%] Building CXX object src/CMakeFiles/bro.dir/main.cc.o
>>> /Users/seth/bro/bro.git/src/main.cc: In function ‘int main(int, char**)’:
>>> /Users/seth/bro/bro.git/src/main.cc:415: warning: deprecated conversion from string constant to ‘char*’
>>
>> int main(int argc, char *argv[])
>> might to the trick....
> That was my first inclination too, but the error isn't on that line. :)

Hmm. The error looks to be in this line:
    prefixes.append("");    // "" = "no prefix"
where prefixes is of type "name_list", which is defined in List.h as
PList(char). Thus the append's prototype is "char *". But it seems
converting a string literal to a "char *" now results in this warning
(the prototype would have to be a "const char*")......

I think the quickest hotfix would be

  prefixes.append(strdup(""));
(and add an #include <string.h>)


cu
gregor

-- 
Gregor Maier
<gregor at icir.org>  <gregor at icsi.berkeley.edu>
Int. Computer Science Institute (ICSI)
1947 Center St., Ste. 600
Berkeley, CA 94704, USA
http://www.icir.org/gregor/


More information about the bro-dev mailing list