Skip to content
  • Alan Coopersmith's avatar
    Clean up some clang warnings about sign conversion · 4d43b455
    Alan Coopersmith authored
    fread & fwrite are defined as taking size_t arguments (an unsigned type),
    so stop casting their arguments to a signed int just to confuse things.
    
    Fixes warnings:
    
    AuFileName.c:69:59: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
        size = strlen (name) + strlen(&slashDotXauthority[1]) + 2;
             ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
    
    AuRead.c:58:44: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
            if (fread (data, (int) sizeof (char), (int) len, file) != len) {
                ~~~~~                             ^~~~~~~~~
    
    AuWrite.c:49:46: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
        if (fwrite (string, (int) sizeof (char), (int) count, file) != count)
            ~~~~~~                               ^~~~~~~~~~~
    
    Signed-off-by: Alan Coopersmith <alan.coopersm...
    4d43b455