Mark function scope constexpr constants as static in //core
As discussed in [1], and for consistency.
[1] https://groups.google.com/a/chromium.org/g/chromium-dev/c/OXxJy5L96jI
Change-Id: Ia28f80ea1d3e317e1bea11cad56a1c8c6f3f05bc
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/126470
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp
index fd252cc..49e5d87 100644
--- a/core/fpdfapi/font/cpdf_type1font.cpp
+++ b/core/fpdfapi/font/cpdf_type1font.cpp
@@ -150,7 +150,8 @@
if (UseTTCharmapMSSymbol(face)) {
bool bGotOne = false;
for (uint32_t charcode = 0; charcode < kInternalTableSize; charcode++) {
- constexpr std::array<uint8_t, 4> prefix = {{0x00, 0xf0, 0xf1, 0xf2}};
+ static constexpr std::array<uint8_t, 4> prefix = {
+ {0x00, 0xf0, 0xf1, 0xf2}};
for (int j = 0; j < 4; j++) {
uint16_t unicode = prefix[j] * 256 + charcode;
m_GlyphIndex[charcode] = face->GetCharIndex(unicode);
diff --git a/core/fpdfapi/page/cpdf_clippath.cpp b/core/fpdfapi/page/cpdf_clippath.cpp
index 032aff6..9381617 100644
--- a/core/fpdfapi/page/cpdf_clippath.cpp
+++ b/core/fpdfapi/page/cpdf_clippath.cpp
@@ -100,7 +100,7 @@
void CPDF_ClipPath::AppendTexts(
std::vector<std::unique_ptr<CPDF_TextObject>>* pTexts) {
- constexpr size_t kMaxTextObjects = 1024;
+ static constexpr size_t kMaxTextObjects = 1024;
PathData* pData = m_Ref.GetPrivateCopy();
if (pData->m_TextList.size() + pTexts->size() <= kMaxTextObjects) {
for (size_t i = 0; i < pTexts->size(); i++)
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index 9a56d90..8cbd9c0 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -386,12 +386,12 @@
// The following RGB_xyz is based on
// sRGB value {Rx,Ry}={0.64, 0.33}, {Gx,Gy}={0.30, 0.60}, {Bx,By}={0.15, 0.06}
- constexpr float Rx = 0.64f;
- constexpr float Ry = 0.33f;
- constexpr float Gx = 0.30f;
- constexpr float Gy = 0.60f;
- constexpr float Bx = 0.15f;
- constexpr float By = 0.06f;
+ static constexpr float Rx = 0.64f;
+ static constexpr float Ry = 0.33f;
+ static constexpr float Gx = 0.30f;
+ static constexpr float Gy = 0.60f;
+ static constexpr float Bx = 0.15f;
+ static constexpr float By = 0.06f;
Matrix_3by3 RGB_xyz(Rx, Gx, Bx, Ry, Gy, By, 1 - Rx - Ry, 1 - Gx - Gy,
1 - Bx - By);
Vector_3by1 whitePoint(Xw, Yw, Zw);
diff --git a/core/fpdfapi/page/cpdf_dib.cpp b/core/fpdfapi/page/cpdf_dib.cpp
index ac4eeb6..393f53b 100644
--- a/core/fpdfapi/page/cpdf_dib.cpp
+++ b/core/fpdfapi/page/cpdf_dib.cpp
@@ -48,7 +48,7 @@
namespace {
bool IsValidDimension(int value) {
- constexpr int kMaxImageDimension = 0x01FFFF;
+ static constexpr int kMaxImageDimension = 0x01FFFF;
return value > 0 && value <= kMaxImageDimension;
}
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
index 86f2ec7..61cceeb 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
@@ -71,8 +71,8 @@
CRYPT_AESSetKey(m_pAESContext.get(),
m_KeyLen == 32 ? m_EncryptKey.data() : realkey, m_KeyLen);
- constexpr size_t kIVSize = 16;
- constexpr size_t kPaddingSize = 16;
+ static constexpr size_t kIVSize = 16;
+ static constexpr size_t kPaddingSize = 16;
const size_t source_padding_size = source.size() % kPaddingSize;
const size_t source_data_size = source.size() - source_padding_size;
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index 30da851..5aad8e4 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -36,7 +36,7 @@
namespace {
RetainPtr<CPDF_Object> GetResourceObject(RetainPtr<CPDF_Dictionary> pDict) {
- constexpr size_t kMaxHierarchyDepth = 64;
+ static constexpr size_t kMaxHierarchyDepth = 64;
size_t depth = 0;
while (pDict) {
diff --git a/core/fpdfapi/parser/cpdf_security_handler.cpp b/core/fpdfapi/parser/cpdf_security_handler.cpp
index 72675fc..4e87fd8 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler.cpp
@@ -71,7 +71,7 @@
const bool is_revision_3_or_greater = pEncrypt->GetIntegerFor("R") >= 3;
if (!ignore_metadata && is_revision_3_or_greater &&
!pEncrypt->GetBooleanFor("EncryptMetadata", true)) {
- constexpr uint32_t tag = 0xFFFFFFFF;
+ static constexpr uint32_t tag = 0xFFFFFFFF;
CRYPT_MD5Update(&md5, pdfium::byte_span_from_ref(tag));
}
uint8_t digest[16];
@@ -479,7 +479,7 @@
ByteString CPDF_SecurityHandler::GetUserPassword(
const ByteString& owner_password) const {
- constexpr size_t kRequiredOkeyLength = 32;
+ static constexpr size_t kRequiredOkeyLength = 32;
ByteString okey = m_pEncryptDict->GetByteStringFor("O");
size_t okeylen = std::min<size_t>(okey.GetLength(), kRequiredOkeyLength);
if (okeylen < kRequiredOkeyLength)
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index 035dfea..d26c98c 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -52,7 +52,7 @@
bool IsImageValueTooBig(int val) {
// Likely large enough for any real rendering need, but sufficiently small
// that operations like val1 + val2 or -val will not overflow.
- constexpr int kLimit = 256 * 1024 * 1024;
+ static constexpr int kLimit = 256 * 1024 * 1024;
FX_SAFE_INT32 safe_val = val;
safe_val = safe_val.Abs();
return safe_val.ValueOrDefault(kLimit) >= kLimit;
diff --git a/core/fpdfapi/render/cpdf_rendershading.cpp b/core/fpdfapi/render/cpdf_rendershading.cpp
index fd25e29..23ff55a 100644
--- a/core/fpdfapi/render/cpdf_rendershading.cpp
+++ b/core/fpdfapi/render/cpdf_rendershading.cpp
@@ -592,7 +592,7 @@
}
void GetPoints(pdfium::span<CFX_Path::Point> path_points) const {
- constexpr size_t kPointsCount = 4;
+ static constexpr size_t kPointsCount = 4;
std::array<float, kPointsCount> points_x;
std::array<float, kPointsCount> points_y;
x.GetPoints(points_x);
@@ -602,7 +602,7 @@
}
void GetPointsReverse(pdfium::span<CFX_Path::Point> path_points) const {
- constexpr size_t kPointsCount = 4;
+ static constexpr size_t kPointsCount = 4;
std::array<float, kPointsCount> points_x;
std::array<float, kPointsCount> points_y;
x.GetPoints(points_x);
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 53f79b5..8696658 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -1184,7 +1184,7 @@
return;
}
- constexpr FX_ARGB kMask = 0;
+ static constexpr FX_ARGB kMask = 0;
CompositeDIBitmap(std::move(screen), clip_box.left, clip_box.top, kMask,
/*alpha=*/1.0f, BlendMode::kNormal, CPDF_Transparency());
}
diff --git a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
index 4579b57..f64a315 100644
--- a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
+++ b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
@@ -42,7 +42,7 @@
int32_t width = bitmap_rect.Width();
int32_t height = bitmap_rect.Height();
// Set to 0 to make CalculatePitchAndSize() calculate it.
- constexpr uint32_t kNoPitch = 0;
+ static constexpr uint32_t kNoPitch = 0;
std::optional<CFX_DIBitmap::PitchAndSize> pitch_size =
CFX_DIBitmap::CalculatePitchAndSize(width, height, dibFormat, kNoPitch);
if (!pitch_size.has_value())
diff --git a/core/fpdfdoc/cpdf_generateap.cpp b/core/fpdfdoc/cpdf_generateap.cpp
index 66b767a..988a1fe 100644
--- a/core/fpdfdoc/cpdf_generateap.cpp
+++ b/core/fpdfdoc/cpdf_generateap.cpp
@@ -421,11 +421,11 @@
sAppStream << GenerateColorAP(CFX_Color(CFX_Color::Type::kRGB, 0, 0, 0),
PaintOperation::kStroke);
- constexpr int kBorderWidth = 1;
+ static constexpr int kBorderWidth = 1;
sAppStream << kBorderWidth << " w\n";
- constexpr float kHalfWidth = kBorderWidth / 2.0f;
- constexpr int kTipDelta = 4;
+ static constexpr float kHalfWidth = kBorderWidth / 2.0f;
+ static constexpr int kTipDelta = 4;
CFX_FloatRect outerRect1 = rect;
outerRect1.Deflate(kHalfWidth, kHalfWidth);
@@ -883,7 +883,7 @@
rect.Normalize();
float fY = (rect.top + rect.bottom) / 2;
- constexpr int kLineWidth = 1;
+ static constexpr int kLineWidth = 1;
sAppStream << kLineWidth << " w " << rect.left << " " << fY << " m "
<< rect.right << " " << fY << " l S\n";
}
diff --git a/core/fpdfdoc/cpdf_pagelabel.cpp b/core/fpdfdoc/cpdf_pagelabel.cpp
index eb3cdd5..bfecd51 100644
--- a/core/fpdfdoc/cpdf_pagelabel.cpp
+++ b/core/fpdfdoc/cpdf_pagelabel.cpp
@@ -18,12 +18,12 @@
namespace {
WideString MakeRoman(int num) {
- constexpr auto kArabic = fxcrt::ToArray<const int>(
+ static constexpr auto kArabic = fxcrt::ToArray<const int>(
{1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1});
const auto kRoman = fxcrt::ToArray<const WideStringView>(
{L"m", L"cm", L"d", L"cd", L"c", L"xc", L"l", L"xl", L"x", L"ix", L"v",
L"iv", L"i"});
- constexpr int kMaxNum = 1000000;
+ static constexpr int kMaxNum = 1000000;
num %= kMaxNum;
int i = 0;
@@ -44,8 +44,8 @@
return WideString();
}
- constexpr int kMaxCount = 1000;
- constexpr int kLetterCount = 26;
+ static constexpr int kMaxCount = 1000;
+ static constexpr int kLetterCount = 26;
--num;
const int count = (num / kLetterCount + 1) % kMaxCount;
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 83f6ef4..518b744 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -1367,7 +1367,7 @@
bool add_unicode = true;
const int count = std::min(fxcrt::CollectionSize<int>(m_TempCharList), 7);
- constexpr float kTextCharRatioGapDelta = 0.07f;
+ static constexpr float kTextCharRatioGapDelta = 0.07f;
float threshold = charinfo.matrix().TransformXDistance(
kTextCharRatioGapDelta * text_object->GetFontSize());
for (int n = fxcrt::CollectionSize<int>(m_TempCharList);
diff --git a/core/fxcodec/flate/flatemodule.cpp b/core/fxcodec/flate/flatemodule.cpp
index 92f7c19..6a1eee0 100644
--- a/core/fxcodec/flate/flatemodule.cpp
+++ b/core/fxcodec/flate/flatemodule.cpp
@@ -474,7 +474,7 @@
uint32_t EstimateFlateUncompressBufferSize(uint32_t orig_size,
size_t src_size) {
- constexpr uint32_t kMaxInitialAllocSize = 10000000;
+ static constexpr uint32_t kMaxInitialAllocSize = 10000000;
uint32_t guess_size =
orig_size ? orig_size : pdfium::checked_cast<uint32_t>(src_size * 2);
return std::min(guess_size, kMaxInitialAllocSize);
diff --git a/core/fxcodec/jbig2/JBig2_HuffmanTable.h b/core/fxcodec/jbig2/JBig2_HuffmanTable.h
index 8e482f9..6f40024 100644
--- a/core/fxcodec/jbig2/JBig2_HuffmanTable.h
+++ b/core/fxcodec/jbig2/JBig2_HuffmanTable.h
@@ -29,7 +29,7 @@
const std::vector<int>& GetRANGELOW() const { return RANGELOW; }
bool IsOK() const { return m_bOK; }
- constexpr static size_t kNumHuffmanTables = 16;
+ static constexpr size_t kNumHuffmanTables = 16;
private:
bool ParseFromStandardTable(size_t table_idx);
diff --git a/core/fxcodec/jpeg/jpegmodule.cpp b/core/fxcodec/jpeg/jpegmodule.cpp
index f683d49..8923685 100644
--- a/core/fxcodec/jpeg/jpegmodule.cpp
+++ b/core/fxcodec/jpeg/jpegmodule.cpp
@@ -459,7 +459,7 @@
jpeg_write_scanlines(&cinfo, row_pointer, 1);
UNSAFE_TODO({
if (cinfo.next_scanline == row) {
- constexpr size_t kJpegBlockSize = 1048576;
+ static constexpr size_t kJpegBlockSize = 1048576;
*dest_buf =
FX_Realloc(uint8_t, *dest_buf, dest_buf_length + kJpegBlockSize);
dest.next_output_byte =
diff --git a/core/fxcodec/progressive_decoder.cpp b/core/fxcodec/progressive_decoder.cpp
index 55c46fc..89113ea 100644
--- a/core/fxcodec/progressive_decoder.cpp
+++ b/core/fxcodec/progressive_decoder.cpp
@@ -346,7 +346,7 @@
}
// Set to 0 to make CalculatePitchAndSize() calculate it.
- constexpr uint32_t kNoPitch = 0;
+ static constexpr uint32_t kNoPitch = 0;
std::optional<CFX_DIBitmap::PitchAndSize> needed_data =
CFX_DIBitmap::CalculatePitchAndSize(m_SrcWidth, m_SrcHeight, format,
kNoPitch);
diff --git a/core/fxcodec/tiff/tiff_decoder.cpp b/core/fxcodec/tiff/tiff_decoder.cpp
index 6f9ed19..c096e95 100644
--- a/core/fxcodec/tiff/tiff_decoder.cpp
+++ b/core/fxcodec/tiff/tiff_decoder.cpp
@@ -187,7 +187,7 @@
const RetainPtr<IFX_SeekableReadStream>& file_ptr) {
// Limit set to make fuzzers happy. If this causes problems in the real world,
// then adjust as needed.
- constexpr tmsize_t kMaxTiffAllocBytes = 1536 * 1024 * 1024; // 1.5 GB
+ static constexpr tmsize_t kMaxTiffAllocBytes = 1536 * 1024 * 1024; // 1.5 GB
std::unique_ptr<TIFFOpenOptions, TIFFOpenOptionsDeleter> options(
TIFFOpenOptionsAlloc());
CHECK(options);
diff --git a/core/fxcrt/fx_memory.cpp b/core/fxcrt/fx_memory.cpp
index 7f21a28..a216ef3 100644
--- a/core/fxcrt/fx_memory.cpp
+++ b/core/fxcrt/fx_memory.cpp
@@ -87,7 +87,7 @@
#if BUILDFLAG(IS_WIN)
// The same custom Windows exception code used in Chromium and Breakpad.
- constexpr DWORD kOomExceptionCode = 0xe0000008;
+ static constexpr DWORD kOomExceptionCode = 0xe0000008;
ULONG_PTR exception_args[] = {size};
::RaiseException(kOomExceptionCode, EXCEPTION_NONCONTINUABLE,
std::size(exception_args), exception_args);
diff --git a/core/fxcrt/fx_number.cpp b/core/fxcrt/fx_number.cpp
index 1b87f97..6e1598f 100644
--- a/core/fxcrt/fx_number.cpp
+++ b/core/fxcrt/fx_number.cpp
@@ -61,7 +61,7 @@
// We have a sign, so if the value was greater then the signed integer
// limits, then we've overflowed and must reset to the default value.
- constexpr uint32_t uLimit =
+ static constexpr uint32_t uLimit =
static_cast<uint32_t>(std::numeric_limits<int>::max());
if (uValue > (bNegative ? uLimit + 1 : uLimit))
diff --git a/core/fxge/cfx_face.cpp b/core/fxge/cfx_face.cpp
index f1bec32..afff1ad 100644
--- a/core/fxge/cfx_face.cpp
+++ b/core/fxge/cfx_face.cpp
@@ -115,8 +115,8 @@
int FTPosToCBoxInt(FT_Pos pos) {
// Boundary values to avoid integer overflow when multiplied by 1000.
- constexpr FT_Pos kMinCBox = -2147483;
- constexpr FT_Pos kMaxCBox = 2147483;
+ static constexpr FT_Pos kMinCBox = -2147483;
+ static constexpr FT_Pos kMaxCBox = 2147483;
return static_cast<int>(std::clamp(pos, kMinCBox, kMaxCBox));
}
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index c5a73ee..274ca34 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -333,7 +333,8 @@
}
return result;
}
- constexpr int kFlag = FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
+ static constexpr int kFlag =
+ FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
if (FT_Load_Glyph(m_Face->GetRec(), glyph_index, kFlag) != 0)
return std::nullopt;
int em = m_Face->GetUnitsPerEm();
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index 4e45cf2..c81271a 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -352,7 +352,7 @@
}
void RemoveSubsettedFontPrefix(ByteString* subst_name) {
- constexpr size_t kPrefixLength = 6;
+ static constexpr size_t kPrefixLength = 6;
if (subst_name->GetLength() > kPrefixLength &&
(*subst_name)[kPrefixLength] == '+' &&
IsStrUpper(subst_name->First(kPrefixLength))) {
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 4813d4b..1fe6e71 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -1102,8 +1102,8 @@
const bool is_printer = GetDeviceType() == DeviceType::kPrinter;
bool try_native_text = true;
#else
- constexpr bool is_printer = false;
- constexpr bool try_native_text = true;
+ static constexpr bool is_printer = false;
+ static constexpr bool try_native_text = true;
#endif
#if BUILDFLAG(IS_WIN)
@@ -1360,9 +1360,9 @@
int32_t nTransparency,
int32_t nStartGray,
int32_t nEndGray) {
- constexpr float kBorder = 0.5f;
- constexpr float kSegmentWidth = 1.0f;
- constexpr float kLineWidth = 1.5f;
+ static constexpr float kBorder = 0.5f;
+ static constexpr float kSegmentWidth = 1.0f;
+ static constexpr float kLineWidth = 1.5f;
float fStepGray = (nEndGray - nStartGray) / rect.Height();
CFX_PointF start(rect.left, 0);
diff --git a/core/fxge/dib/cfx_cmyk_to_srgb.cpp b/core/fxge/dib/cfx_cmyk_to_srgb.cpp
index 7d0ad61..38f175c 100644
--- a/core/fxge/dib/cfx_cmyk_to_srgb.cpp
+++ b/core/fxge/dib/cfx_cmyk_to_srgb.cpp
@@ -1743,7 +1743,7 @@
// That value is close to the cusp but zero is the correct answer, and
// getting the same answer as before is desirable.
// All floats from 0.0 to 1.0 were tested and now give the same results.
- constexpr float kRoundingOffset = 0.49999997f;
+ static constexpr float kRoundingOffset = 0.49999997f;
uint8_t c1 = static_cast<int>(c * 255.f + kRoundingOffset);
uint8_t m1 = static_cast<int>(m * 255.f + kRoundingOffset);
uint8_t y1 = static_cast<int>(y * 255.f + kRoundingOffset);
@@ -1757,7 +1757,7 @@
FX_RGB_STRUCT<uint8_t> int_results = AdobeCMYK_to_sRGB1(c1, m1, y1, k1);
// Multiply by a constant rather than dividing because division is much
// more expensive.
- constexpr float kToFloat = 1.0f / 255.0f;
+ static constexpr float kToFloat = 1.0f / 255.0f;
return {
int_results.red * kToFloat,
int_results.green * kToFloat,
diff --git a/core/fxge/dib/cstretchengine.cpp b/core/fxge/dib/cstretchengine.cpp
index 1c96a73..37e94ba 100644
--- a/core/fxge/dib/cstretchengine.cpp
+++ b/core/fxge/dib/cstretchengine.cpp
@@ -499,7 +499,7 @@
uint32_t dest_r = 0;
uint32_t dest_g = 0;
uint32_t dest_b = 0;
- constexpr size_t kPixelBytes = 4;
+ static constexpr size_t kPixelBytes = 4;
for (int j = pWeights->m_SrcStart; j <= pWeights->m_SrcEnd; ++j) {
uint32_t pixel_weight = pWeights->GetWeightForPosition(j);
pdfium::span<const uint8_t> src_pixel = src_span.subspan(
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 3472a47..2431d6c 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -755,8 +755,8 @@
int height = m_pCanvas->imageInfo().height();
DCHECK_EQ(kUnknown_SkColorType, m_pCanvas->imageInfo().colorType());
- constexpr uint32_t kMagenta = 0xffff00ff;
- constexpr uint32_t kGreen = 0xff00ff00;
+ static constexpr uint32_t kMagenta = 0xffff00ff;
+ static constexpr uint32_t kGreen = 0xff00ff00;
m_pBitmap = MakeDebugBitmap(width, height, kMagenta);
m_pBackdropBitmap = MakeDebugBitmap(width, height, kGreen);
}
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index 3afde48..19dedc0 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -48,14 +48,14 @@
return std::nullopt;
// Per Type 42 font spec.
- constexpr size_t kMaxSfntStringSize = 65535;
+ static constexpr size_t kMaxSfntStringSize = 65535;
if (font_data.size() > kMaxSfntStringSize) {
// TODO(thestig): Fonts that are too big need to be written out in sections.
return std::nullopt;
}
// Each byte is written as 2 ASCIIHex characters, so really 64 chars per line.
- constexpr size_t kMaxBytesPerLine = 32;
+ static constexpr size_t kMaxBytesPerLine = 32;
fxcrt::ostringstream output;
output << "/" << psname << "_sfnts [\n<\n";
size_t bytes_per_line = 0;
@@ -668,7 +668,7 @@
glyph.adjust_matrix.has_value() == charpos.m_bGlyphAdjust) {
bool found;
if (glyph.adjust_matrix.has_value()) {
- constexpr float kEpsilon = 0.01f;
+ static constexpr float kEpsilon = 0.01f;
const auto& adjust_matrix = glyph.adjust_matrix.value();
found = fabs(adjust_matrix[0] - charpos.m_AdjustMatrix[0]) < kEpsilon &&
fabs(adjust_matrix[1] - charpos.m_AdjustMatrix[1]) < kEpsilon &&