summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRay <[email protected]>2021-05-30 11:50:32 +0200
committerRay <[email protected]>2021-05-30 11:50:32 +0200
commit0369ec9adf5c6f4838a74e29e049ebc4e3aab14f (patch)
tree3ffd03066df609c0c8a17da90eacb81cd966a2a5
parentc828e481fbee9846721552cb37250a93332ee115 (diff)
downloadraylib-0369ec9adf5c6f4838a74e29e049ebc4e3aab14f.tar.gz
raylib-0369ec9adf5c6f4838a74e29e049ebc4e3aab14f.zip
Some code tweaks
-rw-r--r--src/models.c2
-rw-r--r--src/raudio.c6
-rw-r--r--src/text.c10
-rw-r--r--src/textures.c2
4 files changed, 10 insertions, 10 deletions
diff --git a/src/models.c b/src/models.c
index 1e6bdebe..101677ca 100644
--- a/src/models.c
+++ b/src/models.c
@@ -1027,7 +1027,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
if (instancing)
{
// Create instances buffer
- instanceTransforms = RL_MALLOC(instances*sizeof(float16));
+ instanceTransforms = (float16 *)RL_MALLOC(instances*sizeof(float16));
// Fill buffer with instances transformations as float16 arrays
for (int i = 0; i < instances; i++) instanceTransforms[i] = MatrixToFloatV(transforms[i]);
diff --git a/src/raudio.c b/src/raudio.c
index 639d6cd5..bb009b6e 100644
--- a/src/raudio.c
+++ b/src/raudio.c
@@ -1428,13 +1428,13 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int d
#if defined(SUPPORT_FILEFORMAT_MOD)
else if (TextIsEqual(fileExtLower, ".mod"))
{
- jar_mod_context_t *ctxMod = RL_MALLOC(sizeof(jar_mod_context_t));
+ jar_mod_context_t *ctxMod = (jar_mod_context_t *)RL_MALLOC(sizeof(jar_mod_context_t));
int result = 0;
jar_mod_init(ctxMod);
- // copy data to allocated memory for default UnloadMusicStream
- unsigned char *newData = RL_MALLOC(dataSize);
+ // Copy data to allocated memory for default UnloadMusicStream
+ unsigned char *newData = (unsigned char *)RL_MALLOC(dataSize);
int it = dataSize/sizeof(unsigned char);
for (int i = 0; i < it; i++){
newData[i] = data[i];
diff --git a/src/text.c b/src/text.c
index 23cad7e8..2627e99e 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1272,7 +1272,7 @@ const char *TextSubtext(const char *text, int position, int length)
// Replace text string
// REQUIRES: strstr(), strncpy(), strcpy()
-// WARNING: Internally allocated memory must be freed by the user (if return != NULL)
+// WARNING: Returned buffer must be freed by the user (if return != NULL)
char *TextReplace(char *text, const char *replace, const char *by)
{
// Sanity checks and initialization
@@ -1297,14 +1297,14 @@ char *TextReplace(char *text, const char *replace, const char *by)
for (count = 0; (temp = strstr(insertPoint, replace)); count++) insertPoint = temp + replaceLen;
// Allocate returning string and point temp to it
- temp = result = RL_MALLOC(TextLength(text) + (byLen - replaceLen)*count + 1);
+ temp = result = (char *)RL_MALLOC(TextLength(text) + (byLen - replaceLen)*count + 1);
if (!result) return NULL; // Memory could not be allocated
// First time through the loop, all the variable are set correctly from here on,
- // temp points to the end of the result string
- // insertPoint points to the next occurrence of replace in text
- // text points to the remainder of text after "end of replace"
+ // - 'temp' points to the end of the result string
+ // - 'insertPoint' points to the next occurrence of replace in text
+ // - 'text' points to the remainder of text after "end of replace"
while (count--)
{
insertPoint = strstr(text, replace);
diff --git a/src/textures.c b/src/textures.c
index db562bd9..f46b0c9a 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -1354,7 +1354,7 @@ void ImageResize(Image *image, int newWidth, int newHeight)
if (fastPath)
{
int bytesPerPixel = GetPixelDataSize(1, 1, image->format);
- unsigned char *output = RL_MALLOC(newWidth*newHeight*bytesPerPixel);
+ unsigned char *output = (unsigned char *)RL_MALLOC(newWidth*newHeight*bytesPerPixel);
switch (image->format)
{