Switch from _DEBUG to NDEBUG.
- NDEBUG is more widely used in Chromium
- _DEBUG is not defined on Mac in Chromium
- Leaving _DEBUG in for standalone debug builds for the benefit of
third party libraries / Windows.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1721073004 .
diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h
index f479868..41dc446 100644
--- a/core/include/fxcrt/fx_system.h
+++ b/core/include/fxcrt/fx_system.h
@@ -81,10 +81,6 @@
// TODO(palmer): it should be a |size_t|, or at least unsigned.
typedef int FX_STRSIZE;
-#if defined(DEBUG) && !defined(_DEBUG)
-#define _DEBUG
-#endif
-
#ifndef TRUE
#define TRUE 1
#endif
@@ -104,7 +100,7 @@
#define FXSYS_assert assert
#ifndef ASSERT
-#ifdef _DEBUG
+#ifndef NDEBUG
#define ASSERT FXSYS_assert
#else
#define ASSERT(a)
diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp
index 136edd0..396dbc4 100644
--- a/core/src/fxcrt/fx_basic_wstring.cpp
+++ b/core/src/fxcrt/fx_basic_wstring.cpp
@@ -15,7 +15,7 @@
namespace {
-#if defined(_DEBUG)
+#ifndef NDEBUG
bool IsValidCodePage(FX_WORD codepage) {
switch (codepage) {
case 0:
diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp
index 32995ff..e464339 100644
--- a/fpdfsdk/src/javascript/global.cpp
+++ b/fpdfsdk/src/javascript/global.cpp
@@ -57,7 +57,7 @@
return (unsigned)FX_HashCode_String_GetW(main, FXSYS_wcslen(main));
}
-#ifdef _DEBUG
+#ifndef NDEBUG
class HashVerify {
public:
HashVerify();
diff --git a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp
index 4b6fc0c..0ad73c1 100644
--- a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp
@@ -3277,7 +3277,7 @@
FXJSE_Value_Release(rgValues[i]);
}
} else if (FXJSE_Value_IsArray(argOne)) {
-#if defined(_DEBUG)
+#ifndef NDEBUG
FXJSE_HVALUE lengthValue = FXJSE_Value_Create(hruntime);
FXJSE_Value_GetObjectProp(argOne, "length", lengthValue);
FXSYS_assert(FXJSE_Value_ToInteger(lengthValue) >= 3);
@@ -6458,7 +6458,7 @@
if (argc == 1) {
FXJSE_HVALUE argOne = args.GetValue(0);
if (FXJSE_Value_IsArray(argOne)) {
-#if defined(_DEBUG)
+#ifndef NDEBUG
FXJSE_HRUNTIME hruntime = pContext->GetScriptRuntime();
FXJSE_HVALUE lengthValue = FXJSE_Value_Create(hruntime);
FXJSE_Value_GetObjectProp(argOne, "length", lengthValue);
@@ -6484,7 +6484,7 @@
if (argc == 1) {
FXJSE_HVALUE argOne = args.GetValue(0);
if (FXJSE_Value_IsArray(argOne)) {
-#if defined(_DEBUG)
+#ifndef NDEBUG
FXJSE_HVALUE lengthValue = FXJSE_Value_Create(hruntime);
FXJSE_Value_GetObjectProp(argOne, "length", lengthValue);
FXSYS_assert(FXJSE_Value_ToInteger(lengthValue) >= 3);