From 03b1d6b74d13dd51a53d2531becb4137b96fa1ed Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Sun, 27 May 2012 09:39:31 +0000 Subject: A few things MSVC's analyzer found. --- NetEx/NetPeer.cpp | 2 +- Stars45/CampaignSaveGame.cpp | 2 ++ Stars45/FltDlg.cpp | 2 +- Stars45/NetLobbyServer.cpp | 2 +- Stars45/StarServer.cpp | 2 ++ Stars45/Weapon.cpp | 2 +- libpng/png.c | 1 + libpng/pngrtran.c | 1 + nGenEx/Archive.cpp | 1 + nGenEx/AviFile.cpp | 1 + nGenEx/Bitmap.cpp | 1 + nGenEx/Sound.cpp | 2 +- zlib/minigzip.c | 5 +++++ zlib/trees.c | 2 ++ 14 files changed, 21 insertions(+), 5 deletions(-) diff --git a/NetEx/NetPeer.cpp b/NetEx/NetPeer.cpp index 6bf5d18..1992def 100644 --- a/NetEx/NetPeer.cpp +++ b/NetEx/NetPeer.cpp @@ -253,7 +253,7 @@ NetPeer::ComposeGram() hist_indx = 0; g = new(__FILE__,__LINE__) NetGram(addr, user_data, retries); - delete buffer; + delete[] buffer; } } diff --git a/Stars45/CampaignSaveGame.cpp b/Stars45/CampaignSaveGame.cpp index 8320259..c3cefd4 100644 --- a/Stars45/CampaignSaveGame.cpp +++ b/Stars45/CampaignSaveGame.cpp @@ -125,11 +125,13 @@ static char* ParseMultiLine(const char* s) s++; if (*s == 'n') { *p++ = '\n'; +#pragma warning(suppress: 6269) *s++; i--; } else if (*s == '"') { *p++ = '"'; +#pragma warning(suppress: 6269) *s++; i--; } diff --git a/Stars45/FltDlg.cpp b/Stars45/FltDlg.cpp index 920c58e..04ac926 100644 --- a/Stars45/FltDlg.cpp +++ b/Stars45/FltDlg.cpp @@ -228,7 +228,7 @@ FltDlg::UpdateSelection() hangar_list->SetItemText(item, 4, txt); } - else if (hangar->GetState(s) || Hangar::MAINT || + else if (hangar->GetState(s) == Hangar::MAINT || hangar->GetState(s) > Hangar::STORAGE) { FormatTime(txt, hangar->TimeRemaining(s)); hangar_list->SetItemText(item, 4, txt); diff --git a/Stars45/NetLobbyServer.cpp b/Stars45/NetLobbyServer.cpp index 1c3ce30..13ba07b 100644 --- a/Stars45/NetLobbyServer.cpp +++ b/Stars45/NetLobbyServer.cpp @@ -202,7 +202,7 @@ NetLobbyServer::SendMOTD(NetUser* user) Text* line = motd[i]; sprintf_s(buffer, "id %d user \" \" msg \"%s\"", - motd_index++, *line); + motd_index++, line->data()); SendData(user, NET_LOBBY_CHAT, buffer); } diff --git a/Stars45/StarServer.cpp b/Stars45/StarServer.cpp index 96b34a0..daba657 100644 --- a/Stars45/StarServer.cpp +++ b/Stars45/StarServer.cpp @@ -525,6 +525,8 @@ DWORD WINAPI StarServerRestartProc(LPVOID link) CreateProcess("stars.exe", cmdline, 0, 0, 0, 0, 0, 0, &s, &pi); stars->Exit(); + CloseHandle( pi.hProcess ); + CloseHandle( pi.hThread ); return 0; } diff --git a/Stars45/Weapon.cpp b/Stars45/Weapon.cpp index 26e6a8d..4aa402e 100644 --- a/Stars45/Weapon.cpp +++ b/Stars45/Weapon.cpp @@ -410,7 +410,7 @@ const char* Weapon::GetObserverName() const { static char name[256]; - sprintf_s(name, "Weapon %s", design->name); + sprintf_s(name, "Weapon %s", design->name.data()); return name; } diff --git a/libpng/png.c b/libpng/png.c index 7d09b0d..ee45efc 100644 --- a/libpng/png.c +++ b/libpng/png.c @@ -535,6 +535,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_const_timep ptime) 29*png_sizeof(char)); } # else +#pragma warning(suppress: 6340) png_snprintf6(png_ptr->time_buffer, 29, "%d %s %d %02d:%02d:%02d +0000", ptime->day % 32, short_months[(ptime->month - 1) % 12], ptime->year, ptime->hour % 24, ptime->minute % 60, diff --git a/libpng/pngrtran.c b/libpng/pngrtran.c index de5871a..d8b61d6 100644 --- a/libpng/pngrtran.c +++ b/libpng/pngrtran.c @@ -1438,6 +1438,7 @@ png_do_read_transformations(png_structp png_ptr) #ifdef PNG_CONSOLE_IO_SUPPORTED char msg[50]; +#pragma warning(suppress: 6340) png_snprintf2(msg, 50, "NULL row buffer for row %ld, pass %d", (long)png_ptr->row_number, png_ptr->pass); diff --git a/nGenEx/Archive.cpp b/nGenEx/Archive.cpp index cd93640..689ac10 100644 --- a/nGenEx/Archive.cpp +++ b/nGenEx/Archive.cpp @@ -223,6 +223,7 @@ void DataArchive::LoadDatafile(const char* name) fread(dirbuf, header.dir_size_comp, 1, f); int err = uncompress((BYTE*) directory, &len, +#pragma warning(suppress: 6029) dirbuf, header.dir_size_comp); if (err != Z_OK) ZeroMemory(directory, sizeof(DataEntry) * dirsize); diff --git a/nGenEx/AviFile.cpp b/nGenEx/AviFile.cpp index b9c092b..931765d 100644 --- a/nGenEx/AviFile.cpp +++ b/nGenEx/AviFile.cpp @@ -151,6 +151,7 @@ AviFile::AddFrame(const Bitmap& bmp) } } +#pragma warning(suppress: 6001) hr = AVIStreamWrite(ps_comp, nframe, 1, buffer, frame_size, AVIIF_KEYFRAME, 0, 0); if (SUCCEEDED(hr)) { diff --git a/nGenEx/Bitmap.cpp b/nGenEx/Bitmap.cpp index d192d7c..819a083 100644 --- a/nGenEx/Bitmap.cpp +++ b/nGenEx/Bitmap.cpp @@ -231,6 +231,7 @@ Bitmap::BitBlt(int x, int y, const Bitmap& srcBmp, int sx, int sy, int w, int h, Color* src = srcBmp.HiPixels() + (sy*spitch) + sx; for (int i = 0; i < h; i++) { +#pragma warning(suppress: 28183) memcpy(dst, src, rowlen); dst += dpitch; src += spitch; diff --git a/nGenEx/Sound.cpp b/nGenEx/Sound.cpp index 49fdb65..8de0350 100644 --- a/nGenEx/Sound.cpp +++ b/nGenEx/Sound.cpp @@ -113,7 +113,7 @@ Sound::CreateStream(const char* filename) break; default: - delete buf; + delete[] buf; return sound; } } diff --git a/zlib/minigzip.c b/zlib/minigzip.c index 0a58a0a..7524afb 100644 --- a/zlib/minigzip.c +++ b/zlib/minigzip.c @@ -97,6 +97,7 @@ void error(msg) * Compress input to output then close both files. */ +#pragma warning(suppress: 6262) void gz_compress(in, out) FILE *in; gzFile out; @@ -119,6 +120,7 @@ void gz_compress(in, out) } if (len == 0) break; +#pragma warning(suppress: 6029) if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); } fclose(in); @@ -165,6 +167,7 @@ int gz_compress_mmap(in, out) /* =========================================================================== * Uncompress input to output then close both files. */ +#pragma warning(suppress: 6262) void gz_uncompress(in, out) gzFile in; FILE *out; @@ -298,7 +301,9 @@ int main(argc, argv) argc--, argv++; } if (argc == 0) { +#pragma warning(suppress: 6031) SET_BINARY_MODE(stdin); +#pragma warning(suppress: 6031) SET_BINARY_MODE(stdout); if (uncompr) { file = gzdopen(fileno(stdin), "rb"); diff --git a/zlib/trees.c b/zlib/trees.c index 26f3cf1..e968035 100644 --- a/zlib/trees.c +++ b/zlib/trees.c @@ -535,6 +535,7 @@ local void gen_bitlen(s, desc) /* Find the first bit length which could increase: */ do { bits = max_length-1; +#pragma warning(suppress: 6385) while (s->bl_count[bits] == 0) bits--; s->bl_count[bits]--; /* move one leaf down the tree */ s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ @@ -551,6 +552,7 @@ local void gen_bitlen(s, desc) * from 'ar' written by Haruhiko Okumura.) */ for (bits = max_length; bits != 0; bits--) { +#pragma warning(suppress: 6385) n = s->bl_count[bits]; while (n != 0) { m = s->heap[--h]; -- cgit v1.1