Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cpp Core Check #627

Open
wants to merge 192 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
168f96d
Cpp Core Check
srz-zumix Nov 9, 2021
df5cfa0
vs2019
srz-zumix Nov 9, 2021
3167124
up
srz-zumix Nov 10, 2021
a0e9540
fix
srz-zumix Nov 11, 2021
7539aa5
oops
srz-zumix Nov 11, 2021
bb5f397
up
srz-zumix Nov 12, 2021
cb3e92e
up
srz-zumix Nov 12, 2021
0fd47ba
NULL to IUTEST_NULLPTR
srz-zumix Nov 13, 2021
efeda46
inherit
srz-zumix Nov 14, 2021
c89a653
ForceImportBeforeCppTargets
srz-zumix Nov 14, 2021
c415873
add options
srz-zumix Nov 15, 2021
764faeb
fix path
srz-zumix Nov 15, 2021
e23d7d6
up
srz-zumix Nov 17, 2021
e4a9c8d
up
srz-zumix Nov 17, 2021
9e43d56
Merge remote-tracking branch 'origin/develop' into appveyor/cppcorecheck
srz-zumix Nov 17, 2021
2ef1ee8
fix
srz-zumix Nov 18, 2021
1d369bc
up
srz-zumix Nov 18, 2021
8b486ed
fix
srz-zumix Nov 19, 2021
86e8fd8
fix
srz-zumix Nov 19, 2021
7548744
fix
srz-zumix Nov 19, 2021
83214c3
fix c++14 constexpr
srz-zumix Nov 20, 2021
1d8c4a5
fix
srz-zumix Nov 20, 2021
d2f01a9
fix
srz-zumix Nov 21, 2021
c90662a
fix
srz-zumix Nov 21, 2021
4559f91
fix
srz-zumix Nov 22, 2021
98fb734
fix
srz-zumix Nov 23, 2021
2c3324d
fix
srz-zumix Nov 24, 2021
ee7f11e
fix
srz-zumix Nov 24, 2021
cf8c867
fix
srz-zumix Nov 25, 2021
1780209
fix
srz-zumix Nov 25, 2021
2bf875e
fix
srz-zumix Nov 26, 2021
b804493
fix
srz-zumix Nov 26, 2021
83ddf4c
vs2022
srz-zumix Nov 27, 2021
5499e78
up
srz-zumix Nov 29, 2021
d788cb3
fix
srz-zumix Dec 1, 2021
dcc8195
fix
srz-zumix Dec 1, 2021
c06d2b6
fix
srz-zumix Dec 2, 2021
90f7317
fix
srz-zumix Dec 2, 2021
69a3ed4
fix
srz-zumix Dec 2, 2021
e86d2ef
fix
srz-zumix Dec 4, 2021
a9897fc
up
srz-zumix Dec 4, 2021
1da52c3
rev
srz-zumix Dec 4, 2021
6f01a0a
rev param tests
srz-zumix Dec 5, 2021
fcda4a6
rev pinters
srz-zumix Dec 5, 2021
277d344
rev genparams
srz-zumix Dec 5, 2021
a23a48e
rev assertion
srz-zumix Dec 5, 2021
ce8feec
rev params_util
srz-zumix Dec 5, 2021
ac43a55
Revert "fix"
srz-zumix Dec 5, 2021
d78fb41
Revert "Revert "fix""
srz-zumix Dec 5, 2021
44dbe7f
rev simple
srz-zumix Dec 5, 2021
cf39da9
rev samples
srz-zumix Dec 5, 2021
6dd6fef
up
srz-zumix Dec 5, 2021
7aa888b
printto
srz-zumix Dec 5, 2021
81c1868
parameterized
srz-zumix Dec 6, 2021
ee59755
matcher
srz-zumix Dec 6, 2021
cb9f025
Revert "matcher"
srz-zumix Dec 6, 2021
49666f0
const
srz-zumix Dec 7, 2021
bd1ec4f
fix retry
srz-zumix Dec 7, 2021
d5ce33e
fix retry 2
srz-zumix Dec 7, 2021
88f7f72
fix genparams/samples
srz-zumix Dec 8, 2021
27c5e41
fix
srz-zumix Dec 9, 2021
3b4237c
Merge remote-tracking branch 'origin/develop' into appveyor/cppcorecheck
srz-zumix Dec 9, 2021
48744e7
rm .inferconfig
srz-zumix Dec 9, 2021
98afa04
fix
srz-zumix Dec 9, 2021
e36eeca
fix
srz-zumix Dec 10, 2021
c33e471
fix
srz-zumix Dec 10, 2021
35da422
fix
srz-zumix Dec 11, 2021
a82a71a
fix
srz-zumix Dec 11, 2021
a1b8067
fix
srz-zumix Dec 12, 2021
d93cba2
fix
srz-zumix Dec 13, 2021
542f4e5
fix
srz-zumix Dec 14, 2021
fb8ebbc
fix
srz-zumix Dec 14, 2021
1c74773
fix
srz-zumix Dec 14, 2021
b1c123b
fix
srz-zumix Dec 15, 2021
87d5b67
fix
srz-zumix Dec 16, 2021
b2797c2
fix
srz-zumix Dec 17, 2021
931a77a
fix
srz-zumix Dec 17, 2021
234caf9
- C26466
srz-zumix Dec 18, 2021
a8bd80a
suppress C26466
srz-zumix Dec 19, 2021
305e965
suppress C26466
srz-zumix Dec 19, 2021
4b1c401
suppress C26466
srz-zumix Dec 19, 2021
636d07b
- C26432
srz-zumix Dec 20, 2021
058f131
disable C26432, - C26485
srz-zumix Dec 20, 2021
7369c6c
disable C26485, - C26472/C26481
srz-zumix Dec 20, 2021
43f9894
disable C26481, fix C26472
srz-zumix Dec 21, 2021
53f12a1
disable C26472, - C26435
srz-zumix Dec 22, 2021
3475fd2
disable C26435, - C26401
srz-zumix Dec 23, 2021
c86648a
- C26429
srz-zumix Dec 23, 2021
2dd7fa0
disable C26429, - C26492
srz-zumix Dec 23, 2021
ef35825
fix C26492, - C26400
srz-zumix Dec 24, 2021
d23896f
fix C26400,C26492
srz-zumix Dec 25, 2021
600412d
fix
srz-zumix Dec 25, 2021
4250272
fix
srz-zumix Dec 25, 2021
43cc57e
fix
srz-zumix Dec 26, 2021
2a0c63f
fix
srz-zumix Dec 26, 2021
da9f69c
fix
srz-zumix Dec 27, 2021
84243fb
fix owner_t
srz-zumix Dec 28, 2021
afa9f38
fix owner_t
srz-zumix Dec 28, 2021
8913d07
fix C24600,C24603,C24605
srz-zumix Dec 29, 2021
f84ce5c
fix C24600
srz-zumix Dec 30, 2021
a1f964b
- C26401
srz-zumix Dec 31, 2021
27df437
fix C26401
srz-zumix Dec 31, 2021
94c6716
fix C26401
srz-zumix Jan 1, 2022
553d105
- C26440
srz-zumix Jan 2, 2022
c44c51d
- C26409
srz-zumix Jan 2, 2022
2cc37ed
disable C26409, - C26440
srz-zumix Jan 3, 2022
d8049f6
disable C26440, - C26426
srz-zumix Jan 4, 2022
6392d16
suppress i.22
srz-zumix Jan 5, 2022
388a52f
suppress i.22
srz-zumix Jan 5, 2022
78c3d78
suppress i.22
srz-zumix Jan 6, 2022
5844bfa
warn disable C26426
srz-zumix Jan 6, 2022
ba921f6
- C26447
srz-zumix Jan 7, 2022
9033733
fix C26447
srz-zumix Jan 8, 2022
776df57
- C26446
srz-zumix Jan 9, 2022
44dcf0a
fix C26446
srz-zumix Jan 9, 2022
b36e921
fix error
srz-zumix Jan 9, 2022
5747764
gsl::at test
srz-zumix Jan 10, 2022
c3ae5a3
gsl::at test
srz-zumix Jan 11, 2022
9ec3469
gsl::at test
srz-zumix Jan 11, 2022
2f528e0
gsl::at test
srz-zumix Jan 12, 2022
18d37ea
fix gsl
srz-zumix Jan 13, 2022
f834ca0
fix gsl::at
srz-zumix Jan 13, 2022
acf5f23
log fused error
srz-zumix Jan 14, 2022
d7c3512
fix C26447
srz-zumix Jan 14, 2022
65fd697
fix fused
srz-zumix Jan 15, 2022
39cebb1
fix try/catch
srz-zumix Jan 15, 2022
8053bec
- C26440
srz-zumix Jan 16, 2022
40a3e7f
fix C26440
srz-zumix Jan 16, 2022
e5bcf00
fix C26440
srz-zumix Jan 17, 2022
6f4ede8
fix C26440
srz-zumix Jan 17, 2022
98714da
fix C26440
srz-zumix Jan 18, 2022
e875e08
fix C26440
srz-zumix Jan 19, 2022
533e377
fix C26440
srz-zumix Jan 19, 2022
3e3a2f2
fix C26440
srz-zumix Jan 20, 2022
3eb3584
fix C26440
srz-zumix Jan 20, 2022
5bf9cfa
fix
srz-zumix Jan 21, 2022
26f9ed2
fix C26440
srz-zumix Jan 22, 2022
483da4c
fix C26440
srz-zumix Jan 22, 2022
079266a
fix C26440
srz-zumix Jan 23, 2022
e65985f
fix C26440
srz-zumix Jan 23, 2022
76ece8d
fix C26440
srz-zumix Jan 24, 2022
dcb2079
fix C26440
srz-zumix Jan 24, 2022
48de0bb
fix C26440
srz-zumix Jan 25, 2022
2ce141b
fix C26440
srz-zumix Jan 25, 2022
6602930
fix C26440
srz-zumix Jan 26, 2022
20d8b01
fix C26440
srz-zumix Jan 27, 2022
36cb39d
Merge remote-tracking branch 'origin/develop' into appveyor/cppcorecheck
srz-zumix Jan 27, 2022
11c13d3
fix C26440
srz-zumix Jan 27, 2022
b008bef
fix C26440
srz-zumix Jan 28, 2022
2a173f9
fix C26440
srz-zumix Jan 29, 2022
b03ee58
fix C26440
srz-zumix Jan 29, 2022
cde5817
fix
srz-zumix Jan 30, 2022
94df030
fix C26440
srz-zumix Jan 30, 2022
138af70
fix C26440
srz-zumix Jan 31, 2022
df52171
fix C26440
srz-zumix Feb 1, 2022
5b5cc37
fix C26440
srz-zumix Feb 1, 2022
64d5d80
fix C26440
srz-zumix Feb 2, 2022
e80777e
fix
srz-zumix Feb 2, 2022
8ef47c3
fix C26440
srz-zumix Feb 3, 2022
6e49213
fix
srz-zumix Feb 3, 2022
4fcac21
fix C26440
srz-zumix Feb 3, 2022
368eea8
fix
srz-zumix Feb 4, 2022
638be87
fix
srz-zumix Feb 4, 2022
b550599
fix C26440
srz-zumix Feb 5, 2022
0cbb4a7
fix C26440
srz-zumix Feb 6, 2022
52bdeef
fix C26440
srz-zumix Feb 6, 2022
588350c
fix C26440
srz-zumix Feb 7, 2022
90ecd90
fix C26440
srz-zumix Feb 7, 2022
8e9b80e
fix C26440
srz-zumix Feb 8, 2022
4942da7
fix C26440
srz-zumix Feb 8, 2022
15c1d0f
fix C26440
srz-zumix Feb 9, 2022
dae217e
fix C26440
srz-zumix Feb 10, 2022
f3d7a77
fix
srz-zumix Feb 10, 2022
4257fec
fix C26440
srz-zumix Feb 11, 2022
8b175a9
fix C26440
srz-zumix Feb 14, 2022
93d088d
fix C26440
srz-zumix Feb 15, 2022
2321845
fix C26440
srz-zumix Feb 16, 2022
25210ce
fix C26440
srz-zumix Feb 16, 2022
a5e5abe
fix C26440
srz-zumix Feb 17, 2022
1fd1714
fix
srz-zumix Mar 2, 2022
065f8a9
Merge remote-tracking branch 'origin/develop' into appveyor/cppcorecheck
srz-zumix Mar 11, 2022
fd0b7b6
ignore C26826
srz-zumix Mar 13, 2022
28b9d8b
fix fused
srz-zumix Mar 13, 2022
ac17bdb
fix
srz-zumix Mar 13, 2022
3d4e800
fix
srz-zumix Mar 14, 2022
040a078
fix
srz-zumix Mar 14, 2022
fa06eb6
fix
srz-zumix Mar 14, 2022
b18bed4
fix
srz-zumix Mar 15, 2022
6ca5cc2
fix
srz-zumix Mar 15, 2022
aeca0fb
fix
srz-zumix Mar 16, 2022
83e99ad
Merge remote-tracking branch 'origin/develop' into appveyor/cppcorecheck
srz-zumix Mar 30, 2023
bebe474
fix
srz-zumix Apr 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ environment:
OUTPUTXML_TYPE: xml
# Prefast
- job_group: VisualStudio
job_depends_on: VS2015
job_depends_on: VS2019
BUILD_PREFAST: yes
PROJECT_DIR: vs2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
PROJECT_DIR: vs2019
# Menu
- job_group: VisualStudio
BUILD_MENU: yes
Expand Down Expand Up @@ -280,9 +281,10 @@ for:
environment:
MSBUILD_LOGGER_OPTION: /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
MSBUILD_PREFAST_OPTION: /p:RunCodeAnalysis=true /p:EnablePREfast=true /p:CodeAnalysisTreatWarningsAsErrors=true
CPPCORE_CHECK_OPTION: /p:CodeAnalysisRuleSet=CppCoreCheckRules.ruleset
before_build: *noop
build_script:
cmd: msbuild "projects\%PROJECT_DIR%\iutest_sample.vcxproj" /m %MSBUILD_LOGGER_OPTION% %MSBUILD_PREFAST_OPTION%
cmd: msbuild "projects\%PROJECT_DIR%\iutest_sample.vcxproj" /m %MSBUILD_LOGGER_OPTION% %MSBUILD_PREFAST_OPTION% %CPPCORE_CHECK_OPTION% /p:ForceImportBeforeCppTargets=%APPVEYOR_BUILD_FOLDER%/utils/props/CppCoreCheckDisableSpecificWarnings.props
test: off
on_finish: *noop
# Menu
Expand Down
16 changes: 8 additions & 8 deletions include/impl/iutest_debug.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
//-----------------------------------------------------------------------
/**
* @file iutest_debug.ipp
* @brief iris unit test debug help ファイル
* @brief iris unit test debug help implementation
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2013-2016, Takazumi Shirayanagi\n
* Copyright (C) 2013-2021, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -40,10 +40,10 @@ namespace detail
#if defined(_MSC_VER) && IUTEST_HAS_MINIDUMP

IUTEST_IPP_INLINE MiniDump::MiniDump()
: m_hModule(NULL), m_pfnMiniDumpWriteDump(NULL)
: m_hModule(IUTEST_NULLPTR), m_pfnMiniDumpWriteDump(IUTEST_NULLPTR)
{
m_hModule = ::LoadLibraryA("dbghelp.dll");
if( m_hModule != NULL )
if( m_hModule != IUTEST_NULLPTR )
{
m_pfnMiniDumpWriteDump = ::GetProcAddress(m_hModule, "MiniDumpWriteDump");
}
Expand All @@ -56,7 +56,7 @@ IUTEST_IPP_INLINE MiniDump::~MiniDump()

IUTEST_IPP_INLINE bool MiniDump::Dump(HANDLE hFile, EXCEPTION_POINTERS* ep)
{
if( m_pfnMiniDumpWriteDump == NULL )
if( m_pfnMiniDumpWriteDump == IUTEST_NULLPTR )
{
return false;
}
Expand All @@ -73,13 +73,13 @@ IUTEST_IPP_INLINE bool MiniDump::Dump(HANDLE hFile, EXCEPTION_POINTERS* ep)
);
const pfnMiniDumpWriteDump proc = reinterpret_cast<const pfnMiniDumpWriteDump>(m_pfnMiniDumpWriteDump);
return (*proc)( ::GetCurrentProcess(), ::GetCurrentProcessId(), hFile, MiniDumpNormal
, &mdei, NULL, NULL) ? true : false;
, &mdei, IUTEST_NULLPTR, IUTEST_NULLPTR) ? true : false;
}
IUTEST_IPP_INLINE bool MiniDump::Create(const char* filepath, EXCEPTION_POINTERS* ep)
{
HANDLE hFile = CreateFileA( filepath, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ
, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if( hFile == NULL || hFile == INVALID_HANDLE_VALUE )
, IUTEST_NULLPTR, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, IUTEST_NULLPTR);
if( hFile == IUTEST_NULLPTR || hFile == INVALID_HANDLE_VALUE )
{
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions include/internal/iutest_debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2011-2020, Takazumi Shirayanagi\n
* Copyright (C) 2011-2021, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -38,7 +38,7 @@ namespace detail

//======================================================================
// function
static void IUTEST_ATTRIBUTE_UNUSED_ iuDebugInitialize()
static void IUTEST_ATTRIBUTE_UNUSED_ iuDebugInitialize() IUTEST_CXX_NOEXCEPT_SPEC
{
#ifdef _IUTEST_DEBUG
# if defined(_MSC_VER) && !defined(IUTEST_OS_WINDOWS_MOBILE)
Expand All @@ -54,7 +54,7 @@ static void IUTEST_ATTRIBUTE_UNUSED_ iuDebugBreakAlloc(long n)
_CrtSetBreakAlloc(n);
# endif
#endif
(void)n;
IUTEST_UNUSED_VAR(n);
}

#if defined(_MSC_VER) && IUTEST_HAS_MINIDUMP
Expand Down
10 changes: 5 additions & 5 deletions include/internal/iutest_internal_defs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2011-2020, Takazumi Shirayanagi\n
* Copyright (C) 2011-2021, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -136,22 +136,22 @@ typedef ::iutest_compatible::IsNullLiteralHelper::Object* iu_nullptr_convertible
/**
* @brief true を返す(警告対策用)
*/
inline bool AlwaysTrue() { return true; }
inline bool AlwaysTrue() IUTEST_CXX_NOEXCEPT_SPEC { return true; }

