hopefully the last adjustment to the functions
This commit is contained in:
parent
d17314e797
commit
faab3f7fee
32
src/rtext.c
32
src/rtext.c
|
|
@ -1342,17 +1342,19 @@ Rectangle GetGlyphAtlasRec(Font font, int codepoint)
|
||||||
// Text strings management functions
|
// Text strings management functions
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// 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;
|
|
||||||
|
if (!text)
|
||||||
|
return length;
|
||||||
|
|
||||||
|
length = strlen(text);
|
||||||
|
|
||||||
// use strlen since it uses vector operations
|
|
||||||
unsigned int 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, ...)
|
||||||
{
|
{
|
||||||
|
|
@ -1409,17 +1411,20 @@ int TextToInteger(const char *text)
|
||||||
|
|
||||||
#if defined(SUPPORT_TEXT_MANIPULATION)
|
#if defined(SUPPORT_TEXT_MANIPULATION)
|
||||||
// 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)
|
||||||
{
|
{
|
||||||
if (!dst || !src)
|
int bytes = 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
// use strcpy since it uses vector operations
|
if (!dst || !src)
|
||||||
unsigned int length = *strcpy(dst, src);
|
return bytes;
|
||||||
|
|
||||||
return length;
|
strcpy(dst, src);
|
||||||
|
bytes = strlen(dst);
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user