diff options
author | Aki <please@ignore.pl> | 2021-10-02 16:53:47 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2021-10-02 16:56:38 +0200 |
commit | 5c02e6649c523dbd6557cb4d629fdd994c2eaef5 (patch) | |
tree | 81619c5d6477a098f4120518ace1797e82d4e074 /Stars45 | |
parent | d25ea30c9cd9e66ea5d484017a9209cdb78332ae (diff) | |
download | starshatter-5c02e6649c523dbd6557cb4d629fdd994c2eaef5.zip starshatter-5c02e6649c523dbd6557cb4d629fdd994c2eaef5.tar.gz starshatter-5c02e6649c523dbd6557cb4d629fdd994c2eaef5.tar.bz2 |
Fixed conversion and narrowing errors in Joystick error handler
Diffstat (limited to 'Stars45')
-rw-r--r-- | Stars45/Joystick.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Stars45/Joystick.cpp b/Stars45/Joystick.cpp index 3d641dd..5a30f8d 100644 --- a/Stars45/Joystick.cpp +++ b/Stars45/Joystick.cpp @@ -65,7 +65,7 @@ static int strikes = 3; static Joystick* joystick = 0; void DirectInputError(const char* msg, HRESULT err); -char* DIErrStr(HRESULT hr); +const char* DIErrStr(HRESULT hr); void ReleaseDirectInput(); // +--------------------------------------------------------------------+ @@ -857,11 +857,12 @@ DirectInputError(const char* msg, HRESULT err) static char errstrbuf[128]; -char* DIErrStr(HRESULT hr) +const char* DIErrStr(HRESULT hr) { - switch (hr) { + auto casted = static_cast<long unsigned int>(hr); + switch (casted) { default: - sprintf_s(errstrbuf, "Unrecognized error value = %08x.", hr); + sprintf_s(errstrbuf, "Unrecognized error value = %08x.", casted); return errstrbuf; case DI_OK: |