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
29 | 29 |
// skip all unless OS_WIN
|
30 | 30 |
#ifdef OS_WIN
|
31 | 31 |
|
|
32 |
#include <algorithm>
|
|
33 |
|
32 | 34 |
#include "ipc/ipc.h"
|
33 | 35 |
|
34 | 36 |
#include <Windows.h>
|
|
60 | 62 |
size_t GetNumberOfProcessors() {
|
61 | 63 |
// thread-safety is not required.
|
62 | 64 |
static size_t num = CPUStats().GetNumberOfProcessors();
|
63 | |
return max(num, 1);
|
|
65 |
return max(num, static_cast<size_t>(1));
|
64 | 66 |
}
|
65 | 67 |
|
66 | 68 |
// Least significant bit of OVERLAPPED::hEvent can be used for special
|
0 | 0 |
MAJOR=2
|
1 | 1 |
MINOR=17
|
2 | |
BUILD=2221
|
|
2 |
BUILD=2222
|
3 | 3 |
REVISION=102
|
4 | 4 |
# NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
|
5 | 5 |
# downloaded by NaCl Mozc.
|
42 | 42 |
#include "base/logging.h"
|
43 | 43 |
#include "base/stl_util.h"
|
44 | 44 |
#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
|
53 | 45 |
|
54 | 46 |
namespace mozc {
|
55 | 47 |
namespace renderer {
|
34 | 34 |
#include <atlapp.h>
|
35 | 35 |
#include <atlgdi.h>
|
36 | 36 |
#include <atlmisc.h>
|
37 | |
#include <gdiplus.h>
|
38 | |
|
|
37 |
|
|
38 |
#include <algorithm>
|
39 | 39 |
#include <fstream>
|
40 | 40 |
#include <list>
|
41 | 41 |
#include <memory>
|
|
51 | 51 |
|
52 | 52 |
DECLARE_string(test_srcdir);
|
53 | 53 |
|
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
|
58 | 61 |
|
59 | 62 |
using ::mozc::renderer::win32::internal::GaussianBlur;
|
60 | 63 |
using ::mozc::renderer::win32::internal::SafeFrameBuffer;
|
|
67 | 70 |
using ::WTL::CLogFont;
|
68 | 71 |
using ::WTL::CPoint;
|
69 | 72 |
using ::WTL::CSize;
|
|
73 |
|
|
74 |
namespace mozc {
|
|
75 |
namespace renderer {
|
|
76 |
namespace win32 {
|
|
77 |
namespace {
|
70 | 78 |
|
71 | 79 |
typedef SubdivisionalPixel::SubdivisionalPixelIterator
|
72 | 80 |
SubdivisionalPixelIterator;
|
34 | 34 |
#include <atlapp.h>
|
35 | 35 |
#include <atlgdi.h>
|
36 | 36 |
#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
|
47 | 37 |
|
48 | 38 |
#include <algorithm>
|
49 | 39 |
#include <limits>
|
34 | 34 |
#include <atlstr.h> // for CString
|
35 | 35 |
#endif // !NO_LOGGING
|
36 | 36 |
#include <psapi.h>
|
|
37 |
|
|
38 |
#include <algorithm>
|
|
39 |
|
37 | 40 |
#include "base/file_util.h"
|
38 | 41 |
#include "base/scoped_handle.h"
|
39 | 42 |
#include "base/system_util.h"
|
38 | 38 |
#include <atlmisc.h>
|
39 | 39 |
#include <strsafe.h>
|
40 | 40 |
|
|
41 |
#include <algorithm>
|
41 | 42 |
#include <memory>
|
42 | 43 |
|
43 | 44 |
#include "base/const.h"
|
|
348 | 349 |
|
349 | 350 |
virtual ULONG AddRef() {
|
350 | 351 |
const LONG count = ::InterlockedIncrement(&reference_count_);
|
351 | |
return max(count, 0);
|
|
352 |
return static_cast<ULONG>(max(count, static_cast<LONG>(0)));
|
352 | 353 |
}
|
353 | 354 |
|
354 | 355 |
virtual ULONG Release() {
|
46 | 46 |
using ATL::CComVariant;
|
47 | 47 |
using std::unique_ptr;
|
48 | 48 |
|
49 | |
#ifdef min
|
50 | |
#undef min
|
51 | |
#endif // min
|
52 | |
|
53 | 49 |
// GUID_PROP_INPUTSCOPE
|
54 | 50 |
GUID kGuidPropInputscope = {
|
55 | 51 |
0x1713dd5a, 0x68e7, 0x4a5b, {0x9a, 0xf6, 0x59, 0x2a, 0x59, 0x5c, 0x77, 0x8d}
|