mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-25 16:22:20 +00:00
Correct cppcheck warnings
This commit is contained in:
parent
d18e3d710c
commit
d48d7b8819
4 changed files with 19 additions and 18 deletions
|
@ -80,12 +80,13 @@ GRRLIB_bytemapFont* GRRLIB_LoadBMF (const u8 my_bmf[] ) {
|
|||
|
||||
/**
|
||||
* Free memory allocated by ByteMap fonts.
|
||||
* If \a bmf is a null pointer, the function does nothing.
|
||||
* @note This function does not change the value of \a bmf itself, hence it still points to the same (now invalid) location.
|
||||
* @param bmf A GRRLIB_bytemapFont structure.
|
||||
*/
|
||||
void GRRLIB_FreeBMF (GRRLIB_bytemapFont *bmf) {
|
||||
u16 i;
|
||||
|
||||
for (i=0; i<256; i++) {
|
||||
if (bmf != NULL) {
|
||||
for (u16 i=0; i<256; i++) {
|
||||
if (bmf->charDef[i].data != NULL) {
|
||||
free(bmf->charDef[i].data);
|
||||
}
|
||||
|
@ -93,7 +94,7 @@ void GRRLIB_FreeBMF (GRRLIB_bytemapFont *bmf) {
|
|||
free(bmf->palette);
|
||||
free(bmf->name);
|
||||
free(bmf);
|
||||
bmf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,19 +67,17 @@ void GRRLIB_BMFX_FlipV (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest) {
|
|||
void GRRLIB_BMFX_Grayscale (const GRRLIB_texImg *texsrc,
|
||||
GRRLIB_texImg *texdest) {
|
||||
unsigned int x, y;
|
||||
u8 gray;
|
||||
u32 color;
|
||||
|
||||
for (y = 0; y < texsrc->h; y++) {
|
||||
for (x = 0; x < texsrc->w; x++) {
|
||||
color = GRRLIB_GetPixelFromtexImg(x, y, texsrc);
|
||||
u32 color = GRRLIB_GetPixelFromtexImg(x, y, texsrc);
|
||||
|
||||
gray = ((R(color)* 77 +
|
||||
u8 gray = ((R(color)* 77 +
|
||||
G(color)*150 +
|
||||
B(color)* 28 ) / 255);
|
||||
|
||||
GRRLIB_SetPixelTotexImg(x, y, texdest,
|
||||
((gray << 24) | (gray << 16) | (gray << 8) | A(color)));
|
||||
(gray << 24) | (gray << 16) | (gray << 8) | (A(color)));
|
||||
}
|
||||
}
|
||||
GRRLIB_SetHandle(texdest, 0, 0);
|
||||
|
|
|
@ -75,13 +75,14 @@ GRRLIB_ttfFont* GRRLIB_LoadTTF (const u8* file_base, s32 file_size) {
|
|||
|
||||
/**
|
||||
* Free memory allocated by TTF fonts.
|
||||
* If \a myFont is a null pointer, the function does nothing.
|
||||
* @note This function does not change the value of \a myFont itself, hence it still points to the same (now invalid) location.
|
||||
* @param myFont A TTF.
|
||||
*/
|
||||
void GRRLIB_FreeTTF (GRRLIB_ttfFont *myFont) {
|
||||
if (myFont != NULL) {
|
||||
FT_Done_Face(myFont->face);
|
||||
free(myFont);
|
||||
myFont = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ void GRRLIB_FlushTex (GRRLIB_texImg *tex) {
|
|||
|
||||
/**
|
||||
* Free memory allocated for texture.
|
||||
* If \a tex is a null pointer, the function does nothing.
|
||||
* @note This function does not change the value of \a tex itself, hence it still points to the same (now invalid) location.
|
||||
* @param tex A GRRLIB_texImg structure.
|
||||
*/
|
||||
INLINE
|
||||
|
@ -50,7 +52,6 @@ void GRRLIB_FreeTexture (GRRLIB_texImg *tex) {
|
|||
free(tex->data);
|
||||
}
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue