Skip to content

Commit 71a35f6

Browse files
committed
Update rexm.c
1 parent 2d8e346 commit 71a35f6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tools/rexm/rexm.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,7 @@ int main(int argc, char *argv[])
10081008
LOG("INFO: Scanning available example (.c) files to be added to collection...\n");
10091009
FilePathList clist = LoadDirectoryFilesEx(exBasePath, ".c", true);
10101010

1011+
// Load examples collection list file (raylib/examples/examples_list.txt)
10111012
char *exList = LoadFileText(exCollectionFilePath);
10121013
char *exListUpdated = (char *)RL_CALLOC(REXM_MAX_BUFFER_SIZE, 1);
10131014
bool listUpdated = false;
@@ -1024,7 +1025,7 @@ int main(int argc, char *argv[])
10241025

10251026
for (int i = 1; i < lineCount; i++)
10261027
{
1027-
if ((TextFindIndex(exListUpdated, exListLines[i]) == -1) || (exListLines[i][0] == '#'))
1028+
if ((TextFindIndex(exListUpdated, exListLines[i]) == -1) || (exListLines[i][0] == '#'))
10281029
exListUpdatedOffset += sprintf(exListUpdated + exListUpdatedOffset, "%s\n", exListLines[i]);
10291030
else listUpdated = true;
10301031
}
@@ -2328,7 +2329,7 @@ static rlExampleInfo *LoadExampleInfo(const char *exFileName)
23282329
// Example found in collection
23292330
exInfo = (rlExampleInfo *)RL_CALLOC(1, sizeof(rlExampleInfo));
23302331

2331-
strcpy(exInfo->name, GetFileNameWithoutExt(exFileName));
2332+
strncpy(exInfo->name, GetFileNameWithoutExt(exFileName), 128 - 1);
23322333
strncpy(exInfo->category, exInfo->name, TextFindIndex(exInfo->name, "_"));
23332334

23342335
char *exText = LoadFileText(exFileName);
@@ -2511,7 +2512,7 @@ static char **LoadExampleResourcePaths(const char *filePath, int *resPathCount)
25112512
if (!end) break;
25122513

25132514
// WARNING: Some paths could be for saving files, not loading, those "resource" files must be omitted
2514-
// HACK: Just check previous position from pointer for function name including the string and the index "distance"
2515+
// TODO: HACK: Just check previous position from pointer for function name including the string and the index "distance"
25152516
// This is a quick solution, the good one would be getting the data loading function names...
25162517
int functionIndex01 = TextFindIndex(ptr - 40, "ExportImage"); // Check ExportImage()
25172518
int functionIndex02 = TextFindIndex(ptr - 10, "TraceLog"); // Check TraceLog()
@@ -2869,8 +2870,8 @@ static void UpdateWebMetadata(const char *exHtmlPath, const char *exFilePath)
28692870
char exTitle[64] = { 0 }; // Example title: fileName without extension, replacing underscores by spaces
28702871

28712872
// Get example name: replace underscore by spaces
2872-
strcpy(exName, GetFileNameWithoutExt(exHtmlPathCopy));
2873-
strcpy(exTitle, exName);
2873+
strncpy(exName, GetFileNameWithoutExt(exHtmlPathCopy), 64 - 1);
2874+
strncpy(exTitle, exName, 64 - 1);
28742875
for (int i = 0; (i < 256) && (exTitle[i] != '\0'); i++) { if (exTitle[i] == '_') exTitle[i] = ' '; }
28752876

28762877
// Get example category from exName: copy until first underscore

0 commit comments

Comments
 (0)