@@ -4,11 +4,9 @@
#include "openttd.h"
#include "fileio.h"
#include "functions.h"
#include "string.h"
#include "macros.h"
#include "variables.h"
#if defined(UNIX) || defined(__OS2__)
#include <ctype.h> // required for tolower()
#endif
/*************************************************/
/* FILE IO ROUTINES ******************************/
@@ -114,20 +112,16 @@ bool FiosCheckFileExists(const char *fil
f = fopen(buf, "rb");
#if !defined(WIN32)
if (f == NULL) {
char *s;
// Make lower case and try again
for (s = buf + strlen(_path.data_dir) - 1; *s != 0; s++)
*s = tolower(*s);
if (f == NULL) { // Make lower case and try again
strtolower(buf + strlen(_path.data_dir) - 1);
#if defined SECOND_DATA_DIR
// tries in the 2nd data directory
sprintf(buf, "%s%s", _path.second_data_dir, filename);
for (s = buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
strtolower(buf + strlen(_path.second_data_dir) - 1);
}
@@ -151,18 +145,14 @@ FILE *FioFOpenFile(const char *filename)
@@ -182,19 +172,15 @@ void FioOpenFile(int slot, const char *f
if (f == NULL)
@@ -9,6 +9,7 @@
#include "spritecache.h"
#include "table/sprites.h"
#include "newgrf.h"
#include "md5.h"
@@ -123,10 +124,7 @@ static bool FileMD5(const MD5File file,
// make lower case and check again
for (s = buf + strlen(_path.data_dir) - 1; *s != '\0'; s++)
@@ -4,6 +4,9 @@
#include <stdarg.h>
void ttd_strlcat(char *dst, const char *src, size_t size)
{
@@ -63,3 +66,8 @@ void str_validate(char *str)
for (; *str != '\0'; str++)
if (!IsValidAsciiChar(*str)) *str = '?';
void strtolower(char *str)
for (; *str != '\0'; str++) *str = tolower(*str);
@@ -29,6 +29,9 @@ char* CDECL str_fmt(const char* str, ...
* replaces them with a question mark '?' */
void str_validate(char *str);
/** Convert the given string to lowercase */
void strtolower(char *str);
/** Only allow valid ascii-function codes. Filter special codes like BELL and
* so on [we need a special filter here later]
* @param key character to be checked
Status change: