do vs2017 warnings.h a little differently than vs2019

fixes #545
This commit is contained in:
nhmall
2021-07-07 09:05:22 -04:00
parent caee59b131
commit 216c26aaef
3 changed files with 24 additions and 6 deletions
+16
View File
@@ -68,6 +68,7 @@
#define STDC_Pragma_AVAILABLE #define STDC_Pragma_AVAILABLE
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#if _MSC_VER > 1916
#define DISABLE_WARNING_UNREACHABLE_CODE \ #define DISABLE_WARNING_UNREACHABLE_CODE \
_Pragma("warning( push )") \ _Pragma("warning( push )") \
_Pragma("warning( disable : 4702 )") _Pragma("warning( disable : 4702 )")
@@ -81,6 +82,21 @@
#define RESTORE_WARNING_FORMAT_NONLITERAL _Pragma("warning( pop )") #define RESTORE_WARNING_FORMAT_NONLITERAL _Pragma("warning( pop )")
#define RESTORE_WARNINGS _Pragma("warning( pop )") #define RESTORE_WARNINGS _Pragma("warning( pop )")
#define STDC_Pragma_AVAILABLE #define STDC_Pragma_AVAILABLE
#else /* Visual Studio prior to 2019 below */
#define DISABLE_WARNING_UNREACHABLE_CODE \
__pragma(warning(push)) \
__pragma(warning(disable:4702))
#define DISABLE_WARNING_FORMAT_NONLITERAL \
__pragma(warning(push)) \
__pragma(warning(disable:4774))
#define DISABLE_WARNING_CONDEXPR_IS_CONSTANT \
__pragma(warning(push)) \
__pragma(warning(disable:4127))
#define RESTORE_WARNING_CONDEXPR_IS_CONSTANT __pragma(warning(pop))
#define RESTORE_WARNING_FORMAT_NONLITERAL __pragma(warning(pop))
#define RESTORE_WARNINGS __pragma(warning(pop))
#define STDC_Pragma_AVAILABLE
#endif /* vs2019 or vs2017 */
#endif /* various compiler detections */ #endif /* various compiler detections */
#endif /* ACTIVATE_WARNING_PRAGMAS */ #endif /* ACTIVATE_WARNING_PRAGMAS */
+3 -4
View File
@@ -1899,11 +1899,10 @@ void nethack_enter_consoletty()
/* grow the size of the console buffer if it is not wide enough */ /* grow the size of the console buffer if it is not wide enough */
if (console.origcsbi.dwSize.X < console.width) { if (console.origcsbi.dwSize.X < console.width) {
COORD screen_size = { COORD screen_size = {0};
screen_size.Y = console.origcsbi.dwSize.Y,
screen_size.X = console.width
};
screen_size.Y = console.origcsbi.dwSize.Y,
screen_size.X = console.width;
SetConsoleScreenBufferSize(console.hConOut, screen_size); SetConsoleScreenBufferSize(console.hConOut, screen_size);
} }
+5 -2
View File
@@ -965,8 +965,11 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
DeleteObject(brush); DeleteObject(brush);
intensity = (wch == 0x2591 ? 100 : 200); intensity = (wch == 0x2591 ? 100 : 200);
brush = CreateSolidBrush(RGB(intensity, intensity, intensity)); brush = CreateSolidBrush(RGB(intensity, intensity, intensity));
RECT smallRect = { rect->left + 1, rect->top + 1, RECT smallRect = {0};
rect->right - 1, rect->bottom - 1 }; smallRect.left = rect->left + 1;
smallRect.top = rect->top + 1;
smallRect.right = rect->right - 1;
smallRect.bottom = rect->bottom - 1;
FillRect(data->backBufferDC, &smallRect, brush); FillRect(data->backBufferDC, &smallRect, brush);
DeleteObject(brush); DeleteObject(brush);
} else { } else {