From 281f0e18e6ccd5a2e913396cb7cda0529929d3c4 Mon Sep 17 00:00:00 2001 From: gmvbif Date: Mon, 28 Dec 2015 11:21:02 +0300 Subject: [PATCH] Fixed some errors from PVS-Studio in Core project FixedSizeQueue - Added private operator= - Changed signature of EndPop Some changed to printf like functions. Fixed typo in syn-att.c --- Common/FixedSizeQueue.h | 5 +++-- Core/Dialog/SavedataParam.cpp | 2 +- Core/MIPS/MIPSInt.cpp | 6 +++--- GPU/Common/VertexDecoderCommon.h | 2 +- ext/udis86/syn-att.c | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Common/FixedSizeQueue.h b/Common/FixedSizeQueue.h index b1381b4c45..60532cc693 100644 --- a/Common/FixedSizeQueue.h +++ b/Common/FixedSizeQueue.h @@ -165,7 +165,8 @@ private: int count_; // sacrifice 4 bytes for a simpler implementation. may optimize away in the future. // Make copy constructor private for now. - FixedSizeQueue(FixedSizeQueue &other) { } + FixedSizeQueue(FixedSizeQueue &other); + FixedSizeQueue& operator=(const FixedSizeQueue &other); }; @@ -210,7 +211,7 @@ public: T *BeginPop() { return blocks[curReadBlock]; } - T *EndPop() { + void EndPop() { curReadBlock++; if (curReadBlock == NUM_BLOCKS) curReadBlock = 0; diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index 169fde45cd..463715de81 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -916,7 +916,7 @@ std::string SavedataParam::GetSpaceText(u64 size) size /= 1024; } - snprintf(text, sizeof(text), "%lld TB", size); + snprintf(text, sizeof(text), "%llu TB", size); return std::string(text); } diff --git a/Core/MIPS/MIPSInt.cpp b/Core/MIPS/MIPSInt.cpp index 60ce72b299..e2692b7cb1 100644 --- a/Core/MIPS/MIPSInt.cpp +++ b/Core/MIPS/MIPSInt.cpp @@ -834,14 +834,14 @@ namespace MIPSInt { case 36: // mfic if (!reported) { - Reporting::ReportMessage("MFIC instruction hit (%08x) at %08x", op, currentMIPS->pc); + Reporting::ReportMessage("MFIC instruction hit (%08x) at %08x", op.encoding, currentMIPS->pc); WARN_LOG(CPU,"MFIC Disable/Enable Interrupt CPU instruction"); reported = 1; } break; case 38: // mtic if (!reported) { - Reporting::ReportMessage("MTIC instruction hit (%08x) at %08x", op, currentMIPS->pc); + Reporting::ReportMessage("MTIC instruction hit (%08x) at %08x", op.encoding, currentMIPS->pc); WARN_LOG(CPU,"MTIC Disable/Enable Interrupt CPU instruction"); reported = 1; } @@ -1027,7 +1027,7 @@ namespace MIPSInt { case 0: if (!reported) { - Reporting::ReportMessage("INTERRUPT instruction hit (%08x) at %08x", op, currentMIPS->pc); + Reporting::ReportMessage("INTERRUPT instruction hit (%08x) at %08x", op.encoding, currentMIPS->pc); WARN_LOG(CPU,"Disable/Enable Interrupt CPU instruction"); reported = 1; } diff --git a/GPU/Common/VertexDecoderCommon.h b/GPU/Common/VertexDecoderCommon.h index 119a2cac3b..8b7bd4db32 100644 --- a/GPU/Common/VertexDecoderCommon.h +++ b/GPU/Common/VertexDecoderCommon.h @@ -375,7 +375,7 @@ public: case DEC_U16_4: for (int i = 0; i < 4; i++) weights[i] = s[i] * (1.f / 32768.f); break; default: ERROR_LOG_REPORT_ONCE(fmtw0, G3D, "Reader: Unsupported W0 Format %d", decFmt_.w0fmt); - memset(weights, 0, sizeof(float) * 4); + memset(weights, 0, sizeof(float) * 8); break; } diff --git a/ext/udis86/syn-att.c b/ext/udis86/syn-att.c index cc598389e2..d1ba89b7ae 100644 --- a/ext/udis86/syn-att.c +++ b/ext/udis86/syn-att.c @@ -157,7 +157,7 @@ ud_translate_att(struct ud *u) ud_asmprintf(u, "lock "); if (u->pfx_rep) { ud_asmprintf(u, "rep "); - } else if (u->pfx_rep) { + } else if (u->pfx_repe) { ud_asmprintf(u, "repe "); } else if (u->pfx_repne) { ud_asmprintf(u, "repne ");