adjust to clang-tidy 8.0

This commit is contained in:
Sebastian Krzyszkowiak 2019-03-29 03:24:36 +01:00
parent d54b311a3c
commit 993e9884e6
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF
7 changed files with 29 additions and 29 deletions

View file

@ -1 +1 @@
Checks: '*,-clang-analyzer-alpha.*,-hicpp-no-assembler,-google-readability-todo,-misc-unused-parameters,-hicpp-signed-bitwise,-hicpp-multiway-paths-covered,-cert-msc30-c,-cert-msc50-cpp,-cert-msc32-c,-cert-msc51-cpp'
Checks: '*,-hicpp-no-assembler,-google-readability-todo,-misc-unused-parameters,-hicpp-signed-bitwise,-hicpp-multiway-paths-covered,-cert-msc30-c,-cert-msc50-cpp,-cert-msc32-c,-cert-msc51-cpp,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-bugprone-narrowing-conversions,-cppcoreguidelines-narrowing-conversions,-readability-isolate-declaration'

View file

@ -76,7 +76,7 @@ SYMBOL_INTERNAL void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data) {
ALLEGRO_TRANSFORM transform;
al_identity_transform(&transform);
al_use_transform(&transform);
al_orthographic_transform(&transform, L, T, 1.0f, R, B, -1.0f);
al_orthographic_transform(&transform, L, T, 1.0F, R, B, -1.0F);
al_use_projection_transform(&transform);
}
@ -212,11 +212,11 @@ SYMBOL_INTERNAL bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display) {
// Unfortunately Allegro doesn't support 32-bits packed colors so we have to convert them to 4 floats.
// We still use a custom declaration to use 'ALLEGRO_PRIM_TEX_COORD' instead of 'ALLEGRO_PRIM_TEX_COORD_PIXEL' else we can't do a reliable conversion.
ALLEGRO_VERTEX_ELEMENT elems[] =
{
{ALLEGRO_PRIM_POSITION, ALLEGRO_PRIM_FLOAT_2, offsetof(ImDrawVertAllegro, pos)},
{ALLEGRO_PRIM_TEX_COORD, ALLEGRO_PRIM_FLOAT_2, offsetof(ImDrawVertAllegro, uv)},
{ALLEGRO_PRIM_COLOR_ATTR, 0, offsetof(ImDrawVertAllegro, col)},
{0, 0, 0}};
{
{ALLEGRO_PRIM_POSITION, ALLEGRO_PRIM_FLOAT_2, offsetof(ImDrawVertAllegro, pos)},
{ALLEGRO_PRIM_TEX_COORD, ALLEGRO_PRIM_FLOAT_2, offsetof(ImDrawVertAllegro, uv)},
{ALLEGRO_PRIM_COLOR_ATTR, 0, offsetof(ImDrawVertAllegro, col)},
{0, 0, 0}};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
io->KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
@ -368,7 +368,7 @@ SYMBOL_INTERNAL void ImGui_ImplAllegro5_NewFrame() {
// Setup time step
double current_time = al_get_time();
io->DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (1.0f / 60.0f);
io->DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (1.0F / 60.0F);
g_Time = current_time;
// Setup inputs

View file

@ -358,7 +358,7 @@ SYMBOL_INTERNAL bool LinkGamestate(struct Game* game, struct Gamestate* gamestat
#define GS_ERROR \
FatalError(game, false, "Error on resolving gamestate's %s symbol: %s", gamestate->name, dlerror()); /* TODO: move out */ \
free(gamestate->api); \
return false;
return false
if (!(gamestate->api->draw = dlsym(gamestate->handle, "Gamestate_Draw"))) { GS_ERROR; }
if (!(gamestate->api->logic = dlsym(gamestate->handle, "Gamestate_Logic"))) { GS_ERROR; }
@ -749,14 +749,14 @@ SYMBOL_INTERNAL void SetupViewport(struct Game* game) {
if (strtol(GetConfigOptionDefault(game, "SuperDerpy", "letterbox", "1"), NULL, 10)) {
int clipX = (al_get_display_width(game->display) - clipWidth) / 2;
int clipY = (al_get_display_height(game->display) - clipHeight) / 2;
al_build_transform(&game->_priv.projection, clipX, clipY, resolution, resolution, 0.0f);
al_build_transform(&game->_priv.projection, clipX, clipY, resolution, resolution, 0.0);
al_set_clipping_rectangle(clipX, clipY, clipWidth, clipHeight);
game->clip_rect.x = clipX;
game->clip_rect.y = clipY;
game->clip_rect.w = clipWidth;
game->clip_rect.h = clipHeight;
} else if (strtol(GetConfigOptionDefault(game, "SuperDerpy", "scaling", "1"), NULL, 10)) {
al_build_transform(&game->_priv.projection, 0, 0, al_get_display_width(game->display) / (float)game->viewport.width, al_get_display_height(game->display) / (float)game->viewport.height, 0.0f);
al_build_transform(&game->_priv.projection, 0, 0, al_get_display_width(game->display) / (float)game->viewport.width, al_get_display_height(game->display) / (float)game->viewport.height, 0.0);
}
al_use_transform(&game->_priv.projection);
Console_Unload(game);

View file

@ -84,7 +84,7 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
game->_priv.font_console = NULL;
game->_priv.font_bsod = NULL;
game->_priv.console_pos = 0;
for (unsigned int i = 0; i < (sizeof(game->_priv.console) / sizeof(game->_priv.console[0])); i++) {
for (size_t i = 0; i < (sizeof(game->_priv.console) / sizeof(game->_priv.console[0])); i++) {
game->_priv.console[i][0] = '\0';
}
@ -442,7 +442,7 @@ SYMBOL_EXPORT int libsuperderpy_run(struct Game* game) {
emscripten_set_main_loop_arg(libsuperderpy_emscripten_mainloop, game, 0, true);
return 0;
#else
while (libsuperderpy_mainloop(game)) {};
while (libsuperderpy_mainloop(game)) {}
libsuperderpy_destroy(game);
return 0;
#endif

View file

@ -456,7 +456,7 @@ static inline bool MainloopTick(struct Game* game) {
double delta = al_get_time() - game->_priv.timestamp;
game->_priv.timestamp += delta;
delta *= ALLEGRO_BPS_TO_SECS(game->_priv.speed / (1 / 60.f));
delta *= ALLEGRO_BPS_TO_SECS(game->_priv.speed / (1 / 60.0));
#ifdef LIBSUPERDERPY_IMGUI
ImGui_ImplAllegro5_NewFrame();

View file

@ -127,11 +127,11 @@ bool TM_IsBackgroundEmpty(struct Timeline* timeline);
/*! \brief Allocates memory and sets given value. */
#define TM_WrapArg(type, result, val) \
type* result = malloc(sizeof(type)); \
*result = val;
*(result) = val
/*! \brief Indicates that the action handles only TM_ACTIONSTATE_RUNNING state. */
#define TM_RunningOnly \
if (action->state != TM_ACTIONSTATE_RUNNING) return false;
if (action->state != TM_ACTIONSTATE_RUNNING) return false
/*! \brief Shorthand for creating list of arguments for action. */
#define TM_Args(...) TM_AddToArgs(NULL, TM_NUMARGS(__VA_ARGS__), __VA_ARGS__)

View file

@ -25,19 +25,19 @@
SYMBOL_EXPORT void DrawVerticalGradientRect(float x, float y, float w, float h, ALLEGRO_COLOR top, ALLEGRO_COLOR bottom) {
ALLEGRO_VERTEX v[] = {
{.x = x, .y = y, .z = 0, .color = top},
{.x = x + w, .y = y, .z = 0, .color = top},
{.x = x, .y = y + h, .z = 0, .color = bottom},
{.x = x + w, .y = y + h, .z = 0, .color = bottom}};
{.x = x, .y = y, .z = 0, .color = top},
{.x = x + w, .y = y, .z = 0, .color = top},
{.x = x, .y = y + h, .z = 0, .color = bottom},
{.x = x + w, .y = y + h, .z = 0, .color = bottom}};
al_draw_prim(v, NULL, NULL, 0, 4, ALLEGRO_PRIM_TRIANGLE_STRIP);
}
SYMBOL_EXPORT void DrawHorizontalGradientRect(float x, float y, float w, float h, ALLEGRO_COLOR left, ALLEGRO_COLOR right) {
ALLEGRO_VERTEX v[] = {
{.x = x, .y = y, .z = 0, .color = left},
{.x = x + w, .y = y, .z = 0, .color = right},
{.x = x, .y = y + h, .z = 0, .color = left},
{.x = x + w, .y = y + h, .z = 0, .color = right}};
{.x = x, .y = y, .z = 0, .color = left},
{.x = x + w, .y = y, .z = 0, .color = right},
{.x = x, .y = y + h, .z = 0, .color = left},
{.x = x + w, .y = y + h, .z = 0, .color = right}};
al_draw_prim(v, NULL, NULL, 0, 4, ALLEGRO_PRIM_TRIANGLE_STRIP);
}
@ -122,7 +122,7 @@ SYMBOL_EXPORT void DrawCenteredScaled(ALLEGRO_BITMAP* bitmap, float x, float y,
SYMBOL_EXPORT void DrawCenteredTintedScaled(ALLEGRO_BITMAP* bitmap, ALLEGRO_COLOR tint, float x, float y, double sx, double sy, int flags) {
al_draw_tinted_scaled_rotated_bitmap(bitmap, tint, al_get_bitmap_width(bitmap) / 2.0, al_get_bitmap_height(bitmap) / 2.0,
x, y, sx, sy, 0, flags);
x, y, sx, sy, 0, flags);
}
SYMBOL_EXPORT void ClearToColor(struct Game* game, ALLEGRO_COLOR color) {
@ -141,9 +141,9 @@ SYMBOL_EXPORT void ClearToColor(struct Game* game, ALLEGRO_COLOR color) {
/* linear filtering code written by SiegeLord */
SYMBOL_EXPORT ALLEGRO_COLOR InterpolateColor(ALLEGRO_COLOR c1, ALLEGRO_COLOR c2, float frac) {
return al_map_rgba_f(c1.r + frac * (c2.r - c1.r),
c1.g + frac * (c2.g - c1.g),
c1.b + frac * (c2.b - c1.b),
c1.a + frac * (c2.a - c1.a));
c1.g + frac * (c2.g - c1.g),
c1.b + frac * (c2.b - c1.b),
c1.a + frac * (c2.a - c1.a));
}
/*! \brief Scales bitmap using software linear filtering method to current target. */
@ -650,7 +650,7 @@ SYMBOL_EXPORT void QuitGame(struct Game* game, bool allow_pausing) {
JNIEnv* env = al_android_get_jni_env();
jclass class_id = (*env)->GetObjectClass(env, al_android_get_activity());
jmethodID method_id = (*env)->GetMethodID(env, class_id, "moveTaskToBack",
"(Z)Z");
"(Z)Z");
jvalue jdata;
jdata.z = JNI_TRUE;
(*env)->CallBooleanMethodA(env, al_android_get_activity(), method_id, &jdata);