lilypad: Fix some gcc and clang warnings

Fixes writable-strings, missing-braces, and undefined-inline warnings.
This commit is contained in:
Jonathan Li 2016-02-14 14:20:37 +00:00
parent 2b558a9606
commit 999166fa58
3 changed files with 8 additions and 5 deletions

View File

@ -38,7 +38,7 @@ InputDeviceManager::~InputDeviceManager() {
ClearDevices(); ClearDevices();
} }
Device::Device(DeviceAPI api, DeviceType d, const wchar_t *displayName, const wchar_t *instanceID, wchar_t *productID) { Device::Device(DeviceAPI api, DeviceType d, const wchar_t *displayName, const wchar_t *instanceID, const wchar_t *productID) {
memset(pads, 0, sizeof(pads)); memset(pads, 0, sizeof(pads));
this->api = api; this->api = api;
type = d; type = d;
@ -322,7 +322,9 @@ wchar_t *GetDefaultControlName(unsigned short id, int type) {
else if (type & POV) { else if (type & POV) {
wsprintfW(name, L"POV %i", id); wsprintfW(name, L"POV %i", id);
} }
else return L"Unknown"; else {
wcscpy(name, L"Unknown");
}
return name; return name;
} }

View File

@ -270,7 +270,7 @@ public:
void AddFFAxis(const wchar_t *displayName, int id); void AddFFAxis(const wchar_t *displayName, int id);
void AddFFEffectType(const wchar_t *displayName, const wchar_t *effectID, EffectType type); void AddFFEffectType(const wchar_t *displayName, const wchar_t *effectID, EffectType type);
Device(DeviceAPI, DeviceType, const wchar_t *displayName, const wchar_t *instanceID = 0, wchar_t *deviceID = 0); Device(DeviceAPI, DeviceType, const wchar_t *displayName, const wchar_t *instanceID = 0, const wchar_t *deviceID = 0);
virtual ~Device(); virtual ~Device();
// Allocates memory for old and new state, sets everything to 0. // Allocates memory for old and new state, sets everything to 0.
@ -319,7 +319,7 @@ public:
// Note: Only used externally for binding, so if override the other one, can assume // Note: Only used externally for binding, so if override the other one, can assume
// all other forces are currently 0. // all other forces are currently 0.
inline virtual void SetEffect(ForceFeedbackBinding *binding, unsigned char force) {} inline virtual void SetEffect(ForceFeedbackBinding *binding, unsigned char force) {}
inline virtual void SetEffects(unsigned char port, unsigned int slot, unsigned char motor, unsigned char force); virtual void SetEffects(unsigned char port, unsigned int slot, unsigned char motor, unsigned char force);
// Called after reading. Basically calls FlipState(). // Called after reading. Basically calls FlipState().
// Some device types (Those that don't incrementally update) // Some device types (Those that don't incrementally update)

View File

@ -753,6 +753,7 @@ inline void StopVibrate() {
inline void ResetVibrate(int port, int slot) { inline void ResetVibrate(int port, int slot) {
SetVibrate(port, slot, 0, 0); SetVibrate(port, slot, 0, 0);
SetVibrate(port, slot, 1, 0); SetVibrate(port, slot, 1, 0);
// FIXME: I think this is broken on 64-bits.
((int*)(pads[port][slot].vibrate))[0] = 0xFFFFFF5A; ((int*)(pads[port][slot].vibrate))[0] = 0xFFFFFF5A;
((int*)(pads[port][slot].vibrate))[1] = 0xFFFFFFFF; ((int*)(pads[port][slot].vibrate))[1] = 0xFFFFFFFF;
} }
@ -790,7 +791,7 @@ struct QueryInfo {
u8 numBytes; u8 numBytes;
u8 queryDone; u8 queryDone;
u8 response[42]; u8 response[42];
} query = {0,0,0,0, 0,0xFF, 0xF3}; } query = {0, 0, 0, 0, 0, 0xFF, {0xF3}};
#ifdef _MSC_VER #ifdef _MSC_VER
int saveStateIndex = 0; int saveStateIndex = 0;