Codebase list mozc / 2cc1a05
Enforce NOMINMAX macro everywhere in Mozc. With recent toolchains such as Visual C++ 2013 and Windows 8.1 SDK, we are finally able to define NOMINMAX globally and unexceptionally without breaking dependent libraries. Now that including Windows.h no longer defines min/max as a macro, we can remove per-file "#undef min" and "#undef max" safely. BUG= TEST=unittest REF_BUG=19010851 REF_CL=86940185 Yohei Yukawa 8 years ago
10 changed file(s) with 24 addition(s) and 33 deletion(s). Raw diff Collapse all Expand all
685685 'COMPILER_MSVC',
686686 'BUILD_MOZC', # for ime_shared library
687687 'ID_TRACE_LEVEL=1',
688 'NOMINMAX',
688689 'OS_WIN',
689690 'UNICODE',
690691 'WIN32',
2929 // skip all unless OS_WIN
3030 #ifdef OS_WIN
3131
32 #include <algorithm>
33
3234 #include "ipc/ipc.h"
3335
3436 #include <Windows.h>
6062 size_t GetNumberOfProcessors() {
6163 // thread-safety is not required.
6264 static size_t num = CPUStats().GetNumberOfProcessors();
63 return max(num, 1);
65 return max(num, static_cast<size_t>(1));
6466 }
6567
6668 // Least significant bit of OVERLAPPED::hEvent can be used for special
00 MAJOR=2
11 MINOR=17
2 BUILD=2221
2 BUILD=2222
33 REVISION=102
44 # NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
55 # downloaded by NaCl Mozc.
4242 #include "base/logging.h"
4343 #include "base/stl_util.h"
4444 #include "base/util.h"
45
46 // remove annoying macros
47 #ifdef min
48 #undef min
49 #endif // min
50 #ifdef max
51 #undef max
52 #endif // max
5345
5446 namespace mozc {
5547 namespace renderer {
3434 #include <atlapp.h>
3535 #include <atlgdi.h>
3636 #include <atlmisc.h>
37 #include <gdiplus.h>
38
37
38 #include <algorithm>
3939 #include <fstream>
4040 #include <list>
4141 #include <memory>
5151
5252 DECLARE_string(test_srcdir);
5353
54 namespace mozc {
55 namespace renderer {
56 namespace win32 {
57 namespace {
54 using ::std::min;
55 using ::std::max;
56
57 // gdiplus.h must be placed here because it internally depends on
58 // global min/max functions.
59 // TODO(yukawa): Use WIC (Windows Imaging Component) instead of GDI+.
60 #include <gdiplus.h> // NOLINT
5861
5962 using ::mozc::renderer::win32::internal::GaussianBlur;
6063 using ::mozc::renderer::win32::internal::SafeFrameBuffer;
6770 using ::WTL::CLogFont;
6871 using ::WTL::CPoint;
6972 using ::WTL::CSize;
73
74 namespace mozc {
75 namespace renderer {
76 namespace win32 {
77 namespace {
7078
7179 typedef SubdivisionalPixel::SubdivisionalPixelIterator
7280 SubdivisionalPixelIterator;
3434 #include <atlapp.h>
3535 #include <atlgdi.h>
3636 #include <atlmisc.h>
37
38 // undef min macro, which conflicts with std::numeric_limits<int>::min().
39 #if defined(min)
40 #undef min
41 #endif // min
42
43 // undef max macro, which conflicts with std::numeric_limits<int>::max().
44 #if defined(max)
45 #undef max
46 #endif // max
4737
4838 #include <algorithm>
4939 #include <limits>
2828
2929 #include "renderer/win32/window_manager.h"
3030
31 #undef min
32 #undef max
3331 #include <algorithm>
3432 #include <limits>
3533
3434 #include <atlstr.h> // for CString
3535 #endif // !NO_LOGGING
3636 #include <psapi.h>
37
38 #include <algorithm>
39
3740 #include "base/file_util.h"
3841 #include "base/scoped_handle.h"
3942 #include "base/system_util.h"
3838 #include <atlmisc.h>
3939 #include <strsafe.h>
4040
41 #include <algorithm>
4142 #include <memory>
4243
4344 #include "base/const.h"
348349
349350 virtual ULONG AddRef() {
350351 const LONG count = ::InterlockedIncrement(&reference_count_);
351 return max(count, 0);
352 return static_cast<ULONG>(max(count, static_cast<LONG>(0)));
352353 }
353354
354355 virtual ULONG Release() {
4646 using ATL::CComVariant;
4747 using std::unique_ptr;
4848
49 #ifdef min
50 #undef min
51 #endif // min
52
5349 // GUID_PROP_INPUTSCOPE
5450 GUID kGuidPropInputscope = {
5551 0x1713dd5a, 0x68e7, 0x4a5b, {0x9a, 0xf6, 0x59, 0x2a, 0x59, 0x5c, 0x77, 0x8d}