mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-03-04 01:01:28 +01:00
fix cppcheck warnings
This commit is contained in:
parent
d17a927a82
commit
5fcb55591c
3 changed files with 11 additions and 10 deletions
|
@ -187,13 +187,14 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
|
|||
game->joystick = al_install_joystick();
|
||||
}
|
||||
|
||||
int windowMode = ALLEGRO_FULLSCREEN_WINDOW;
|
||||
#ifdef ALLEGRO_ANDROID
|
||||
windowMode |= ALLEGRO_FRAMELESS;
|
||||
#endif
|
||||
#ifdef __EMSCRIPTEN__
|
||||
windowMode = ALLEGRO_WINDOWED;
|
||||
int windowMode = ALLEGRO_FULLSCREEN_WINDOW | ALLEGRO_FRAMELESS;
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
int windowMode = ALLEGRO_WINDOWED;
|
||||
#else
|
||||
int windowMode = ALLEGRO_FULLSCREEN_WINDOW;
|
||||
#endif
|
||||
|
||||
if (!game->config.fullscreen) {
|
||||
windowMode = ALLEGRO_WINDOWED;
|
||||
}
|
||||
|
@ -282,9 +283,10 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
|
|||
}
|
||||
|
||||
int samplerate = strtol(GetConfigOptionDefault(game, "SuperDerpy", "samplerate", "44100"), NULL, 10);
|
||||
ALLEGRO_AUDIO_DEPTH depth = ALLEGRO_AUDIO_DEPTH_FLOAT32;
|
||||
#ifdef ALLEGRO_ANDROID
|
||||
depth = ALLEGRO_AUDIO_DEPTH_INT16;
|
||||
ALLEGRO_AUDIO_DEPTH depth = ALLEGRO_AUDIO_DEPTH_INT16;
|
||||
#else
|
||||
ALLEGRO_AUDIO_DEPTH depth = ALLEGRO_AUDIO_DEPTH_FLOAT32;
|
||||
#endif
|
||||
game->audio.v = al_create_voice(samplerate, depth, ALLEGRO_CHANNEL_CONF_2);
|
||||
if (!game->audio.v) {
|
||||
|
@ -510,7 +512,7 @@ SYMBOL_EXPORT void libsuperderpy_destroy(struct Game* game) {
|
|||
wchar_t* wargv[game->_priv.argc];
|
||||
for (int i = 0; i < game->_priv.argc; i++) {
|
||||
size_t size = MultiByteToWideChar(CP_UTF8, 0, argv[i], -1, NULL, 0);
|
||||
wargv[i] = alloca(sizeof(wchar_t) * size);
|
||||
wargv[i] = malloc(sizeof(wchar_t) * size);
|
||||
MultiByteToWideChar(CP_UTF8, 0, argv[i], -1, wargv[i], size);
|
||||
}
|
||||
_wexecv(wargv[0], (const wchar_t* const*)wargv);
|
||||
|
|
|
@ -40,7 +40,7 @@ static ALLEGRO_USTR* GetShaderSource(struct Game* game, const char* filename) {
|
|||
ALLEGRO_USTR_INFO info;
|
||||
|
||||
n = al_fread(fp, buf, sizeof(buf));
|
||||
if (n <= 0) {
|
||||
if (n == 0) {
|
||||
break;
|
||||
}
|
||||
al_ustr_append(str, al_ref_buffer(&info, buf, n));
|
||||
|
|
|
@ -74,7 +74,6 @@ SYMBOL_EXPORT int DrawWrappedText(ALLEGRO_FONT* font, ALLEGRO_COLOR color, float
|
|||
|
||||
pch = strtok_r(stext, " ", &context); // Get the first word.
|
||||
do {
|
||||
strncpy(word, "", 255); // Truncate the string, to ensure there's no crazy stuff in there from memory.
|
||||
snprintf(word, 255, "%s ", pch);
|
||||
strncat(temp, word, 255); // Append the word to the end of TempLine
|
||||
// This code checks for the new line character.
|
||||
|
|
Loading…
Add table
Reference in a new issue