Selaa lähdekoodia

Update rtext.c

pull/5170/head
Ray 1 kuukausi sitten
vanhempi
commit
8e52aee853
1 muutettua tiedostoa jossa 3 lisäystä ja 2 poistoa
  1. +3
    -2
      src/rtext.c

+ 3
- 2
src/rtext.c Näytä tiedosto

@ -1461,15 +1461,16 @@ char **LoadTextLines(const char *text, int *count)
} }
char **lines = (char **)RL_CALLOC(lineCount, sizeof(char *)); char **lines = (char **)RL_CALLOC(lineCount, sizeof(char *));
for (int i = 0, l = 0, lineLen = 0; i <= textSize; i++, lineLen++)
for (int i = 0, l = 0, lineLen = 0; i <= textSize; i++)
{ {
if ((text[i] == '\n') || (text[i] == '\0')) if ((text[i] == '\n') || (text[i] == '\0'))
{ {
lines[l] = (char *)RL_CALLOC(lineLen + 1, 1); lines[l] = (char *)RL_CALLOC(lineLen + 1, 1);
strncpy(lines[l], &text[i - lineLen + 1], lineLen - 1);
strncpy(lines[l], &text[i - lineLen], lineLen);
lineLen = 0; lineLen = 0;
l++; l++;
} }
else lineLen++;
} }
*count = lineCount; *count = lineCount;

Ladataan…
Peruuta
Tallenna