(runahead) Buildfix
This commit is contained in:
parent
360bea85b9
commit
9e07e1a57f
|
@ -107,9 +107,7 @@ char* copy_core_to_temp_file(void)
|
||||||
strcat_alloc(&retroarchTempPath, "retroarch_temp");
|
strcat_alloc(&retroarchTempPath, "retroarch_temp");
|
||||||
strcat_alloc(&retroarchTempPath, path_default_slash());
|
strcat_alloc(&retroarchTempPath, path_default_slash());
|
||||||
|
|
||||||
okay = path_mkdir(retroarchTempPath);
|
if (!path_mkdir(retroarchTempPath))
|
||||||
|
|
||||||
if (!okay)
|
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
if (!filestream_read_file(corePath, &dllFileData, &dllFileSize))
|
if (!filestream_read_file(corePath, &dllFileData, &dllFileSize))
|
||||||
|
@ -117,13 +115,11 @@ char* copy_core_to_temp_file(void)
|
||||||
|
|
||||||
strcat_alloc(&tempDllPath, retroarchTempPath);
|
strcat_alloc(&tempDllPath, retroarchTempPath);
|
||||||
strcat_alloc(&tempDllPath, coreBaseName);
|
strcat_alloc(&tempDllPath, coreBaseName);
|
||||||
okay = filestream_write_file(tempDllPath, dllFileData, dllFileSize);
|
|
||||||
|
|
||||||
if (!okay)
|
if (!filestream_write_file(tempDllPath, dllFileData, dllFileSize))
|
||||||
{
|
{
|
||||||
/* try other file names */
|
/* try other file names */
|
||||||
okay = write_file_with_random_name(&tempDllPath, retroarchTempPath, dllFileData, dllFileSize);
|
if (!write_file_with_random_name(&tempDllPath, retroarchTempPath, dllFileData, dllFileSize))
|
||||||
if (!okay)
|
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,35 +140,36 @@ bool write_file_with_random_name(char **tempDllPath,
|
||||||
const char *retroarchTempPath, const void* data, ssize_t dataSize)
|
const char *retroarchTempPath, const void* data, ssize_t dataSize)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
char numberBuf[32];
|
char number_buf[32];
|
||||||
const char *prefix = "tmp";
|
const char *prefix = "tmp";
|
||||||
time_t timeValue = time(NULL);
|
time_t time_value = time(NULL);
|
||||||
unsigned int numberValue = (unsigned int)timeValue;
|
unsigned int number_value= (unsigned int)time_value;
|
||||||
int number = 0;
|
int number = 0;
|
||||||
char *ext = strcpy_alloc_force(path_get_extension(*tempDllPath));
|
char *ext = strcpy_alloc_force(path_get_extension(*tempDllPath));
|
||||||
int extLen = strlen(ext);
|
int ext_len = strlen(ext);
|
||||||
|
|
||||||
if (extLen > 0)
|
if (ext_len > 0)
|
||||||
{
|
{
|
||||||
strcat_alloc(&ext, ".");
|
strcat_alloc(&ext, ".");
|
||||||
memmove(ext + 1, ext, extLen);
|
memmove(ext + 1, ext, ext_len);
|
||||||
ext[0] = '.';
|
ext[0] = '.';
|
||||||
extLen++;
|
ext_len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try up to 30 'random' filenames before giving up */
|
/* Try up to 30 'random' filenames before giving up */
|
||||||
for (i = 0; i < 30; i++)
|
for (i = 0; i < 30; i++)
|
||||||
{
|
{
|
||||||
numberValue = numberValue * 214013 + 2531011;
|
number_value = number_value * 214013 + 2531011;
|
||||||
number = (numberValue >> 14) % 100000;
|
number = (number_value >> 14) % 100000;
|
||||||
sprintf(numberBuf, "%05d", number);
|
|
||||||
|
snprintf(number_buf, sizeof(number_buf), "%05d", number);
|
||||||
|
|
||||||
FREE(*tempDllPath);
|
FREE(*tempDllPath);
|
||||||
strcat_alloc(tempDllPath, retroarchTempPath);
|
strcat_alloc(tempDllPath, retroarchTempPath);
|
||||||
strcat_alloc(tempDllPath, prefix);
|
strcat_alloc(tempDllPath, prefix);
|
||||||
strcat_alloc(tempDllPath, numberBuf);
|
strcat_alloc(tempDllPath, number_buf);
|
||||||
strcat_alloc(tempDllPath, ext);
|
strcat_alloc(tempDllPath, ext);
|
||||||
okay = filestream_write_file(*tempDllPath, data, dataSize);
|
if (filestream_write_file(*tempDllPath, data, dataSize))
|
||||||
if (okay)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue