fix max sample rate checking
authorJosh Coalson <jcoalson@users.sourceforce.net>
Sat, 4 May 2002 17:45:46 +0000 (17:45 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Sat, 4 May 2002 17:45:46 +0000 (17:45 +0000)
src/flac/encode.c
src/flac/main.c

index 0b4ef5f..44590f4 100644 (file)
@@ -216,7 +216,7 @@ int flac__encode_wav(FILE *infile, long infilesize, const char *infilename, cons
                                /* sample rate */
                                if(!read_little_endian_uint32(infile, &xx, false, encoder_wrapper.inbasefilename))
                                        goto wav_abort_;
-                               if(xx == 0 || xx > FLAC__MAX_SAMPLE_RATE) {
+                               if(!FLAC__format_is_valid_sample_rate(xx)) {
                                        fprintf(stderr, "%s: ERROR: unsupported sample rate %u\n", encoder_wrapper.inbasefilename, (unsigned)xx);
                                        goto wav_abort_;
                                }
index 153516e..3d4314f 100644 (file)
@@ -384,7 +384,7 @@ int main(int argc, char *argv[])
                        return long_usage("ERROR: invalid bits per sample '%u' (must be 8/16/24)\n", format_bps);
        }
        if(format_sample_rate >= 0) {
-               if(format_sample_rate == 0 || (unsigned)format_sample_rate > FLAC__MAX_SAMPLE_RATE)
+               if(!FLAC__format_is_valid_sample_rate(format_sample_rate))
                        return long_usage("ERROR: invalid sample rate '%u', must be > 0 and <= %u\n", format_sample_rate, FLAC__MAX_SAMPLE_RATE);
        }
        if(!mode_decode && ((unsigned)blocksize < FLAC__MIN_BLOCK_SIZE || (unsigned)blocksize > FLAC__MAX_BLOCK_SIZE)) {