From c6b3f5a4d05fb69580bee4cca83e535e1176147f Mon Sep 17 00:00:00 2001 From: Franck Galpin <franck.galpin@interdigital.com> Date: Mon, 19 Dec 2022 18:43:47 +0100 Subject: [PATCH] port all fixes from 4ab2c57b to solve build issues --- source/Lib/CommonLib/Quant.cpp | 2 +- source/Lib/CommonLib/TypeDef.h | 2 +- source/Lib/DecoderLib/SEIread.cpp | 5 ++++- source/Lib/Utilities/program_options_lite.h | 16 ++++++++-------- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/source/Lib/CommonLib/Quant.cpp b/source/Lib/CommonLib/Quant.cpp index 789dad2c1a..5c168103f9 100644 --- a/source/Lib/CommonLib/Quant.cpp +++ b/source/Lib/CommonLib/Quant.cpp @@ -1129,7 +1129,7 @@ void Quant::transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &co */ const int iQBits = QUANT_SHIFT + cQP.per(useTransformSkip) + (useTransformSkip ? 0 : iTransformShift); // QBits will be OK for any internal bit depth as the reduction in transform shift is balanced by an increase in Qp_per due to QpBDOffset - const int iAdd = int64_t(bUseHalfRoundingPoint ? 256 : (tu.cs->slice->isIRAP() ? 171 : 85)) << int64_t(iQBits - 9); + const int64_t iAdd = int64_t(bUseHalfRoundingPoint ? 256 : (tu.cs->slice->isIRAP() ? 171 : 85)) << int64_t(iQBits - 9); TCoeff transformedCoefficient; // transform-skip diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index c60e0a651a..4c0978a281 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -41,7 +41,7 @@ #ifndef __COMMONDEF__ #error Include CommonDef.h not TypeDef.h #endif - +#include <array> #include <vector> #include <utility> #include <sstream> diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index d5c9931022..05681b605c 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -100,7 +100,10 @@ static inline void output_sei_message_header(SEI &sei, std::ostream *pDecodedMes if (pDecodedMessageOutputStream) { std::string seiMessageHdr(SEI::getSEIMessageString(sei.payloadType())); seiMessageHdr+=" SEI message"; - (*pDecodedMessageOutputStream) << std::setfill('-') << std::setw(seiMessageHdr.size()) << "-" << std::setfill(' ') << "\n" << seiMessageHdr << " (" << payloadSize << " bytes)"<< "\n"; + (*pDecodedMessageOutputStream) << std::setfill('-') << std::setw((int) seiMessageHdr.size()) << "-" + << std::setfill(' ') << "\n" + << seiMessageHdr << " (" << payloadSize << " bytes)" + << "\n"; } } diff --git a/source/Lib/Utilities/program_options_lite.h b/source/Lib/Utilities/program_options_lite.h index 6fc3dd3378..e182354e00 100644 --- a/source/Lib/Utilities/program_options_lite.h +++ b/source/Lib/Utilities/program_options_lite.h @@ -239,15 +239,15 @@ namespace df std::string cNameBuffer; std::string cDescriptionBuffer; - for (unsigned int uiK = 0; uiK < uiMaxNum; uiK++) + for (unsigned int k = 0; k < uiMaxNum; k++) { // it needs to be reset when extra digit is added, e.g. number 10 and above cNameBuffer.resize(name.size() + 10); cDescriptionBuffer.resize(desc.size() + 10); // isn't there are sprintf function for string?? - sprintf((char*)cNameBuffer.c_str(), name.c_str(), uiK, uiK); - sprintf((char*)cDescriptionBuffer.c_str(), desc.c_str(), uiK, uiK); + snprintf((char *) cNameBuffer.c_str(), cNameBuffer.size(), name.c_str(), k, k); + snprintf((char *) cDescriptionBuffer.c_str(), cDescriptionBuffer.size(), desc.c_str(), k, k); size_t pos = cNameBuffer.find_first_of('\0'); if (pos != std::string::npos) @@ -255,7 +255,7 @@ namespace df cNameBuffer.resize(pos); } - parent.addOption(new Option<T>(cNameBuffer, (storage[uiK]), default_val, cDescriptionBuffer)); + parent.addOption(new Option<T>(cNameBuffer, (storage[k]), default_val, cDescriptionBuffer)); } return *this; @@ -268,21 +268,21 @@ namespace df std::string cNameBuffer; std::string cDescriptionBuffer; - for (unsigned int uiK = 0; uiK < uiMaxNum; uiK++) + for (unsigned int k = 0; k < uiMaxNum; k++) { // it needs to be reset when extra digit is added, e.g. number 10 and above cNameBuffer.resize(name.size() + 10); cDescriptionBuffer.resize(desc.size() + 10); // isn't there are sprintf function for string?? - sprintf((char*)cNameBuffer.c_str(), name.c_str(), uiK, uiK); - sprintf((char*)cDescriptionBuffer.c_str(), desc.c_str(), uiK, uiK); + snprintf((char *) cNameBuffer.c_str(), cNameBuffer.size(), name.c_str(), k, k); + snprintf((char *) cDescriptionBuffer.c_str(), cDescriptionBuffer.size(), desc.c_str(), k, k); size_t pos = cNameBuffer.find_first_of('\0'); if (pos != std::string::npos) cNameBuffer.resize(pos); - parent.addOption(new Option<T>(cNameBuffer, *(storage[uiK]), default_val, cDescriptionBuffer)); + parent.addOption(new Option<T>(cNameBuffer, *(storage[k]), default_val, cDescriptionBuffer)); } return *this; -- GitLab