Fixed clang warnings

This commit is contained in:
Andrei "Akari" Alexeyev 2017-02-07 20:34:55 +02:00
parent 22f51b9652
commit 8566c65f4b
13 changed files with 43 additions and 14 deletions

View file

@ -8,7 +8,7 @@
#ifndef BOSS_H
#define BOSS_H
#include <complex.h>
#include "tscomplex.h"
#include <resource/animation.h>
struct Boss;

View file

@ -7,7 +7,7 @@
#ifndef ENEMY_H
#define ENEMY_H
#include <complex.h>
#include "tscomplex.h"
#include "projectile.h"
#undef complex

View file

@ -10,6 +10,8 @@
#include <SDL.h>
#include "tscomplex.h"
#include "resource/audio.h"
#include "resource/bgm.h"
#include "resource/shader.h"

View file

@ -9,7 +9,7 @@
#ifndef ITEM_H
#define ITEM_H
#include <complex.h>
#include "tscomplex.h"
typedef struct Item Item;

View file

@ -8,7 +8,7 @@
#ifndef LASER_H
#define LASER_H
#include <complex.h>
#include "tscomplex.h"
#include "projectile.h"
#include "resource/shader.h"

View file

@ -165,7 +165,7 @@ static void replayview_drawitem(void *n, int item, int cnt) {
a = AL_Left;
time_t t = rpy->stages[0].seed;
struct tm* timeinfo = localtime(&t);
strftime(tmp, 128, "%Y-%m-%d %H:%M", timeinfo);
strftime(tmp, sizeof(tmp), "%Y-%m-%d %H:%M", timeinfo);
break;
case 1:
@ -174,20 +174,20 @@ static void replayview_drawitem(void *n, int item, int cnt) {
break;
case 2:
plrmode_repr(tmp, 128, rpy->stages[0].plr_char, rpy->stages[0].plr_shot);
plrmode_repr(tmp, sizeof(tmp), rpy->stages[0].plr_char, rpy->stages[0].plr_shot);
tmp[0] = tmp[0] - 'a' + 'A';
break;
case 3:
snprintf(tmp, 128, difficulty_name(rpy->stages[0].diff));
snprintf(tmp, sizeof(tmp), "%s", difficulty_name(rpy->stages[0].diff));
break;
case 4:
a = AL_Right;
if(rpy->stgcount == 1)
snprintf(tmp, 128, "Stage %i", rpy->stages[0].stage);
snprintf(tmp, sizeof(tmp), "Stage %i", rpy->stages[0].stage);
else
snprintf(tmp, 128, "%i stages", rpy->stgcount);
snprintf(tmp, sizeof(tmp), "%i stages", rpy->stgcount);
break;
}

View file

@ -8,7 +8,7 @@
#ifndef PLAYER_H
#define PLAYER_H
#include <complex.h>
#include "tscomplex.h"
#include "enemy.h"
#include "gamepad.h"
#include "resource/animation.h"

View file

@ -8,9 +8,11 @@
#ifndef PROJECTILE
#define PROJECTILE
#include <complex.h>
#include "tscomplex.h"
#include "resource/texture.h"
#include <complex.h>
enum {
RULE_ARGC = 4
};

View file

@ -195,7 +195,7 @@ Model *get_model(char *name) {
}
void draw_model_p(Model *model) {
GLenum flag;
GLenum flag = GL_NONE;
switch(model->fverts) {
case 3:
flag = GL_TRIANGLES;

View file

@ -5,7 +5,10 @@
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
*/
#include <complex.h>
#include "stage.h"
#include "tscomplex.h"
#include <time.h>
#include "global.h"

View file

@ -61,7 +61,7 @@ Vector **stage1_bg_pos(Vector p, float maxrange) {
}
void stage1_smoke_draw(Vector pos) {
float d = abs(pos[1]-bgcontext.cx[1]);
float d = fabsf(pos[1]-bgcontext.cx[1]);
glDisable(GL_DEPTH_TEST);
glPushMatrix();

View file

@ -5,7 +5,7 @@
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
*/
#ifndef STAGEUITLS_H
#ifndef STAGEUTILS_H
#define STAGEUTILS_H
#include "matrix.h"

22
src/tscomplex.h Normal file
View file

@ -0,0 +1,22 @@
/*
* This software is licensed under the terms of the MIT-License
* See COPYING for further information.
* ---
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
*/
#ifndef TSCOMPLEX_H
#define TSCOMPLEX_H
#include <complex.h>
// This is a workaround to properly specify the type of our "complex" variables...
// Taisei code always uses just "complex" when it actually means "complex double", which is not really correct...
// gcc doesn't seem to care, other compilers do (e.g. clang)
#ifdef complex
#undef complex
#define complex _Complex double
#endif
#endif