Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build errors (2020-02-28) #38431

Merged
merged 4 commits into from
Feb 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/crash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ extern "C" {
static void signal_handler( int sig )
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wold-style-cast"
ZhilkinSerg marked this conversation as resolved.
Show resolved Hide resolved
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
signal( sig, SIG_DFL );
#pragma GCC diagnostic pop
const char *msg;
Expand All @@ -111,7 +113,9 @@ extern "C" {
}
log_crash( "Signal", msg );
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wold-style-cast"
ZhilkinSerg marked this conversation as resolved.
Show resolved Hide resolved
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
std::signal( SIGABRT, SIG_DFL );
#pragma GCC diagnostic pop
abort();
Expand Down
36 changes: 18 additions & 18 deletions src/wincurse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static std::wstring widen( const std::string &s )
static bool WinCreate()
{
// Get current process handle
WindowINST = GetModuleHandle( 0 );
WindowINST = GetModuleHandle( nullptr );
std::string title = string_format( "Cataclysm: Dark Days Ahead - %s", getVersionString() );

// Register window class
Expand All @@ -92,7 +92,7 @@ static bool WinCreate()
// Get first resource
WindowClassType.hIcon = LoadIcon( WindowINST, MAKEINTRESOURCE( 0 ) );
WindowClassType.hIconSm = LoadIcon( WindowINST, MAKEINTRESOURCE( 0 ) );
WindowClassType.hCursor = LoadCursor( NULL, IDC_ARROW );
WindowClassType.hCursor = LoadCursor( nullptr, IDC_ARROW );
WindowClassType.lpszClassName = szWindowClass;
if( !RegisterClassExW( &WindowClassType ) ) {
return false;
Expand All @@ -119,8 +119,8 @@ static bool WinCreate()
WindowX, WindowY,
WndRect.right - WndRect.left,
WndRect.bottom - WndRect.top,
0, 0, WindowINST, NULL );
if( WindowHandle == 0 ) {
0, 0, WindowINST, nullptr );
if( WindowHandle == nullptr ) {
return false;
}

Expand All @@ -130,24 +130,24 @@ static bool WinCreate()
// Unregisters, releases the DC if needed, and destroys the window.
static void WinDestroy()
{
if( ( WindowDC != NULL ) && ( ReleaseDC( WindowHandle, WindowDC ) == 0 ) ) {
WindowDC = 0;
if( ( WindowDC != nullptr ) && ( ReleaseDC( WindowHandle, WindowDC ) == 0 ) ) {
WindowDC = nullptr;
}
if( ( !WindowHandle == 0 ) && ( !( DestroyWindow( WindowHandle ) ) ) ) {
WindowHandle = 0;
if( ( !WindowHandle == nullptr ) && ( !( DestroyWindow( WindowHandle ) ) ) ) {
WindowHandle = nullptr;
}
if( !( UnregisterClassW( szWindowClass, WindowINST ) ) ) {
WindowINST = 0;
WindowINST = nullptr;
}
}

// Creates a backbuffer to prevent flickering
static void create_backbuffer()
{
if( WindowDC != NULL ) {
if( WindowDC != nullptr ) {
ReleaseDC( WindowHandle, WindowDC );
}
if( backbuffer != NULL ) {
if( backbuffer != nullptr ) {
ReleaseDC( WindowHandle, backbuffer );
}
WindowDC = GetDC( WindowHandle );
Expand All @@ -163,7 +163,7 @@ static void create_backbuffer()
bmi.bmiHeader.biSizeImage = WindowWidth * WindowHeight * 1;
bmi.bmiHeader.biClrUsed = color_loader<RGBQUAD>::COLOR_NAMES_COUNT; // Colors in the palette
bmi.bmiHeader.biClrImportant = color_loader<RGBQUAD>::COLOR_NAMES_COUNT; // Colors in the palette
backbit = CreateDIBSection( 0, &bmi, DIB_RGB_COLORS, reinterpret_cast<void **>( &dcbits ), NULL,
backbit = CreateDIBSection( 0, &bmi, DIB_RGB_COLORS, reinterpret_cast<void **>( &dcbits ), nullptr,
0 );
DeleteObject( SelectObject( backbuffer, backbit ) ); //load the buffer into DC
}
Expand Down Expand Up @@ -372,7 +372,7 @@ LRESULT CALLBACK ProcessMessages( HWND__ *hWnd, unsigned int Msg,

case WM_PAINT:
BitBlt( WindowDC, 0, 0, WindowWidth, WindowHeight, backbuffer, 0, 0, SRCCOPY );
ValidateRect( WindowHandle, NULL );
ValidateRect( WindowHandle, nullptr );
return 0;

case WM_DESTROY:
Expand Down Expand Up @@ -466,7 +466,7 @@ void cata_cursesport::curses_drawwindow( const catacurses::window &w )
}
if( tmp ) {
const std::wstring utf16 = widen( cell.ch );
ExtTextOutW( backbuffer, drawx, drawy, 0, NULL, utf16.c_str(), utf16.length(), NULL );
ExtTextOutW( backbuffer, drawx, drawy, 0, nullptr, utf16.c_str(), utf16.length(), nullptr );
}
} else {
switch( static_cast<unsigned char>( win->line[j].chars[i].ch[0] ) ) {
Expand Down Expand Up @@ -533,7 +533,7 @@ void cata_cursesport::curses_drawwindow( const catacurses::window &w )
// We drew the window, mark it as so
win->draw = false;
if( update.top != -1 ) {
RedrawWindow( WindowHandle, &update, NULL, RDW_INVALIDATE | RDW_UPDATENOW );
RedrawWindow( WindowHandle, &update, nullptr, RDW_INVALIDATE | RDW_UPDATENOW );
}
}

Expand Down Expand Up @@ -608,7 +608,7 @@ void catacurses::init_interface()
for( HANDLE findFont = FindFirstFileW( L".\\*", &findData ); findFont != INVALID_HANDLE_VALUE; ) {
// Skip folders
if( !( findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ) {
AddFontResourceExW( findData.cFileName, FR_PRIVATE, NULL );
AddFontResourceExW( findData.cFileName, FR_PRIVATE, nullptr );
}
if( !FindNextFileW( findFont, &findData ) ) {
FindClose( findFont );
Expand Down Expand Up @@ -657,7 +657,7 @@ input_event input_manager::get_input_event()
uint64_t Frequency;
QueryPerformanceFrequency( reinterpret_cast<PLARGE_INTEGER>( &Frequency ) );
wrefresh( catacurses::stdscr );
InvalidateRect( WindowHandle, NULL, true );
InvalidateRect( WindowHandle, nullptr, true );
lastchar = ERR;
if( inputdelay < 0 ) {
for( ; lastchar == ERR; Sleep( 1 ) ) {
Expand Down Expand Up @@ -723,7 +723,7 @@ void catacurses::endwin()
DeleteObject( font );
WinDestroy();
// Unload it
RemoveFontResourceExA( "data\\termfont", FR_PRIVATE, NULL );
RemoveFontResourceExA( "data\\font", FR_PRIVATE, nullptr );
}

template<>
Expand Down