hopefully the last adjustment to the functions

This commit is contained in:
DissolveDZ 2023-10-01 00:09:30 +02:00
parent d17314e797
commit faab3f7fee

View File

@ -1344,15 +1344,17 @@ Rectangle GetGlyphAtlasRec(Font font, int codepoint)
// Get text length in bytes, check for \0 character // Get text length in bytes, check for \0 character
unsigned int TextLength(const char *text) unsigned int TextLength(const char *text)
{ {
if (!text) unsigned int length = 0;
return 0;
// use strlen since it uses vector operations if (!text)
unsigned int length = strlen(text); return length;
length = strlen(text);
return length; return length;
} }
// Formatting of text with variables to 'embed' // Formatting of text with variables to 'embed'
const char *TextFormat(const char *text, ...) const char *TextFormat(const char *text, ...)
{ {
@ -1411,15 +1413,18 @@ int TextToInteger(const char *text)
// Copy one string to another, returns bytes copied // Copy one string to another, returns bytes copied
int TextCopy(char *dst, const char *src) int TextCopy(char *dst, const char *src)
{ {
int bytes = 0;
if (!dst || !src) if (!dst || !src)
return 0; return bytes;
// use strcpy since it uses vector operations strcpy(dst, src);
unsigned int length = *strcpy(dst, src); bytes = strlen(dst);
return length; return bytes;
} }
// Check if two text string are equal // Check if two text string are equal
// REQUIRES: strcmp() // REQUIRES: strcmp()
bool TextIsEqual(const char *text1, const char *text2) bool TextIsEqual(const char *text1, const char *text2)
@ -1454,7 +1459,6 @@ const char *TextSubtext(const char *text, int position, int length)
memcpy(buffer, text+position, length); memcpy(buffer, text+position, length);
*(buffer + length) = '\0'; *(buffer + length) = '\0';
*(buffer + length + 1) = 0;
return buffer; return buffer;
} }