Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rtextures] Fix LoadImageAnimFromMemory() warning for fileData #3686

Merged
merged 3 commits into from Dec 28, 2023
Merged

[rtextures] Fix LoadImageAnimFromMemory() warning for fileData #3686

merged 3 commits into from Dec 28, 2023

Conversation

ghost
Copy link

@ghost ghost commented Dec 28, 2023

Changes

  1. Fixes the warning below (introduced after #3681):
rtextures.c: In function ‘LoadImageAnimFromMemory’:
rtextures.c:472:46: warning: pointer targets in passing argument 2 of ‘LoadImageFromMemory’ differ in signedness [-Wpointer-sign]
  472 |         image = LoadImageFromMemory(fileType,fileData,dataSize);
      |                                              ^~~~~~~~
      |                                              |
      |                                              const char *
In file included from rtextures.c:64:
raylib.h:1305:76: note: expected ‘const unsigned char *’ but argument is of type ‘const char *’
 1305 | RLAPI Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize);      // Load image from memory buffer, fileType refers to extension: i.e. '.png'
      |                                                       ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from rtextures.c:216:
  1. Does that by changing const char *fileData to const unsigned char *fileData (R446).

  2. Adds LoadImageAnimFromMemory() to raylib.h (R1305) that was missing.

Edits:

  • 1. added line marks.
  • 2. added function to raylib.h.

{
float alpha = (float)imageCopy2[i].w;
pixels[i].r = (unsigned char)((imageCopy2[i].x)*255.0f);
pixels[i].g = (unsigned char)((imageCopy2[i].y)*255.0f);
pixels[i].b = (unsigned char)((imageCopy2[i].z)*255.0f);
pixels[i].a = (unsigned char)((alpha)*255.0f);
// printf("pixels[%d] = %d", i, pixels[i].r);
// printf("pixels[%d] = %d", i, pixels[i].r);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
@raysan5 raysan5 merged commit fd5e1e6 into raysan5:master Dec 28, 2023
14 checks passed
@raysan5
Copy link
Owner

raysan5 commented Dec 28, 2023

@ubkp thanks for the review!

@ghost ghost deleted the fix/rtextures-warning branch December 28, 2023 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant