music_mod.c
branchSDL-1.2
changeset 865 3ffb22a2755b
parent 542 3de4970b36d4
     1.1 --- a/music_mod.c	Sat Oct 06 22:41:10 2018 +0300
     1.2 +++ b/music_mod.c	Sat Oct 06 23:20:10 2018 +0300
     1.3 @@ -109,13 +109,13 @@
     1.4  
     1.5  	list = mikmod.MikMod_InfoDriver();
     1.6  	if ( list )
     1.7 -	  free(list);
     1.8 +	  mikmod.MikMod_free(list);
     1.9  	else
    1.10  	  mikmod.MikMod_RegisterDriver(mikmod.drv_nos);
    1.11  
    1.12  	list = mikmod.MikMod_InfoLoader();
    1.13  	if ( list )
    1.14 -	  free(list);
    1.15 +	  mikmod.MikMod_free(list);
    1.16  	else
    1.17  	  mikmod.MikMod_RegisterAllLoaders();
    1.18  
    1.19 @@ -144,18 +144,25 @@
    1.20  typedef struct
    1.21  {
    1.22  	MREADER mr;
    1.23 +	/* struct MREADER in libmikmod <= 3.2.0-beta2
    1.24 +	 * doesn't have iobase members. adding them here
    1.25 +	 * so that if we compile against 3.2.0-beta2, we
    1.26 +	 * can still run OK against 3.2.0b3 and newer. */
    1.27 +	long iobase, prev_iobase;
    1.28  	long offset;
    1.29  	long eof;
    1.30  	SDL_RWops *rw;
    1.31  } LMM_MREADER;
    1.32  
    1.33 -BOOL LMM_Seek(struct MREADER *mr,long to,int dir)
    1.34 +int LMM_Seek(struct MREADER *mr,long to,int dir)
    1.35  {
    1.36  	LMM_MREADER* lmmmr = (LMM_MREADER*)mr;
    1.37  	if ( dir == SEEK_SET ) {
    1.38  		to += lmmmr->offset;
    1.39 +		if (to < lmmmr->offset)
    1.40 +			return -1;
    1.41  	}
    1.42 -	return (SDL_RWseek(lmmmr->rw, to, dir) < lmmmr->offset);
    1.43 +	return (SDL_RWseek(lmmmr->rw, to, dir) < lmmmr->offset)? -1 : 0;
    1.44  }
    1.45  long LMM_Tell(struct MREADER *mr)
    1.46  {