Ticket #3955: mc-3955-viewer-cleanup-string-conversion-warning.patch

File mc-3955-viewer-cleanup-string-conversion-warning.patch, 2.2 KB (added by and, 4 months ago)
  • src/viewer/datasource.c

    From e1411707ac5d2a890d853d8a595f103e4e07053f Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sat, 5 Jan 2019 19:25:29 +0000
    Subject: [PATCH] (viewer) Cleanup -Wstring-conversion warning
    
    Found by Clang 6.0.1
    
    In file included from ./internal.h:345:
    ./inlines.h:110:20: warning: implicit conversion turns string literal into bool: 'const char [24]' to 'bool' [-Wstring-conversion]
            g_assert (!"Unknown datasource type");
                      ~^~~~~~~~~~~~~~~~~~~~~~~~~
    
    datasource.c:117:20: warning: implicit conversion turns string literal into bool: 'const char [24]' to '_Bool' [-Wstring-conversion]
            g_assert (!"Unknown datasource type");
                      ~^~~~~~~~~~~~~~~~~~~~~~~~~
    
    datasource.c:362:20: warning: implicit conversion turns string literal into bool: 'const char [24]' to '_Bool' [-Wstring-conversion]
            g_assert (!"Unknown datasource type");
                      ~^~~~~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/viewer/datasource.c | 4 ++--
     src/viewer/inlines.h    | 2 +-
     2 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/src/viewer/datasource.c b/src/viewer/datasource.c
    index d5e91dd34..8078b81ea 100644
    a b mcview_get_filesize (WView * view) 
    114114    case DS_STRING: 
    115115        return view->ds_string_len; 
    116116    default: 
    117         g_assert (!"Unknown datasource type"); 
     117        g_assert (FALSE && "Unknown datasource type"); 
    118118        return 0; 
    119119    } 
    120120} 
    mcview_close_datasource (WView * view) 
    359359        MC_PTR_FREE (view->ds_string_data); 
    360360        break; 
    361361    default: 
    362         g_assert (!"Unknown datasource type"); 
     362        g_assert (FALSE && "Unknown datasource type"); 
    363363    } 
    364364    view->datasource = DS_NONE; 
    365365} 
  • src/viewer/inlines.h

    diff --git a/src/viewer/inlines.h b/src/viewer/inlines.h
    index efa3eb10a..0f6c6faac 100644
    a b mcview_get_byte (WView * view, off_t offset, int *retval) 
    107107    case DS_NONE: 
    108108        return mcview_get_byte_none (view, offset, retval); 
    109109    default: 
    110         g_assert (!"Unknown datasource type"); 
     110        g_assert (FALSE && "Unknown datasource type"); 
    111111        return FALSE; 
    112112    } 
    113113}