summaryrefslogtreecommitdiffhomepage
path: root/src/text.c
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2020-05-06 19:12:09 +0200
committerraysan5 <[email protected]>2020-05-06 19:12:09 +0200
commitfdad1f023b0f4de982957a3baaa41b0ac2666748 (patch)
tree3701a104fc5e3250e9e81f8ee46ea4cf3deef824 /src/text.c
parent9a1e934621b6098093d709ceb149f1bb995c15cc (diff)
downloadraylib-fdad1f023b0f4de982957a3baaa41b0ac2666748.tar.gz
raylib-fdad1f023b0f4de982957a3baaa41b0ac2666748.zip
Avoid all MSVC compile warnings
Most warning were related to types conversion (casting required) and unsigned/signed types comparisons. Added preprocessor directives (_CRT_SECURE_NO_DEPRECATE; _CRT_NONSTDC_NO_DEPRECATE) to avoid warnings about unsafe functions, those functions are safe while used properly and recommended alternatives are MS only. Some external libraries still generate warnings.
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/text.c b/src/text.c
index 1bd8a0f8..78c734d8 100644
--- a/src/text.c
+++ b/src/text.c
@@ -957,7 +957,7 @@ void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, f
bool isGlyphSelected = false;
if ((selectStart >= 0) && (k >= selectStart) && (k < (selectStart + selectLength)))
{
- DrawRectangleRec((Rectangle){ rec.x + textOffsetX - 1, rec.y + textOffsetY, glyphWidth, (int)((float)font.baseSize*scaleFactor) }, selectBackTint);
+ DrawRectangleRec((Rectangle){ rec.x + textOffsetX - 1, rec.y + textOffsetY, (float)glyphWidth, (float)font.baseSize*scaleFactor }, selectBackTint);
isGlyphSelected = true;
}
@@ -1229,7 +1229,7 @@ char *TextReplace(char *text, const char *replace, const char *by)
while (count--)
{
insertPoint = strstr(text, replace);
- lastReplacePos = insertPoint - text;
+ lastReplacePos = (int)(insertPoint - text);
temp = strncpy(temp, text, lastReplacePos) + lastReplacePos;
temp = strcpy(temp, by) + byLen;
text += lastReplacePos + replaceLen; // Move to next "end of replace"
@@ -1346,7 +1346,7 @@ int TextFindIndex(const char *text, const char *find)
char *ptr = strstr(text, find);
- if (ptr != NULL) position = ptr - text;
+ if (ptr != NULL) position = (int)(ptr - text);
return position;
}