Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Coverity Uninitialized Scalar Warnings
Coverity notes that SDL_UserEvent.windowID is never initialized. SDL documents that memset() should be used to initialize the structure. Subclassing the struct to add various constructors for clarity and future-proofing. This closes CID 1380246 CID 1380234 CID 1380159 CID 1380152 CID 1356356 Earlier commit for these warnings only fixed the timestamp.
- Loading branch information
1 parent
5027d54
commit c6f523f
Showing
6 changed files
with
57 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
Copyright (C) 2017 the Battle for Wesnoth Project http://www.wesnoth.org/ | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY. | ||
See the COPYING file for more details. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <SDL_events.h> | ||
|
||
namespace sdl | ||
{ | ||
class UserEvent : public SDL_UserEvent | ||
{ | ||
public: | ||
UserEvent() : SDL_UserEvent() { | ||
} | ||
|
||
UserEvent(int type) : UserEvent() { | ||
this->type = type; | ||
} | ||
|
||
UserEvent(int type, int code) : UserEvent(type) { | ||
this->code = code; | ||
} | ||
|
||
UserEvent(int type, int data1, int data2) : UserEvent(type) { | ||
this->data1 = reinterpret_cast<void*>(data1); | ||
this->data2 = reinterpret_cast<void*>(data2); | ||
} | ||
|
||
UserEvent(int type, void* data1) : UserEvent(type) { | ||
this->data1 = data1; | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters