misc: patch some issues indicated by clang
[pcsx_rearmed.git] / libpcsxcore / misc.c
index 7aa4fef..b3dfdf5 100644 (file)
@@ -55,10 +55,11 @@ struct iso_directory_record {
        char name                       [1];
 };
 
-void mmssdd( char *b, char *p )
+static void mmssdd( char *b, char *p )
 {
        int m, s, d;
-       int block = SWAP32(*((uint32_t*) b));
+       unsigned char *ub = (void *)b;
+       int block = (ub[3] << 24) | (ub[2] << 16) | (ub[1] << 8) | ub[0];
 
        block += 150;
        m = block / 4500;                       // minutes
@@ -89,7 +90,7 @@ void mmssdd( char *b, char *p )
        time[0] = itob(time[0]); time[1] = itob(time[1]); time[2] = itob(time[2]);
 
 #define READTRACK() \
-       if (CDR_readTrack(time) == -1) return -1; \
+       if (!CDR_readTrack(time)) return -1; \
        buf = (void *)CDR_getBuffer(); \
        if (buf == NULL) return -1; \
        else CheckPPFCache((u8 *)buf, time[0], time[1], time[2]);