fix a clang -Wnon-literal-null-conversion warning. SDL-1.2
authorOzkan Sezer <sezeroz@gmail.com>
Sun, 07 Oct 2018 14:00:02 +0300
branchSDL-1.2
changeset 89547ff529172c8
parent 894 77d5b8c518e7
child 896 e97f5947aa93
fix a clang -Wnon-literal-null-conversion warning.

also tidied-up some whitespace.
music.c
     1.1 --- a/music.c	Sun Oct 07 12:41:20 2018 +0300
     1.2 +++ b/music.c	Sun Oct 07 14:00:02 2018 +0300
     1.3 @@ -289,10 +289,10 @@
     1.4  #ifdef MID_MUSIC
     1.5  			case MUS_MID:
     1.6  #ifdef USE_NATIVE_MIDI
     1.7 -  				if ( native_midi_ok ) {
     1.8 +				if ( native_midi_ok ) {
     1.9  					/* Native midi is handled asynchronously */
    1.10  					goto skip;
    1.11 -	  			}
    1.12 +				}
    1.13  #endif
    1.14  #ifdef USE_FLUIDSYNTH_MIDI
    1.15  				if ( fluidsynth_ok ) {
    1.16 @@ -303,7 +303,7 @@
    1.17  #ifdef USE_TIMIDITY_MIDI
    1.18  				if ( timidity_ok ) {
    1.19  					int samples = len / samplesize;
    1.20 -  					Timidity_PlaySome(stream, samples);
    1.21 +					Timidity_PlaySome(stream, samples);
    1.22  					goto skip;
    1.23  				}
    1.24  #endif
    1.25 @@ -623,7 +623,7 @@
    1.26  			if (SDL_RWread(rw, magic, 1, 4) != 4) {
    1.27  				Mix_SetError("Couldn't read from RWops");
    1.28  				SDL_free(music);
    1.29 -				return MUS_NONE;
    1.30 +				return NULL;
    1.31  			}
    1.32  			SDL_RWseek(rw, start, RW_SEEK_SET);
    1.33  			magic[4] = '\0';
    1.34 @@ -685,9 +685,9 @@
    1.35  #ifdef USE_NATIVE_MIDI
    1.36  		if ( native_midi_ok ) {
    1.37  			music->data.nativemidi = native_midi_loadsong_RW(rw, freesrc);
    1.38 -	  		if ( music->data.nativemidi == NULL ) {
    1.39 -		  		Mix_SetError("%s", native_midi_error());
    1.40 -			  	music->error = 1;
    1.41 +			if ( music->data.nativemidi == NULL ) {
    1.42 +				Mix_SetError("%s", native_midi_error());
    1.43 +				music->error = 1;
    1.44  			}
    1.45  			break;
    1.46  		}
    1.47 @@ -744,10 +744,9 @@
    1.48  		music->error=1;
    1.49  	} /* switch (want) */
    1.50  
    1.51 -
    1.52  	if (music->error) {
    1.53  		SDL_free(music);
    1.54 -		music=NULL;
    1.55 +		music = NULL;
    1.56  	}
    1.57  	return(music);
    1.58  }
    1.59 @@ -1310,21 +1309,21 @@
    1.60  
    1.61  	SDL_LockAudio();
    1.62  	if ( music_playing) {
    1.63 -                int fade_steps = (ms + ms_per_step - 1)/ms_per_step;
    1.64 -                if ( music_playing->fading == MIX_NO_FADING ) {
    1.65 -	        	music_playing->fade_step = 0;
    1.66 -                } else {
    1.67 -                        int step;
    1.68 -                        int old_fade_steps = music_playing->fade_steps;
    1.69 -                        if ( music_playing->fading == MIX_FADING_OUT ) {
    1.70 -                                step = music_playing->fade_step;
    1.71 -                        } else {
    1.72 -                                step = old_fade_steps
    1.73 -                                        - music_playing->fade_step + 1;
    1.74 -                        }
    1.75 -                        music_playing->fade_step = (step * fade_steps)
    1.76 -                                / old_fade_steps;
    1.77 -                }
    1.78 +		int fade_steps = (ms + ms_per_step - 1)/ms_per_step;
    1.79 +		if ( music_playing->fading == MIX_NO_FADING ) {
    1.80 +			music_playing->fade_step = 0;
    1.81 +		} else {
    1.82 +			int step;
    1.83 +			int old_fade_steps = music_playing->fade_steps;
    1.84 +			if ( music_playing->fading == MIX_FADING_OUT ) {
    1.85 +				step = music_playing->fade_step;
    1.86 +			} else {
    1.87 +				step = old_fade_steps
    1.88 +					 - music_playing->fade_step + 1;
    1.89 +			}
    1.90 +			music_playing->fade_step = (step * fade_steps)
    1.91 +							 / old_fade_steps;
    1.92 +		}
    1.93  		music_playing->fading = MIX_FADING_OUT;
    1.94  		music_playing->fade_steps = fade_steps;
    1.95  		retval = 1;