diff --git a/src/mid.cpp b/src/mid.cpp index e45e5f4d..0f650b52 100644 --- a/src/mid.cpp +++ b/src/mid.cpp @@ -143,9 +143,9 @@ CmidPlayer::CmidPlayer(Copl *newopl) { } -unsigned char CmidPlayer::datalook(long pos) +unsigned char CmidPlayer::datalook(unsigned long pos) { - if (pos<0 || pos >= flen) return(0); + if (pos >= flen) return(0); return(data[pos]); } @@ -1009,15 +1009,15 @@ void CmidPlayer::rewind(int subsong) if (i) msqtr = 1000000L / i * deltas; i=getnexti(2); - if (i > 0 && i < flen && + if (i > 0 && (unsigned long)i < flen && strnlen((char *)data + i, flen - i) < flen - i) title = (char *)data + i; i=getnexti(2); - if (i > 0 && i < flen && + if (i > 0 && (unsigned long)i < flen && strnlen((char *)data + i, flen - i) < flen - i) author = (char *)data + i; i=getnexti(2); - if (i > 0 && i < flen && + if (i > 0 && (unsigned long)i < flen && strnlen((char *)data + i, flen - i) < flen - i) remarks = (char *)data + i; diff --git a/src/mid.h b/src/mid.h index 3571fb43..d170cbc0 100644 --- a/src/mid.h +++ b/src/mid.h @@ -69,7 +69,7 @@ class CmidPlayer: public CPlayer }; char *author,*title,*remarks,emptystr; - long flen; + unsigned long flen; unsigned long pos; unsigned long sierra_pos; //sierras gotta be special.. :> int subsongs; @@ -98,7 +98,7 @@ class CmidPlayer: public CPlayer private: bool load_sierra_ins(const std::string &fname, const CFileProvider &fp); void midiprintf(const char *format, ...); - unsigned char datalook(long pos); + unsigned char datalook(unsigned long pos); unsigned long getnexti(unsigned long num); unsigned long getnext(unsigned long num); void readString(char *dst, unsigned long num);