Sfoglia il codice sorgente

Fix warnings (#4264)

Fix following gcc warnings when SVG enabled:

rtextures.c: In function 'LoadImageSvg':
rtextures.c:374:52: warning: pointer targets in passing argument 1 of 'nsvgParse' differ in signedness [-Wpointer-sign]
  374 |             struct NSVGimage *svgImage = nsvgParse(fileData, "px", 96.0f);
      |                                                    ^~~~~~~~
      |                                                    |
      |                                                    unsigned char *
In file included from rtextures.c:230:
external/nanosvg.h:2952:28: note: expected 'char *' but argument is of type 'unsigned char *'
 2952 | NSVGimage* nsvgParse(char* input, const char* units, float dpi)
      |                      ~~~~~~^~~~~
rtextures.c:407:43: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
  407 |         if (isSvgStringValid && (fileData != fileNameOrString)) UnloadFileData(fileData);
      |                                           ^~
rtextures.c: In function 'LoadImageFromMemory':
rtextures.c:614:52: warning: passing argument 1 of 'nsvgParse' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  614 |             struct NSVGimage *svgImage = nsvgParse(fileData, "px", 96.0f);
      |                                                    ^~~~~~~~
external/nanosvg.h:2952:28: note: expected 'char *' but argument is of type 'const unsigned char *'
 2952 | NSVGimage* nsvgParse(char* input, const char* units, float dpi)
      |                      ~~~~~~^~~~~
pull/2809/merge
hanaxars 9 mesi fa
committed by GitHub
parent
commit
7fab03c0b4
Non sono state trovate chiavi note per questa firma nel database ID Chiave GPG: B5690EEEBB952194
1 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. +3
    -3
      src/rtextures.c

+ 3
- 3
src/rtextures.c Vedi File

@ -371,7 +371,7 @@ Image LoadImageSvg(const char *fileNameOrString, int width, int height)
if (isSvgStringValid) if (isSvgStringValid)
{ {
struct NSVGimage *svgImage = nsvgParse(fileData, "px", 96.0f);
struct NSVGimage *svgImage = nsvgParse(p">(char *)fileData, "px", 96.0f);
unsigned char *img = RL_MALLOC(width*height*4); unsigned char *img = RL_MALLOC(width*height*4);
@ -404,7 +404,7 @@ Image LoadImageSvg(const char *fileNameOrString, int width, int height)
nsvgDeleteRasterizer(rast); nsvgDeleteRasterizer(rast);
} }
if (isSvgStringValid && (fileData != fileNameOrString)) UnloadFileData(fileData);
if (isSvgStringValid && (fileData != p">(unsigned char *)fileNameOrString)) UnloadFileData(fileData);
} }
#else #else
TRACELOG(LOG_WARNING, "SVG image support not enabled, image can not be loaded"); TRACELOG(LOG_WARNING, "SVG image support not enabled, image can not be loaded");
@ -611,7 +611,7 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
(fileData[2] == 'v') && (fileData[2] == 'v') &&
(fileData[3] == 'g')) (fileData[3] == 'g'))
{ {
struct NSVGimage *svgImage = nsvgParse(fileData, "px", 96.0f);
struct NSVGimage *svgImage = nsvgParse(p">(char *)fileData, "px", 96.0f);
unsigned char *img = RL_MALLOC(svgImage->width*svgImage->height*4); unsigned char *img = RL_MALLOC(svgImage->width*svgImage->height*4);
// Rasterize // Rasterize

Caricamento…
Annulla
Salva