summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/include/fxcrt/fx_system.h1
-rw-r--r--core/src/fxcodec/codec/fx_codec_flate.cpp4
-rw-r--r--core/src/fxge/win32/fx_win32_gdipext.cpp2
3 files changed, 4 insertions, 3 deletions
diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h
index 2fbab98a1d..02efbe10fc 100644
--- a/core/include/fxcrt/fx_system.h
+++ b/core/include/fxcrt/fx_system.h
@@ -110,7 +110,6 @@ static_assert(FALSE == false, "false_needs_to_be_false");
#endif
#endif
-#define FX_MIN(a, b) (((a) < (b)) ? (a) : (b))
#define FX_PI 3.1415926535897932384626433832795f
// NOTE: prevent use of the return value from snprintf() since some platforms
diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp
index 17f20da1de..ce7c9ade03 100644
--- a/core/src/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/src/fxcodec/codec/fx_codec_flate.cpp
@@ -6,6 +6,7 @@
#include "codec_int.h"
+#include <algorithm>
#include <memory>
#include "core/include/fxcodec/fx_codec.h"
@@ -565,7 +566,8 @@ void TIFF_PredictLine(uint8_t* dest_buf,
int Colors,
int Columns) {
if (BitsPerComponent == 1) {
- int row_bits = FX_MIN(BitsPerComponent * Colors * Columns, row_size * 8);
+ int row_bits = std::min(BitsPerComponent * Colors * Columns,
+ pdfium::base::checked_cast<int>(row_size * 8));
int index_pre = 0;
int col_pre = 0;
for (int i = 1; i < row_bits; i++) {
diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp
index 1e4f89540b..2d37865437 100644
--- a/core/src/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/src/fxge/win32/fx_win32_gdipext.cpp
@@ -1302,7 +1302,7 @@ class GpStream final : public IStream {
return HRESULT_FROM_WIN32(ERROR_END_OF_MEDIA);
}
bytes_left = m_InterStream.GetLength() - m_ReadPos;
- bytes_out = FX_MIN(cb, bytes_left);
+ bytes_out = std::min(pdfium::base::checked_cast<size_t>(cb), bytes_left);
FXSYS_memcpy(Output, m_InterStream.GetBuffer() + m_ReadPos, bytes_out);
m_ReadPos += (int32_t)bytes_out;
if (pcbRead) {