Fix some C compiler warnings

This commit is contained in:
Crayon2000 2024-02-08 01:41:17 -05:00
parent dc9ac8463a
commit 44616e89b4
12 changed files with 36 additions and 38 deletions

View file

@ -1,5 +1,5 @@
/*------------------------------------------------------------------------------
Copyright (c) 2009-2022 The GRRLIB Team
Copyright (c) 2009-2024 The GRRLIB Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -26,12 +26,12 @@ THE SOFTWARE.
// User should not directly modify these
Mtx _GRR_view; // Should be static as soon as all light functions needing this var will be in this file ;)
static guVector _GRR_cam = {0.0f, 0.0f, 0.0f},
_GRR_up = {0.0f, 1.0f, 0.0f},
_GRR_look = {0.0f, 0.0f, -100.0f};
static guVector _GRRaxisx = (guVector){1, 0, 0}; // DO NOT MODIFY!!!
static guVector _GRRaxisy = (guVector){0, 1, 0}; // Even at runtime
static guVector _GRRaxisz = (guVector){0, 0, 1}; // NOT ever!
static guVector _GRR_cam = {0.0f, 0.0f, 0.0f};
static guVector _GRR_up = {0.0f, 1.0f, 0.0f};
static guVector _GRR_look = {0.0f, 0.0f, -100.0f};
static guVector _GRRaxisx = (guVector){1.0f, 0.0f, 0.0f}; // DO NOT MODIFY!!!
static guVector _GRRaxisy = (guVector){0.0f, 1.0f, 0.0f}; // Even at runtime
static guVector _GRRaxisz = (guVector){0.0f, 0.0f, 1.0f}; // NOT ever!
static Mtx _ObjTransformationMtx;
/**
@ -122,7 +122,7 @@ void GRRLIB_3dMode(f32 minDist, f32 maxDist, f32 fov, bool texturemode, bool nor
/**
* Go back to 2D mode (contributed by chris_c aka DaShAmAn).
*/
void GRRLIB_2dMode() {
void GRRLIB_2dMode(void) {
Mtx view;
Mtx44 m;

View file

@ -1,5 +1,5 @@
/*------------------------------------------------------------------------------
Copyright (c) 2009-2019 The GRRLIB Team
Copyright (c) 2009-2024 The GRRLIB Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -30,8 +30,8 @@ static bool geckoinit = false;
* Initialize USB Gecko.
* @return Returns @c true if everything worked, @c false if problems occurred.
*/
bool GRRLIB_GeckoInit() {
s32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1);
bool GRRLIB_GeckoInit(void) {
const s32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1);
if (geckoattached) {
usb_flush(EXI_CHANNEL_1);
geckoinit = true;

View file

@ -1,5 +1,5 @@
/*------------------------------------------------------------------------------
Copyright (c) 2009-2022 The GRRLIB Team
Copyright (c) 2009-2024 The GRRLIB Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -377,7 +377,7 @@ GRRLIB_texImg* GRRLIB_LoadTextureJPGEx (const u8 *my_jpg, const u32 my_size) {
jpeg_create_decompress(&cinfo);
cinfo.err = jpeg_std_error(&jerr);
cinfo.progress = NULL;
jpeg_mem_src(&cinfo, (unsigned char *)my_jpg, my_size);
jpeg_mem_src(&cinfo, (const unsigned char *)my_jpg, my_size);
jpeg_read_header(&cinfo, TRUE);
if (cinfo.jpeg_color_space == JCS_GRAYSCALE) {
cinfo.out_color_space = JCS_RGB;

View file

@ -1,5 +1,5 @@
/*------------------------------------------------------------------------------
Copyright (c) 2009-2023 The GRRLIB Team
Copyright (c) 2009-2024 The GRRLIB Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -36,7 +36,7 @@ static void DrawBitmap(FT_Bitmap *bitmap, int offset, int top, const u8 cR, cons
* Initialize FreeType library.
* @return int 0=OK; -1=Failed
*/
int GRRLIB_InitTTF () {
int GRRLIB_InitTTF (void) {
if (FT_Init_FreeType(&ftLibrary) != 0) {
return -1;
}

View file

@ -1,5 +1,5 @@
/*------------------------------------------------------------------------------
Copyright (c) 2009-2022 The GRRLIB Team
Copyright (c) 2009-2024 The GRRLIB Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -144,7 +144,7 @@ GRRLIB_texImg* GRRLIB_LoadTextureBMP (const u8 *my_bmp);
//------------------------------------------------------------------------------
// GRRLIB_gecko.c - USB_Gecko output facilities
bool GRRLIB_GeckoInit();
bool GRRLIB_GeckoInit(void);
void GRRLIB_GeckoPrintf (const char *text, ...);
//------------------------------------------------------------------------------
@ -152,7 +152,7 @@ void GRRLIB_GeckoPrintf (const char *text, ...);
void GRRLIB_SetBackgroundColour(u8 r, u8 g, u8 b, u8 a);
void GRRLIB_Camera3dSettings(f32 posx, f32 posy, f32 posz, f32 upx, f32 upy, f32 upz, f32 lookx, f32 looky, f32 lookz);
void GRRLIB_3dMode(f32 minDist, f32 maxDist, f32 fov, bool texturemode, bool normalmode);
void GRRLIB_2dMode();
void GRRLIB_2dMode(void);
void GRRLIB_ObjectViewBegin(void);
void GRRLIB_ObjectViewScale(f32 scalx, f32 scaly, f32 scalz);
void GRRLIB_ObjectViewRotate(f32 angx, f32 angy, f32 angz);

View file

@ -1,5 +1,5 @@
/*------------------------------------------------------------------------------
Copyright (c) 2009-2017 The GRRLIB Team
Copyright (c) 2009-2024 The GRRLIB Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -44,7 +44,7 @@ THE SOFTWARE.
//------------------------------------------------------------------------------
// GRRLIB_ttf.c - FreeType function for GRRLIB
int GRRLIB_InitTTF();
void GRRLIB_ExitTTF();
int GRRLIB_InitTTF(void);
void GRRLIB_ExitTTF(void);
#endif // __GRRLIB_PRIVATE_H__

View file

@ -51,7 +51,7 @@
#define GRRLIB_AQUA 0x00FFFFFF
#define GRRLIB_WHITE 0xFFFFFFFF
static u8 CalculateFrameRate();
static u8 CalculateFrameRate(void);
int main() {
s32 left = 0, top = 0, page = 0, frame = TILE_DOWN + 1;
@ -59,7 +59,6 @@ int main() {
u8 FPS = 0;
ir_t ir1;
u32 wpaddown, wpadheld;
guVector triangle[] = {{400,200,0.0f}, {500,400,0.0f}, {300,400,0.0f}};
u32 trianglecolor[] = {GRRLIB_GREEN, GRRLIB_RED, GRRLIB_BLUE};
@ -95,8 +94,8 @@ int main() {
while(1) {
WPAD_SetVRes(0, 640, 480);
WPAD_ScanPads();
wpaddown = WPAD_ButtonsDown(0);
wpadheld = WPAD_ButtonsHeld(0);
const u32 wpaddown = WPAD_ButtonsDown(0);
const u32 wpadheld = WPAD_ButtonsHeld(0);
WPAD_IR(WPAD_CHAN_0, &ir1);
@ -241,7 +240,7 @@ int main() {
* This function calculates the number of frames we render each second.
* @return The number of frames per second.
*/
static u8 CalculateFrameRate() {
static u8 CalculateFrameRate(void) {
static u8 frameCount = 0;
static u32 lastTime;
static u8 FPS = 0;

View file

@ -14,7 +14,6 @@
int main() {
u32 wpaddown;
s8 page = 0;
// Font texture
@ -115,7 +114,7 @@ int main() {
while(1) {
WPAD_ScanPads();
wpaddown = WPAD_ButtonsDown(0);
const u32 wpaddown = WPAD_ButtonsDown(0);
GRRLIB_FillScreen(0xFFFFFFFF);

View file

@ -19,7 +19,7 @@
#include "RGFX_Font_png.h"
// Declare Static Functions
static void ExitGame();
static void ExitGame(void);
// Prepare Graphics
GRRLIB_texImg *GFX_Background;
@ -160,7 +160,7 @@ int main() {
return 0;
}
static void ExitGame() {
static void ExitGame(void) {
// Free all memory used by textures.
GRRLIB_FreeTexture(GFX_Background);
GRRLIB_FreeTexture(GFX_Blob[0]);

View file

@ -50,7 +50,7 @@
#define GRRLIB_AQUA 0x00FFFFFF
#define GRRLIB_WHITE 0xFFFFFFFF
static u8 CalculateFrameRate();
static u8 CalculateFrameRate(void);
int main() {
s32 left = 0, top = 0, page = 0, frame = TILE_DOWN + 1;
@ -217,7 +217,7 @@ int main() {
* This function calculates the number of frames we render each second.
* @return The number of frames per second.
*/
static u8 CalculateFrameRate() {
static u8 CalculateFrameRate(void) {
static u8 frameCount = 0;
static u32 lastTime;
static u8 FPS = 0;

View file

@ -12,7 +12,7 @@
#include "FreeMonoBold_ttf.h"
// Prototype
static u8 CalculateFrameRate();
static u8 CalculateFrameRate(void);
int main(int argc, char **argv) {
bool ShowFPS = false;
@ -98,7 +98,7 @@ int main(int argc, char **argv) {
* This function calculates the number of frames we render each second.
* @return The number of frames per second.
*/
static u8 CalculateFrameRate() {
static u8 CalculateFrameRate(void) {
static u8 frameCount = 0;
static u32 lastTime;
static u8 FPS = 0;

View file

@ -12,8 +12,8 @@
#include "FreeMonoBold_ttf.h"
// Prototype
static u8 CalculateFrameRate();
static bool ScreenShot();
static u8 CalculateFrameRate(void);
static bool ScreenShot(void);
int main(int argc, char **argv) {
bool ShowFPS = false;
@ -104,7 +104,7 @@ int main(int argc, char **argv) {
* This function calculates the number of frames we render each second.
* @return The number of frames per second.
*/
static u8 CalculateFrameRate() {
static u8 CalculateFrameRate(void) {
static u8 frameCount = 0;
static u32 lastTime;
static u8 FPS = 0;
@ -123,7 +123,7 @@ static u8 CalculateFrameRate() {
* Create a PNG screenshot on the root of the SD card with a timestamp.
* @return bool true=everything worked, false=problems occurred.
*/
static bool ScreenShot() {
static bool ScreenShot(void) {
char path[255];
time_t now = time(NULL);
struct tm *ti = localtime(&now);