From cee958b2d318ac263e25b239bc092429245e297d Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Thu, 13 Mar 2008 19:12:55 +0000 Subject: [PATCH] Raised the warning level on MSVC8 to 4, and fixed several warnings caused by that. Originally committed to SVN as r2045. --- aegisub/MatroskaParser.c | 4 ++++ aegisub/MatroskaParser.h | 8 ++++++++ aegisub/audio_karaoke.cpp | 2 +- aegisub/auto4_lua.cpp | 1 + aegisub/auto4_perl.cpp | 4 ++++ aegisub/auto4_perl_script.cpp | 1 + aegisub/charset_detect.cpp | 1 - aegisub/dialog_dummy_video.cpp | 4 ++-- aegisub/main.cpp | 2 +- aegisub/vfw_wrap.cpp | 2 +- aegisub/video_provider_dshow.cpp | 1 + build/aegisub_vs2005/aegisub_vs2005.vcproj | 8 ++++---- 12 files changed, 28 insertions(+), 10 deletions(-) diff --git a/aegisub/MatroskaParser.c b/aegisub/MatroskaParser.c index a4f69cabf..0088f77de 100644 --- a/aegisub/MatroskaParser.c +++ b/aegisub/MatroskaParser.c @@ -35,6 +35,10 @@ #include #include +#ifdef _MSC_VER +#pragma warning(disable: 4701) +#endif + #ifdef _WIN32 // MS names some functions differently #define alloca _alloca diff --git a/aegisub/MatroskaParser.h b/aegisub/MatroskaParser.h index 29e3988c3..d94ac7578 100644 --- a/aegisub/MatroskaParser.h +++ b/aegisub/MatroskaParser.h @@ -32,6 +32,10 @@ #ifndef MATROSKA_PARSER_H #define MATROSKA_PARSER_H +#ifdef _MSC_VER +#pragma warning(disable: 4201) +#endif + /* Random notes: * * The parser does not process frame data in any way and does not read it into @@ -395,4 +399,8 @@ X const char *cs_GetLastError(CompressedStream *cs); #undef X +#ifdef _MSC_VER +#pragma warning(default: 4201) +#endif + #endif diff --git a/aegisub/audio_karaoke.cpp b/aegisub/audio_karaoke.cpp index 1f76c1393..4dea9bf98 100644 --- a/aegisub/audio_karaoke.cpp +++ b/aegisub/audio_karaoke.cpp @@ -653,7 +653,7 @@ void AudioKaraoke::EndSplit(bool commit) { wxLogDebug(_T("AudioKaraoke::EndSplit(commit=%d)"), commit?1:0); splitting = false; bool hasSplit = false; - size_t first_sel = ~0; + size_t first_sel = ~0U; for (size_t i = 0; i < syllables.size(); i ++) { if (syllables[i].pending_splits.size() > 0) { if (commit) { diff --git a/aegisub/auto4_lua.cpp b/aegisub/auto4_lua.cpp index 47c1056c9..a9d8e6bdc 100644 --- a/aegisub/auto4_lua.cpp +++ b/aegisub/auto4_lua.cpp @@ -664,6 +664,7 @@ namespace Automation4 { if (has_config && config_dialog) { int results_produced = config_dialog->LuaReadBack(L); assert(results_produced == 1); + (void) results_produced; // avoid warning on release builds // TODO, write back stored options here } else { // no config so put an empty table instead diff --git a/aegisub/auto4_perl.cpp b/aegisub/auto4_perl.cpp index a4f5fb204..d0214e39c 100644 --- a/aegisub/auto4_perl.cpp +++ b/aegisub/auto4_perl.cpp @@ -43,6 +43,10 @@ #include "options.h" #include "ass_style.h" +#ifdef __VISUALC__ +#pragma warning(disable: 4800) +#pragma warning(disable: 4706) +#endif #define COLLECT_PV(buf, s, e) \ buf = wxString(SvPV_nolen(ST(s)), pl2wx);\ diff --git a/aegisub/auto4_perl_script.cpp b/aegisub/auto4_perl_script.cpp index caec1b940..f98ec8d42 100644 --- a/aegisub/auto4_perl_script.cpp +++ b/aegisub/auto4_perl_script.cpp @@ -46,6 +46,7 @@ #ifdef __VISUALC__ #pragma warning(disable: 4800) +#pragma warning(disable: 4706) #endif diff --git a/aegisub/charset_detect.cpp b/aegisub/charset_detect.cpp index e43f087f4..79e0cda51 100644 --- a/aegisub/charset_detect.cpp +++ b/aegisub/charset_detect.cpp @@ -101,7 +101,6 @@ wxString CharSetDetect::GetEncoding(wxString filename) { results.sort(); // Get choice from user - int n = results.size(); wxArrayString choices; wxArrayString picked; int i = 0; diff --git a/aegisub/dialog_dummy_video.cpp b/aegisub/dialog_dummy_video.cpp index d0a54cfe8..af84bf1c6 100644 --- a/aegisub/dialog_dummy_video.cpp +++ b/aegisub/dialog_dummy_video.cpp @@ -238,9 +238,9 @@ void DialogDummyVideo::OnLengthChange(wxCommandEvent &evt) void DialogDummyVideo::UpdateLengthDisplay() { double fpsval; - int lengthval = 0; + int lengthval = length->GetValue(); if (!length_display) return; - if ((fps->GetValue().ToDouble(&fpsval)) && (lengthval = length->GetValue()) && fpsval > 0 && lengthval > 0) { + if ((fps->GetValue().ToDouble(&fpsval)) && fpsval > 0 && lengthval > 0) { int tt = int(lengthval / fpsval * 1000); // frames / (frames/seconds) * 1000 = milliseconds // 32 bit signed int can hold almost 600 positive hours when counting milliseconds, ASS allows at most just below 10 hours, so we're safe int ms, s, m, h; diff --git a/aegisub/main.cpp b/aegisub/main.cpp index 1fa11ac04..f994e9627 100644 --- a/aegisub/main.cpp +++ b/aegisub/main.cpp @@ -117,7 +117,7 @@ void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) { // Gets called when application starts, creates MainFrame bool AegisubApp::OnInit() { #ifdef __VISUALC__ - SetThreadName(-1,"AegiMain"); + SetThreadName((DWORD) -1,"AegiMain"); #endif StartupLog(_T("Inside OnInit")); diff --git a/aegisub/vfw_wrap.cpp b/aegisub/vfw_wrap.cpp index fb728b437..f8d29b906 100644 --- a/aegisub/vfw_wrap.cpp +++ b/aegisub/vfw_wrap.cpp @@ -78,7 +78,7 @@ wxArrayInt VFWWrapper::GetKeyFrames(wxString filename) { // Loop through stream for (size_t i=0;i #ifdef __WINDOWS__ #include diff --git a/build/aegisub_vs2005/aegisub_vs2005.vcproj b/build/aegisub_vs2005/aegisub_vs2005.vcproj index 6b0fd0e47..a4ee4ee39 100644 --- a/build/aegisub_vs2005/aegisub_vs2005.vcproj +++ b/build/aegisub_vs2005/aegisub_vs2005.vcproj @@ -52,11 +52,11 @@ OpenMP="true" UsePrecompiledHeader="2" PrecompiledHeaderThrough="stdwx.h" - WarningLevel="3" + WarningLevel="4" WarnAsError="true" Detect64BitPortabilityProblems="true" DebugInformationFormat="4" - DisableSpecificWarnings="4267" + DisableSpecificWarnings="4267,4100,4428" ForcedIncludeFiles="stdwx.h;config.h" />