From a65fd93119bdf33d4f8750f5fdcb7483f09c78d5 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Tue, 3 Oct 2006 01:02:44 +0000 Subject: [PATCH] minor syntax --- src/flac/utils.c | 2 +- src/libFLAC/metadata_object.c | 4 ++-- src/libFLAC/window.c | 26 +++++++++++++------------- src/share/grabbag/picture.c | 2 +- test/test_metaflac.sh | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/flac/utils.c b/src/flac/utils.c index ddc64b62..50e672ab 100644 --- a/src/flac/utils.c +++ b/src/flac/utils.c @@ -113,7 +113,7 @@ static FLAC__bool local__parse_cue_(const char *s, const char *end, unsigned *tr } /* - * @@@ this only works with sorted cuesheets (the spec strongly recommends but + * this only works with sorted cuesheets (the spec strongly recommends but * does not require sorted cuesheets). but if it's not sorted, picking a * nearest cue point has no significance. */ diff --git a/src/libFLAC/metadata_object.c b/src/libFLAC/metadata_object.c index 55b00de2..17267874 100644 --- a/src/libFLAC/metadata_object.c +++ b/src/libFLAC/metadata_object.c @@ -110,8 +110,8 @@ static FLAC__bool ensure_null_terminated_(FLAC__byte **entry, unsigned length) */ static FLAC__bool copy_cstring_(char **to, const char *from) { - FLAC__ASSERT(to); char *copy = strdup(from); + FLAC__ASSERT(to); if(copy) { if(*to) free(*to); @@ -1111,7 +1111,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_point i = seek_table->num_points; - if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + num)) + if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + (unsigned)num)) return false; sample = 0; diff --git a/src/libFLAC/window.c b/src/libFLAC/window.c index 04cd662c..1a30cb19 100644 --- a/src/libFLAC/window.c +++ b/src/libFLAC/window.c @@ -71,7 +71,7 @@ void FLAC__window_bartlett_hann(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = 0.62f - 0.48f * fabs((float)n/(float)N+0.5f) + 0.38f * cos(2.0f * M_PI * ((float)n/(float)N+0.5f)); + window[n] = (FLAC__real)(0.62f - 0.48f * fabs((float)n/(float)N+0.5f) + 0.38f * cos(2.0f * M_PI * ((float)n/(float)N+0.5f))); } void FLAC__window_blackman(FLAC__real *window, const FLAC__int32 L) @@ -80,7 +80,7 @@ void FLAC__window_blackman(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = 0.42f - 0.5f * cos(2.0f * M_PI * n / N) + 0.08f * cos(4.0f * M_PI * n / N); + window[n] = (FLAC__real)(0.42f - 0.5f * cos(2.0f * M_PI * n / N) + 0.08f * cos(4.0f * M_PI * n / N)); } /* 4-term -92dB side-lobe */ @@ -90,7 +90,7 @@ void FLAC__window_blackman_harris_4term_92db_sidelobe(FLAC__real *window, const FLAC__int32 n; for (n = 0; n <= N; n++) - window[n] = 0.35875f - 0.48829f * cos(2.0f * M_PI * n / N) + 0.14128f * cos(4.0f * M_PI * n / N) - 0.01168f * cos(6.0f * M_PI * n / N); + window[n] = (FLAC__real)(0.35875f - 0.48829f * cos(2.0f * M_PI * n / N) + 0.14128f * cos(4.0f * M_PI * n / N) - 0.01168f * cos(6.0f * M_PI * n / N)); } void FLAC__window_connes(FLAC__real *window, const FLAC__int32 L) @@ -102,7 +102,7 @@ void FLAC__window_connes(FLAC__real *window, const FLAC__int32 L) for (n = 0; n <= N; n++) { double k = ((double)n - N2) / N2; k = 1.0f - k * k; - window[n] = k * k; + window[n] = (FLAC__real)(k * k); } } @@ -112,7 +112,7 @@ void FLAC__window_flattop(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = 1.0f - 1.93f * cos(2.0f * M_PI * n / N) + 1.29f * cos(4.0f * M_PI * n / N) - 0.388f * cos(6.0f * M_PI * n / N) + 0.0322f * cos(8.0f * M_PI * n / N); + window[n] = (FLAC__real)(1.0f - 1.93f * cos(2.0f * M_PI * n / N) + 1.29f * cos(4.0f * M_PI * n / N) - 0.388f * cos(6.0f * M_PI * n / N) + 0.0322f * cos(8.0f * M_PI * n / N)); } void FLAC__window_gauss(FLAC__real *window, const FLAC__int32 L, const FLAC__real stddev) @@ -123,7 +123,7 @@ void FLAC__window_gauss(FLAC__real *window, const FLAC__int32 L, const FLAC__rea for (n = 0; n <= N; n++) { const double k = ((double)n - N2) / (stddev * N2); - window[n] = exp(-0.5f * k * k); + window[n] = (FLAC__real)exp(-0.5f * k * k); } } @@ -133,7 +133,7 @@ void FLAC__window_hamming(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = 0.54f - 0.46f * cos(2.0f * M_PI * n / N); + window[n] = (FLAC__real)(0.54f - 0.46f * cos(2.0f * M_PI * n / N)); } void FLAC__window_hann(FLAC__real *window, const FLAC__int32 L) @@ -142,7 +142,7 @@ void FLAC__window_hann(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = 0.5f - 0.5f * cos(2.0f * M_PI * n / N); + window[n] = (FLAC__real)(0.5f - 0.5f * cos(2.0f * M_PI * n / N)); } void FLAC__window_kaiser_bessel(FLAC__real *window, const FLAC__int32 L) @@ -151,7 +151,7 @@ void FLAC__window_kaiser_bessel(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = 0.402f - 0.498f * cos(2.0f * M_PI * n / N) + 0.098f * cos(4.0f * M_PI * n / N) - 0.001f * cos(6.0f * M_PI * n / N); + window[n] = (FLAC__real)(0.402f - 0.498f * cos(2.0f * M_PI * n / N) + 0.098f * cos(4.0f * M_PI * n / N) - 0.001f * cos(6.0f * M_PI * n / N)); } void FLAC__window_nuttall(FLAC__real *window, const FLAC__int32 L) @@ -160,7 +160,7 @@ void FLAC__window_nuttall(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = 0.3635819f - 0.4891775f*cos(2.0f*M_PI*n/N) + 0.1365995f*cos(4.0f*M_PI*n/N) - 0.0106411f*cos(6.0f*M_PI*n/N); + window[n] = (FLAC__real)(0.3635819f - 0.4891775f*cos(2.0f*M_PI*n/N) + 0.1365995f*cos(4.0f*M_PI*n/N) - 0.0106411f*cos(6.0f*M_PI*n/N)); } void FLAC__window_rectangle(FLAC__real *window, const FLAC__int32 L) @@ -203,8 +203,8 @@ void FLAC__window_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__rea /* ...replace ends with hann */ if (Np > 0) { for (n = 0; n <= Np; n++) { - window[n] = 0.5f - 0.5f * cos(M_PI * n / Np); - window[L-Np-1+n] = 0.5f - 0.5f * cos(M_PI * (n+Np) / Np); + window[n] = (FLAC__real)(0.5f - 0.5f * cos(M_PI * n / Np)); + window[L-Np-1+n] = (FLAC__real)(0.5f - 0.5f * cos(M_PI * (n+Np) / Np)); } } } @@ -218,7 +218,7 @@ void FLAC__window_welch(FLAC__real *window, const FLAC__int32 L) for (n = 0; n <= N; n++) { const double k = ((double)n - N2) / N2; - window[n] = 1.0f - k * k; + window[n] = (FLAC__real)(1.0f - k * k); } } diff --git a/src/share/grabbag/picture.c b/src/share/grabbag/picture.c index 6137447f..4ef00d82 100644 --- a/src/share/grabbag/picture.c +++ b/src/share/grabbag/picture.c @@ -340,7 +340,7 @@ FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, con if(0 == f) *error_message = error_messages[5]; else { - if(fread(buffer, 1, size, f) != size) + if(fread(buffer, 1, size, f) != (size_t)size) *error_message = error_messages[6]; fclose(f); if(0 == *error_message) { diff --git a/test/test_metaflac.sh b/test/test_metaflac.sh index 1151878d..838ef6b5 100755 --- a/test/test_metaflac.sh +++ b/test/test_metaflac.sh @@ -351,7 +351,7 @@ for f in \ metaflac_test "case$ncase" "--import-picture" "--list" ncase=`expr $ncase + 1` done -[ $ncase == 60 ] || die "expected case# to be 60" +[ $ncase = 60 ] || die "expected case# to be 60" run_metaflac --remove --block-type=PICTURE $flacfile check_flac metaflac_test case60 "--remove --block-type=PICTURE" "--list"