From c248ca39f2046559003f0fcab50a9e339206bc57 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Thu, 13 Mar 2008 18:55:09 +0000 Subject: [PATCH] Fixed several warnings on g++. Originally committed to SVN as r2044. --- aegisub/audio_display.cpp | 2 +- aegisub/audio_provider_convert.cpp | 3 --- aegisub/audio_provider_pcm.cpp | 6 +++--- aegisub/audio_spectrum.cpp | 7 ------- aegisub/auto4_ruby.h | 2 ++ aegisub/dialog_dummy_video.cpp | 2 +- aegisub/subtitle_format_dvd.cpp | 9 +++++---- aegisub/utils.cpp | 8 ++++---- aegisub/utils.h | 4 ++-- aegisub/validators.cpp | 4 +++- aegisub/video_context.cpp | 2 +- aegisub/visual_tool_vector_clip.cpp | 20 ++++++++++---------- 12 files changed, 32 insertions(+), 37 deletions(-) diff --git a/aegisub/audio_display.cpp b/aegisub/audio_display.cpp index 714f6da6a..36f720e71 100644 --- a/aegisub/audio_display.cpp +++ b/aegisub/audio_display.cpp @@ -2362,4 +2362,4 @@ void AudioDisplay::UpdateTimeEditCtrls() { grid->editBox->StartTime->SetTime(curStartMS,true); grid->editBox->EndTime->SetTime(curEndMS,true); grid->editBox->Duration->SetTime(curEndMS-curStartMS,true); -} \ No newline at end of file +} diff --git a/aegisub/audio_provider_convert.cpp b/aegisub/audio_provider_convert.cpp index f91c957b0..54e2eb8a4 100644 --- a/aegisub/audio_provider_convert.cpp +++ b/aegisub/audio_provider_convert.cpp @@ -34,9 +34,6 @@ // -#pragma once - - /////////// // Headers #include "audio_provider_convert.h" diff --git a/aegisub/audio_provider_pcm.cpp b/aegisub/audio_provider_pcm.cpp index 949b1ada5..b91430f81 100644 --- a/aegisub/audio_provider_pcm.cpp +++ b/aegisub/audio_provider_pcm.cpp @@ -119,7 +119,7 @@ public: // Read header file.Seek(0); RIFFChunk header; - if (file.Read(&header, sizeof(header)) < sizeof(header)) throw _T("RIFF PCM WAV audio provider: file is too small to contain a RIFF header"); + if (file.Read(&header, sizeof(header)) < (ssize_t) sizeof(header)) throw _T("RIFF PCM WAV audio provider: file is too small to contain a RIFF header"); // Check that it's good if (strncmp(header.ch.type, "RIFF", 4)) throw _T("RIFF PCM WAV audio provider: File is not a RIFF file"); @@ -141,7 +141,7 @@ public: while (data_left) { file.Seek(filepos); ChunkHeader ch; - if (file.Read(&ch, sizeof(ch)) < sizeof(ch)) break; + if (file.Read(&ch, sizeof(ch)) < (ssize_t) sizeof(ch)) break; // Update counters data_left -= sizeof(ch); @@ -152,7 +152,7 @@ public: got_fmt_header = true; fmtChunk fmt; - if (file.Read(&fmt, sizeof(fmt)) < sizeof(fmt)) throw _T("RIFF PCM WAV audio provider: File ended before end of 'fmt ' chunk"); + if (file.Read(&fmt, sizeof(fmt)) < (ssize_t) sizeof(fmt)) throw _T("RIFF PCM WAV audio provider: File ended before end of 'fmt ' chunk"); if (fmt.compression != 1) throw _T("RIFF PCM WAV audio provider: Can't use file, not PCM encoding"); diff --git a/aegisub/audio_spectrum.cpp b/aegisub/audio_spectrum.cpp index 951ec1ebb..585ebd1bf 100644 --- a/aegisub/audio_spectrum.cpp +++ b/aegisub/audio_spectrum.cpp @@ -157,13 +157,6 @@ public: unsigned int overlap_offset = line_length / overlaps * 2; // FIXME: the result seems weird/wrong without this factor 2, but why? - // Raw sample data - short *raw_sample_data = NULL; - float *sample_data = NULL; - // Real and imaginary components of the output - float *out_r = NULL; - float *out_i = NULL; - FFT fft; // Use FFTW instead? A wavelet? for (unsigned int overlap = 0; overlap < overlaps; ++overlap) { diff --git a/aegisub/auto4_ruby.h b/aegisub/auto4_ruby.h index 8538b9352..1d67146bc 100644 --- a/aegisub/auto4_ruby.h +++ b/aegisub/auto4_ruby.h @@ -38,7 +38,9 @@ #ifndef _AUTO4_RUBY_H #define _AUTO4_RUBY_H +#ifdef _MSC_VER #pragma warning(disable: 4311 4312) +#endif #include "auto4_base.h" #include diff --git a/aegisub/dialog_dummy_video.cpp b/aegisub/dialog_dummy_video.cpp index fc11d74fc..d0a54cfe8 100644 --- a/aegisub/dialog_dummy_video.cpp +++ b/aegisub/dialog_dummy_video.cpp @@ -238,7 +238,7 @@ void DialogDummyVideo::OnLengthChange(wxCommandEvent &evt) void DialogDummyVideo::UpdateLengthDisplay() { double fpsval; - int lengthval; + int lengthval = 0; if (!length_display) return; if ((fps->GetValue().ToDouble(&fpsval)) && (lengthval = length->GetValue()) && fpsval > 0 && lengthval > 0) { int tt = int(lengthval / fpsval * 1000); // frames / (frames/seconds) * 1000 = milliseconds diff --git a/aegisub/subtitle_format_dvd.cpp b/aegisub/subtitle_format_dvd.cpp index f4fc67643..a1ab9579f 100644 --- a/aegisub/subtitle_format_dvd.cpp +++ b/aegisub/subtitle_format_dvd.cpp @@ -34,9 +34,6 @@ // -#pragma once - - /////////// // Headers #include "subtitle_format_dvd.h" @@ -102,7 +99,9 @@ void DVDSubtitleFormat::GetSubPictureList(std::vector &pics) { // Write lines int i; +#ifdef _OPENMP #pragma omp parallel for shared(diags,pics,provider) private(i) +#endif for (i=0;i &pics) { AegiVideoFrame dst; dst.CopyFrom(srcFrame); double time = (current->Start.GetMS()/1000.0 + current->End.GetMS()/1000.0)/2.0; +#ifdef _OPENMP #pragma omp critical +#endif { provider->DrawSubtitles(dst,time); } @@ -132,7 +133,7 @@ void DVDSubtitleFormat::GetSubPictureList(std::vector &pics) { for (int y=h;--y>=0;) { bool hasData = false; int lineStartX = 0; - int lineEndX; + int lineEndX = 0; // Scan line for (int x=w;--x>=0;) { diff --git a/aegisub/utils.cpp b/aegisub/utils.cpp index 09baf800e..6c10dad99 100644 --- a/aegisub/utils.cpp +++ b/aegisub/utils.cpp @@ -285,13 +285,13 @@ void GetWordBoundaries(const wxString text,IntPairVector &results,int start,int ///////////////////// // String to integer // wxString::ToLong() is slow and not as flexible -int StringToInt(const wxString &str,size_t start,size_t end) { +int StringToInt(const wxString &str,int start,int end) { // Initialize to zero and get length if end set to -1 int sign = 1; int value = 0; if (end == -1) end = str.Length(); - for (size_t pos=start;posp1.x; - feat.y = cur->p1.y; + feat.x = (int)cur->p1.x; + feat.y = (int)cur->p1.y; feat.type = DRAG_SMALL_CIRCLE; feat.value = i; feat.value2 = 0; @@ -218,8 +218,8 @@ void VisualToolVectorClip::PopulateFeatureList() { // Line if (cur->type == CURVE_LINE) { - feat.x = cur->p2.x; - feat.y = cur->p2.y; + feat.x = (int)cur->p2.x; + feat.y = (int)cur->p2.y; feat.type = DRAG_SMALL_CIRCLE; feat.value = i; feat.value2 = 1; @@ -232,22 +232,22 @@ void VisualToolVectorClip::PopulateFeatureList() { int size = features.size(); // Control points - feat.x = cur->p2.x; - feat.y = cur->p2.y; + feat.x = (int)cur->p2.x; + feat.y = (int)cur->p2.y; feat.value = i; feat.value2 = 1; feat.brother[0] = size-1; feat.type = DRAG_SMALL_SQUARE; features.push_back(feat); - feat.x = cur->p3.x; - feat.y = cur->p3.y; + feat.x = (int)cur->p3.x; + feat.y = (int)cur->p3.y; feat.value2 = 2; feat.brother[0] = size+2; features.push_back(feat); // End point - feat.x = cur->p4.x; - feat.y = cur->p4.y; + feat.x = (int)cur->p4.x; + feat.y = (int)cur->p4.y; feat.type = DRAG_SMALL_CIRCLE; feat.value2 = 3; features.push_back(feat);