Reviewed Cppcheck issues #1098
This commit is contained in:
parent
dec85f741a
commit
484c6b360f
3 changed files with 12 additions and 10 deletions
|
@ -3974,7 +3974,7 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int
|
|||
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM) && defined(SUPPORT_MOUSE_GESTURES)
|
||||
// Process mouse events as touches to be able to use mouse-gestures
|
||||
GestureEvent gestureEvent;
|
||||
GestureEvent gestureEvent = { 0 };
|
||||
|
||||
// Register touch actions
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) gestureEvent.touchAction = TOUCH_DOWN;
|
||||
|
@ -4005,7 +4005,7 @@ static void MouseCursorPosCallback(GLFWwindow *window, double x, double y)
|
|||
{
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM) && defined(SUPPORT_MOUSE_GESTURES)
|
||||
// Process mouse events as touches to be able to use mouse-gestures
|
||||
GestureEvent gestureEvent;
|
||||
GestureEvent gestureEvent = { 0 };
|
||||
|
||||
gestureEvent.touchAction = TOUCH_MOVE;
|
||||
|
||||
|
@ -4273,7 +4273,7 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
|||
unsigned int flags = action & AMOTION_EVENT_ACTION_MASK;
|
||||
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM)
|
||||
GestureEvent gestureEvent;
|
||||
GestureEvent gestureEvent = { 0 };
|
||||
|
||||
// Register touch actions
|
||||
if (flags == AMOTION_EVENT_ACTION_DOWN) gestureEvent.touchAction = TOUCH_DOWN;
|
||||
|
@ -4388,7 +4388,7 @@ static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent
|
|||
static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)
|
||||
{
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM)
|
||||
GestureEvent gestureEvent;
|
||||
GestureEvent gestureEvent = { 0 };
|
||||
|
||||
// Register touch actions
|
||||
if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) gestureEvent.touchAction = TOUCH_DOWN;
|
||||
|
|
|
@ -791,10 +791,10 @@ void ExportWaveAsCode(Wave wave, const char *fileName)
|
|||
#endif
|
||||
|
||||
fprintf(txtFile, "// Wave data information\n");
|
||||
fprintf(txtFile, "#define %s_SAMPLE_COUNT %i\n", varFileName, wave.sampleCount);
|
||||
fprintf(txtFile, "#define %s_SAMPLE_RATE %i\n", varFileName, wave.sampleRate);
|
||||
fprintf(txtFile, "#define %s_SAMPLE_SIZE %i\n", varFileName, wave.sampleSize);
|
||||
fprintf(txtFile, "#define %s_CHANNELS %i\n\n", varFileName, wave.channels);
|
||||
fprintf(txtFile, "#define %s_SAMPLE_COUNT %d\n", varFileName, wave.sampleCount);
|
||||
fprintf(txtFile, "#define %s_SAMPLE_RATE %d\n", varFileName, wave.sampleRate);
|
||||
fprintf(txtFile, "#define %s_SAMPLE_SIZE %d\n", varFileName, wave.sampleSize);
|
||||
fprintf(txtFile, "#define %s_CHANNELS %d\n\n", varFileName, wave.channels);
|
||||
|
||||
// Write byte data as hexadecimal text
|
||||
fprintf(txtFile, "static unsigned char %s_DATA[%i] = { ", varFileName, dataSize);
|
||||
|
|
|
@ -1446,7 +1446,7 @@ char *TextToUtf8(int *codepoints, int length)
|
|||
{
|
||||
// We allocate enough memory fo fit all possible codepoints
|
||||
// NOTE: 5 bytes for every codepoint should be enough
|
||||
char *text = (char *)calloc(length*5, 1);
|
||||
char *text = (char *)RL_CALLOC(length*5, 1);
|
||||
const char *utf8 = NULL;
|
||||
int size = 0;
|
||||
|
||||
|
@ -1458,7 +1458,9 @@ char *TextToUtf8(int *codepoints, int length)
|
|||
}
|
||||
|
||||
// Resize memory to text length + string NULL terminator
|
||||
text = RL_REALLOC(text, size + 1);
|
||||
void *ptr = RL_REALLOC(text, size + 1);
|
||||
|
||||
if (ptr != NULL) text = (char *)ptr;
|
||||
|
||||
return text;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue