Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 0 additions & 13 deletions sakura_core/StdAfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,6 @@
#include <vsstyle.h>
#include <wrl.h>

// Windows SDKのマクロ定数「NULL」を訂正する。
// マクロ定数「NULL」は、省略可能なポインタ型パラメータに「省略」を指定するために使う。
// オリジナルでは「#define NULL 0」と定義されている。
// C++ではC++11からnullptrキーワードが導入されており、
// ポインタ型に0を渡すのは「不適切」になっている。
// 従来通りマクロ定数「NULL」を書けるようにするため、独自に上書き定義してしまう。
#ifdef __cplusplus
# pragma warning( push )
# pragma warning( disable : 4005 )
# define NULL nullptr
# pragma warning( pop )
#endif // end of #ifdef __cplusplus

// プロジェクト内のファイルだがプリコンパイル対象とする。
// プリコンパイルの有無がビルドパフォーマンスに大きく影響するため。
#include "env/DLLSHAREDATA.h"
Expand Down
23 changes: 7 additions & 16 deletions tests/unittests/test-cnative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@
#include "mem/CNativeW.h"
#include "mem/CNativeA.h"

// NULL定義補正
// 詳細はStdAfx.hを参照
#ifdef __cplusplus
# pragma warning( push )
# pragma warning( disable : 4005 )
# define NULL nullptr
# pragma warning( pop )
#endif // end of #ifdef __cplusplus

/*!
CStringRefのテスト
*/
Expand Down Expand Up @@ -259,7 +250,7 @@ TEST(CNativeW, AssignString)
TEST(CNativeW, AssignStringNullPointer)
{
CNativeW value(L"test");
value = NULL;
value = nullptr; // NULLではなくnullptrを使うよう修正
EXPECT_EQ(0, value.GetStringLength());
EXPECT_EQ(NULL, value.GetStringPtr());
}
Expand All @@ -272,7 +263,7 @@ TEST(CNativeW, AssignStringNullPointer)
TEST(CNativeW, AssignStringNullLiteral)
{
CNativeW value(L"test");
value = NULL;
value = nullptr; // NULLではなくnullptrを使うよう修正
ASSERT_EQ(NULL, value.GetStringPtr());
EXPECT_EQ(0, value.GetStringLength());
}
Expand Down Expand Up @@ -319,7 +310,7 @@ TEST(CNativeW, AppendStringNullPointer)
{
CNativeW org(L"orz");
CNativeW value(org);
value += NULL;
value += nullptr; // NULLではなくnullptrを使うよう修正
EXPECT_EQ(value.GetStringLength(), org.GetStringLength());
EXPECT_EQ(org, value);
}
Expand Down Expand Up @@ -352,7 +343,7 @@ TEST(CNativeW, AppendStringWithFormatting)
ASSERT_EQ(L"いちご25%", value);

// 未確保状態からの書式化をテストする
value = NULL; //テスト前の初期値(未確保
value = nullptr; //テスト前の初期値(未確保

Copilot AI Jul 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The comment is missing a closing parenthesis—consider changing to // テスト前の初期値 (未確保).

Copilot uses AI. Check for mistakes.

@berryzplus berryzplus Jul 10, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コメントに対する指摘なのでスルーします。
(修正しても振る舞いに影響がないため。)

value.AppendStringF( L"KEY[%03d]", 12 );
ASSERT_EQ( L"KEY[012]", value );

Expand All @@ -367,7 +358,7 @@ TEST(CNativeW, AppendStringWithFormatting)
// フォーマット出力長2047字を超える条件をテストする
{
std::wstring longText( 2048, L'=' );
value = NULL; //テスト前の初期値(未確保
value = nullptr; //テスト前の初期値(未確保

Copilot AI Jul 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Add the missing closing parenthesis in the comment: // テスト前の初期値 (未確保).

Suggested change
value = nullptr; //テスト前の初期値(未確保
value = nullptr; //テスト前の初期値(未確保)

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コメントに対する指摘なのでスルーします。
(修正しても振る舞いに影響がないため。)

value.AppendStringF( L"%s", longText.c_str() );
ASSERT_EQ( longText.c_str(), value );
}
Expand All @@ -390,7 +381,7 @@ TEST(CNativeW, operatorEqualNull)
TEST(CNativeW, operatorEqualNullptr)
{
CNativeW value;
ASSERT_EQ(value, NULL);
ASSERT_EQ(value, nullptr); // NULLではなくnullptrを使うよう修正
}

/*!
Expand Down Expand Up @@ -533,7 +524,7 @@ TEST(CNativeW, operatorNotEqualNullptr)
{
constexpr const wchar_t text[] = L"おっす!オラ(ry";
CNativeW value(text);
ASSERT_NE(value, NULL);
ASSERT_NE(value, nullptr); // NULLではなくnullptrを使うよう修正
}

/*!
Expand Down