From 29b3ea91e60d94497184a304797a58413f1ec9a8 Mon Sep 17 00:00:00 2001 From: rnv Date: Tue, 11 Aug 2020 14:38:51 +0300 Subject: [PATCH] Suppress compilation warnings. --- src/Basics/BasicsGenericDestructor.cxx | 2 +- src/Basics/Basics_DirUtils.cxx | 6 +++--- src/Basics/Basics_Utils.cxx | 8 ++++---- src/Basics/Basics_Utils.hxx | 1 + src/HDFPersist/HDFattrCreate.c | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Basics/BasicsGenericDestructor.cxx b/src/Basics/BasicsGenericDestructor.cxx index e2aa0dcb3..dc811ee66 100644 --- a/src/Basics/BasicsGenericDestructor.cxx +++ b/src/Basics/BasicsGenericDestructor.cxx @@ -196,5 +196,5 @@ const int GENERIC_DESTRUCTOR::Add(GENERIC_DESTRUCTOR &anObject) } assert(Destructors); Destructors->push_back(&anObject); - return Destructors->size(); + return (int)Destructors->size(); } diff --git a/src/Basics/Basics_DirUtils.cxx b/src/Basics/Basics_DirUtils.cxx index 90079b283..dee7639da 100644 --- a/src/Basics/Basics_DirUtils.cxx +++ b/src/Basics/Basics_DirUtils.cxx @@ -54,7 +54,7 @@ namespace Kernel_Utils std::string GetBaseName( const std::string& file_path, const bool with_extension ) { std::string tmp_str = file_path; - int pos = file_path.rfind( _separator_ ); + auto pos = file_path.rfind( _separator_ ); if ( pos >= 0 ) tmp_str = pos < (int)file_path.size()-1 ? file_path.substr( pos+1 ) : ""; @@ -67,7 +67,7 @@ namespace Kernel_Utils std::string GetDirName( const std::string& file_path ) { - int pos = file_path.rfind( _separator_ ); + auto pos = file_path.rfind( _separator_ ); if ( pos >= 0 ) return pos < (int)file_path.size()-1 ? file_path.substr(0, pos ) : ""; return std::string("."); @@ -190,7 +190,7 @@ namespace Kernel_Utils std::string AddExtension( const std::string& name ) { std::string tmp_str = name; - int pos = tmp_str.rfind( _extension_ ); + auto pos = tmp_str.rfind( _extension_ ); if( pos < 0 ) return tmp_str.append( _extension_ ); return tmp_str; diff --git a/src/Basics/Basics_Utils.cxx b/src/Basics/Basics_Utils.cxx index 2ef4de8e0..15f598427 100644 --- a/src/Basics/Basics_Utils.cxx +++ b/src/Basics/Basics_Utils.cxx @@ -184,9 +184,9 @@ namespace Kernel_Utils char* utf8_encode(const wchar_t* encoded) { if (encoded == NULL) return NULL; - int size_needed = WideCharToMultiByte(CP_UTF8, 0, encoded, std::wcslen(encoded), NULL, 0, NULL, NULL); + auto size_needed = WideCharToMultiByte(CP_UTF8, 0, encoded, (int)std::wcslen(encoded), NULL, 0, NULL, NULL); char* strTo = new char[ size_needed + 1 ]; - WideCharToMultiByte(CP_UTF8, 0, encoded, std::wcslen(encoded), strTo, size_needed, NULL, NULL); + WideCharToMultiByte(CP_UTF8, 0, encoded, (int)std::wcslen(encoded), strTo, size_needed, NULL, NULL); strTo[size_needed] = '\0'; return strTo; } @@ -194,9 +194,9 @@ namespace Kernel_Utils wchar_t* utf8_decode(const char* decoded) { if (decoded == NULL) return NULL; - int size_needed = MultiByteToWideChar(CP_UTF8, 0, decoded, strlen(decoded), NULL, 0); + auto size_needed = MultiByteToWideChar(CP_UTF8, 0, decoded, (int)strlen(decoded), NULL, 0); wchar_t* wstrTo = new wchar_t[ size_needed + 1 ]; - MultiByteToWideChar(CP_UTF8, 0, decoded, strlen(decoded), wstrTo, size_needed); + MultiByteToWideChar(CP_UTF8, 0, decoded, (int)strlen(decoded), wstrTo, size_needed); wstrTo[size_needed] = '\0'; return wstrTo; } diff --git a/src/Basics/Basics_Utils.hxx b/src/Basics/Basics_Utils.hxx index 2b2d676f4..387514396 100644 --- a/src/Basics/Basics_Utils.hxx +++ b/src/Basics/Basics_Utils.hxx @@ -34,6 +34,7 @@ #else #include #pragma comment(lib,"winmm.lib") +#pragma warning (disable : 4251) #endif diff --git a/src/HDFPersist/HDFattrCreate.c b/src/HDFPersist/HDFattrCreate.c index 6d6f75b2f..d9b788716 100644 --- a/src/HDFPersist/HDFattrCreate.c +++ b/src/HDFPersist/HDFattrCreate.c @@ -43,7 +43,7 @@ hdf_idt HDFattrCreate(hdf_idt pid,char *name,hdf_type type, size_t size) { hdf_idt aid,attr; hdf_err ret; - int type_hdf; + hid_t type_hdf; switch(type) { case HDF_FLOAT64 : -- 2.39.2