/**
* @brief false を返す(警告対策用)
*/
inline bool AlwaysFalse() { return !AlwaysTrue(); }
inline bool AlwaysFalse() IUTEST_CXX_NOEXCEPT_SPEC { return !AlwaysTrue(); }

/**
* @brief 0 を返す(警告対策用)
*/
inline int AlwaysZero() { return 0; }
inline int AlwaysZero() IUTEST_CXX_NOEXCEPT_SPEC { return 0; }

/**
* @brief 真偽値を返す(警告対策用)
*/
inline bool IsTrue(bool b) { return b; }
inline bool IsTrue(bool b) IUTEST_CXX_NOEXCEPT_SPEC { return b; }

//======================================================================
// class
Expand Down
21 changes: 2 additions & 19 deletions include/internal/iutest_stdlib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2012-2020, Takazumi Shirayanagi\n
* Copyright (C) 2012-2021, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -268,7 +268,7 @@ class optional
T m_value;
};

inline bool uncaught_exception()
inline bool uncaught_exception() IUTEST_CXX_NOEXCEPT_SPEC
{
#if IUTEST_HAS_CXX1Z && (!defined(IUTEST_LIBSTDCXX_VERSION) || (IUTEST_LIBSTDCXX_VERSION >= 60000))
return ::std::uncaught_exceptions() > 0;
Expand Down Expand Up @@ -508,23 +508,6 @@ struct type_least_t : public type_t_helper::type_least_t_select<SIZE>::type {};

//======================================================================
// function
/**
* @internal
* @brief mbtowc
*/
inline int iu_mbtowc(wchar_t* dst, const char* src, size_t size)
{
#if defined(IUTEST_OS_LINUX_ANDROID) || defined(IUTEST_OS_WINDOWS_MOBILE)
// unimplimented
IUTEST_UNUSED_VAR(dst);
IUTEST_UNUSED_VAR(src);
IUTEST_UNUSED_VAR(size);
return 0;
#else
return mbtowc(dst, src, size);
#endif
}

template<typename T>
T numeric_min()
{
Expand Down
81 changes: 49 additions & 32 deletions include/internal/iutest_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ ::std::string StringFormat(const char* format, va_list va) IUTEST_ATTRIBUTE_FORM
namespace wrapper
{

inline int iu_mbicmp(char l, char r)
inline int iu_mbicmp(char l, char r) IUTEST_CXX_NOEXCEPT_SPEC
{
const int ul = static_cast<int>(static_cast<unsigned char>(toupper(l)));
const int ur = static_cast<int>(static_cast<unsigned char>(toupper(r)));
return ul - ur;
}

inline int iu_stricmp(const char* str1, const char* str2)
inline int iu_stricmp(const char* str1, const char* str2) IUTEST_CXX_NOEXCEPT_SPEC
{
const char* l = str1;
const char* r = str2;
Expand All @@ -68,14 +68,14 @@ inline int iu_stricmp(const char* str1, const char* str2)
return iu_mbicmp(*l, *r);
}

inline int iu_wcicmp(wchar_t l, wchar_t r)
inline int iu_wcicmp(wchar_t l, wchar_t r) IUTEST_CXX_NOEXCEPT_SPEC
{
const ::std::wint_t ul = towupper(l);
const ::std::wint_t ur = towupper(r);
return ul - ur;
}

inline int iu_wcsicmp(const wchar_t * str1, const wchar_t * str2)
inline int iu_wcsicmp(const wchar_t * str1, const wchar_t * str2) IUTEST_CXX_NOEXCEPT_SPEC
{
const wchar_t* l = str1;
const wchar_t* r = str2;
Expand All @@ -94,11 +94,28 @@ inline int iu_wcsicmp(const wchar_t * str1, const wchar_t * str2)

} // end of namespace wrapper

/**
* @internal
* @brief mbtowc
*/
inline int iu_mbtowc(wchar_t* dst, const char* src, size_t size) IUTEST_CXX_NOEXCEPT_SPEC
{
#if defined(IUTEST_OS_LINUX_ANDROID) || defined(IUTEST_OS_WINDOWS_MOBILE)
// unimplimented
IUTEST_UNUSED_VAR(dst);
IUTEST_UNUSED_VAR(src);
IUTEST_UNUSED_VAR(size);
return 0;
#else
return mbtowc(dst, src, size);
#endif
}

/**
* @internal
* @brief stricmp (unsigned char compare)
*/
inline int iu_stricmp(const char* str1, const char* str2)
inline int iu_stricmp(const char* str1, const char* str2) IUTEST_CXX_NOEXCEPT_SPEC
{
#if defined(__BORLANDC__)
return stricmp(str1, str2);
Expand All @@ -118,7 +135,7 @@ inline int iu_stricmp(const char* str1, const char* str2)
* @internal
* @brief wcsicmp
*/
inline int iu_wcsicmp(const wchar_t * str1, const wchar_t * str2)
inline int iu_wcsicmp(const wchar_t * str1, const wchar_t * str2) IUTEST_CXX_NOEXCEPT_SPEC
{
#if defined(_MSC_VER)
return _wcsicmp(str1, str2);
Expand All @@ -137,9 +154,9 @@ int iu_vsnprintf(char* dst, size_t size, const char* format, va_list va) IUTEST_
inline int iu_vsnprintf(char* dst, size_t size, const char* format, va_list va)
{
char buffer[4096] = {0};
char* write_buffer = dst != NULL && size >= 4096 ? dst : buffer;
char* write_buffer = dst != IUTEST_NULLPTR && size >= 4096 ? dst : buffer;
const int ret = vsprintf(write_buffer, format, va);
if( dst != NULL )
if( dst != IUTEST_NULLPTR )
{
const size_t length = static_cast<size_t>(ret);
const size_t write = (size <= length) ? size - 1 : length;
Expand All @@ -162,12 +179,12 @@ int iu_snprintf(char* dst, size_t size, const char* format, ...) IUTEST_ATTRIBUT
*/
inline int iu_vsnprintf(char* dst, size_t size, const char* format, va_list va)
{
if( dst == NULL && size > 0 )
if( dst == IUTEST_NULLPTR && size > 0 )
{
return -1;
}
#if defined(_MSC_VER)
if( dst == NULL || size <= 0 )
if( dst == IUTEST_NULLPTR || size <= 0 )
{
return _vscprintf(format, va);
}
Expand Down Expand Up @@ -201,29 +218,29 @@ inline int iu_snprintf(char* dst, size_t size, const char* format, ...)

IUTEST_PRAGMA_CONSTEXPR_CALLED_AT_RUNTIME_WARN_DISABLE_BEGIN()

inline bool IsEmpty(const char* p) { return p == NULL || *p == '\0'; }
inline IUTEST_CXX_CONSTEXPR bool IsSpace(char ch) { return ch == ' ' || ch =='\t'; }
inline const char* NullableString(const char* str) { return str == NULL ? "" : str; }
inline IUTEST_CXX_CONSTEXPR const char* SkipSpace(const char* p)
inline bool IsEmpty(const char* p) IUTEST_CXX_NOEXCEPT_SPEC { return p == IUTEST_NULLPTR || *p == '\0'; }
inline IUTEST_CXX_CONSTEXPR bool IsSpace(char ch) IUTEST_CXX_NOEXCEPT_SPEC { return ch == ' ' || ch =='\t'; }
inline const char* NullableString(const char* str) IUTEST_CXX_NOEXCEPT_SPEC { return str == IUTEST_NULLPTR ? "" : str; }
inline IUTEST_CXX_CONSTEXPR const char* SkipSpace(const char* p) IUTEST_CXX_NOEXCEPT_SPEC
{
return p == NULL ? NULL : (IsSpace(*p) ? SkipSpace(++p) : p);
return p == IUTEST_NULLPTR ? IUTEST_NULLPTR : (IsSpace(*p) ? SkipSpace(++p) : p);
}
inline IUTEST_CXX_CONSTEXPR const char* FindComma(const char* p)
inline IUTEST_CXX_CONSTEXPR const char* FindComma(const char* p) IUTEST_CXX_NOEXCEPT_SPEC
{
return (p == NULL || *p == '\0') ? NULL : ((*p == ',') ? p : FindComma(++p));
return (p == IUTEST_NULLPTR || *p == '\0') ? IUTEST_NULLPTR : ((*p == ',') ? p : FindComma(++p));
}
inline bool IsStringEqual(const char* str1, const char* str2) { return strcmp(str1, str2) == 0; }
inline bool IsStringEqual(const ::std::string& str1, const char* str2) { return str1.compare(str2) == 0; }
inline bool IsStringEqual(const ::std::string& str1, const ::std::string& str2) { return str1.compare(str2) == 0; }
inline bool IsStringCaseEqual(const char* str1, const char* str2) { return iu_stricmp(str1, str2) == 0; }
inline bool IsStringCaseEqual(const ::std::string& str1, const char* str2) { return iu_stricmp(str1.c_str(), str2) == 0; }
inline bool IsStringCaseEqual(const ::std::string& str1, const ::std::string& str2) { return iu_stricmp(str1.c_str(), str2.c_str()) == 0; }
inline bool IsStringForwardMatching(const char* str1, const char* str2) { return strstr(str1, str2) == str1; }
inline bool IsStringForwardMatching(const ::std::string& str1, const char* str2) { return str1.find(str2) == 0; }
inline bool IsStringForwardMatching(const ::std::string& str1, const std::string& str2) { return str1.find(str2) == 0; }
inline bool IsStringContains(const char* str1, const char* str2) { return strstr(str1, str2) != NULL; }
inline bool IsStringContains(const ::std::string& str1, const char* str2) { return str1.find(str2) != ::std::string::npos; }
inline bool IsStringContains(const ::std::string& str1, const ::std::string& str2) { return str1.find(str2) != ::std::string::npos; }
inline bool IsStringEqual(const char* str1, const char* str2) IUTEST_CXX_NOEXCEPT_SPEC { return strcmp(str1, str2) == 0; }
inline bool IsStringEqual(const ::std::string& str1, const char* str2) IUTEST_CXX_NOEXCEPT_SPEC { return str1.compare(str2) == 0; }
inline bool IsStringEqual(const ::std::string& str1, const ::std::string& str2) IUTEST_CXX_NOEXCEPT_SPEC { return str1.compare(str2) == 0; }
inline bool IsStringCaseEqual(const char* str1, const char* str2) IUTEST_CXX_NOEXCEPT_SPEC { return iu_stricmp(str1, str2) == 0; }
inline bool IsStringCaseEqual(const ::std::string& str1, const char* str2) IUTEST_CXX_NOEXCEPT_SPEC { return iu_stricmp(str1.c_str(), str2) == 0; }
inline bool IsStringCaseEqual(const ::std::string& str1, const ::std::string& str2) IUTEST_CXX_NOEXCEPT_SPEC { return iu_stricmp(str1.c_str(), str2.c_str()) == 0; }
srz-zumix marked this conversation as resolved.
Show resolved Hide resolved
srz-zumix marked this conversation as resolved.
Show resolved Hide resolved
inline bool IsStringForwardMatching(const char* str1, const char* str2) IUTEST_CXX_NOEXCEPT_SPEC { return strstr(str1, str2) == str1; }
inline bool IsStringForwardMatching(const ::std::string& str1, const char* str2) IUTEST_CXX_NOEXCEPT_SPEC { return str1.find(str2) == 0; }
inline bool IsStringForwardMatching(const ::std::string& str1, const std::string& str2) IUTEST_CXX_NOEXCEPT_SPEC { return str1.find(str2) == 0; }
inline bool IsStringContains(const char* str1, const char* str2) IUTEST_CXX_NOEXCEPT_SPEC { return strstr(str1, str2) != IUTEST_NULLPTR; }
inline bool IsStringContains(const ::std::string& str1, const char* str2) IUTEST_CXX_NOEXCEPT_SPEC { return str1.find(str2) != ::std::string::npos; }
inline bool IsStringContains(const ::std::string& str1, const ::std::string& str2) IUTEST_CXX_NOEXCEPT_SPEC { return str1.find(str2) != ::std::string::npos; }
srz-zumix marked this conversation as resolved.
Show resolved Hide resolved
srz-zumix marked this conversation as resolved.
Show resolved Hide resolved

inline void StringReplace(::std::string& str, const char* from, size_t n, const char* to)
{
Expand All @@ -236,7 +253,7 @@ inline void StringReplace(::std::string& str, const char* from, size_t n, const
}
inline void StringReplace(::std::string& str, char a, const char* to)
{
char s[] = { a, 0 };
const char s[] = { a, 0 };
return StringReplace(str, s, 1, to);
}
inline ::std::string StripLeadingSpace(const ::std::string& str)
Expand Down Expand Up @@ -442,7 +459,7 @@ inline ::std::string FormatSizeByte(UInt64 value)
"GB",
"TB",
};
const size_t suffixes_length = IUTEST_PP_COUNTOF(suffixes);
IUTEST_CXX_CONSTEXPR_OR_CONST size_t suffixes_length = IUTEST_PP_COUNTOF(suffixes);
size_t index = 0;
double view_value = static_cast<double>(value);
while(view_value >= 1024 && index + 1 < suffixes_length)
Expand Down Expand Up @@ -489,7 +506,7 @@ inline ::std::string StringFormat(const char* format, va_list va)
{
va_list va2;
iu_va_copy(va2, va); // cppcheck-suppress va_list_usedBeforeStarted
const int ret = iu_vsnprintf(NULL, 0u, format, va2);
const int ret = iu_vsnprintf(IUTEST_NULLPTR, 0u, format, va2);
va_end(va2);
if( ret > 0 )
{
Expand Down
Loading