You are here: Home » Topic » gcc warning about type punned pointers and patch

gcc warning about type punned pointers and patch

This topic contains 1 reply, has 1 voice, and was last updated by  rpedde 11 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #199

    pietu

    I’ve been compiling nightlies for a while and my FC4box gives annoying information about referencing type punned pointer.

    dispatch.c:964: warning: dereferencing type-punned pointer will break strict-aliasing rules
    dispatch.c:893: warning: dereferencing type-punned pointer will break strict-alliasing rules

    I just googled “type punning” and found some kind solution to fix it. I’m not a coder so this “patch” may break something ? Anyway I’m using it right now and as far as I know it works…

    — src/dispatch.c 2006-03-07 09:04:33.000000000 +0200
    +++ src/dispatch.c 2006-03-11 09:17:19.000000000 +0200
    @@ -890,7 +890,7 @@
    tempstring=strdup(ws_getvar(pwsc,”dmap.itemid”));
    current=(unsigned char*)tempstring;

    – while((token=strsep((char**)&current,”,”))) {
    + while((token=strsep((char**) (char*)&current,”,”))) {
    if(token) {
    /* FIXME: error handling */
    db_add_playlist_item(NULL,pqi->playlist_id,atoi(token));
    @@ -961,7 +961,7 @@
    tempstring=strdup(ws_getvar(pwsc,”dmap.itemid”));
    current=(unsigned char *)tempstring;

    – while((token=strsep((char**)&current,”,”))) {
    + while((token=strsep((char**) (char *)&current,”,”))) {
    if(token) {
    /* FIXME: Error handling */
    db_delete_playlist_item(NULL,pqi->playlist_id,atoi(token));

    #4096

    rpedde
    Participant

    in cvs. Thanks.

    — Ron

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.