mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 07:10:01 +00:00
Provide more memory for casepath's arg
This commit is contained in:
parent
40c09d28f7
commit
98ec7bdaf9
|
@ -205,7 +205,7 @@ CStream::CStream(char *filename, ALuint &source, ALuint (&buffers)[NUM_STREAMBUF
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
FILE *test = fopen(filename, "r");
|
FILE *test = fopen(filename, "r");
|
||||||
if (!test) {
|
if (!test) {
|
||||||
char *r = (char*)alloca(strlen(filename) + 2);
|
char *r = (char*)alloca(strlen(filename) + 4);
|
||||||
if (casepath(filename, r))
|
if (casepath(filename, r))
|
||||||
{
|
{
|
||||||
strcpy(m_aFilename, r);
|
strcpy(m_aFilename, r);
|
||||||
|
|
|
@ -189,7 +189,7 @@ GetGTA3ImgSize(void)
|
||||||
realpath(gImgNames[0], path);
|
realpath(gImgNames[0], path);
|
||||||
if (stat(path, &statbuf) == -1) {
|
if (stat(path, &statbuf) == -1) {
|
||||||
// Try case-insensitivity
|
// Try case-insensitivity
|
||||||
char *r = (char*)alloca(strlen(gImgNames[0]) + 2);
|
char *r = (char*)alloca(strlen(gImgNames[0]) + 4);
|
||||||
if (casepath(gImgNames[0], r))
|
if (casepath(gImgNames[0], r))
|
||||||
{
|
{
|
||||||
realpath(r, path);
|
realpath(r, path);
|
||||||
|
@ -460,7 +460,7 @@ CdStreamAddImage(char const *path)
|
||||||
|
|
||||||
// Fix case sensitivity and backslashes.
|
// Fix case sensitivity and backslashes.
|
||||||
if (gImgFiles[gNumImages] == -1) {
|
if (gImgFiles[gNumImages] == -1) {
|
||||||
char *r = (char*)alloca(strlen(path) + 2);
|
char *r = (char*)alloca(strlen(path) + 4);
|
||||||
if (casepath(path, r))
|
if (casepath(path, r))
|
||||||
{
|
{
|
||||||
gImgFiles[gNumImages] = open(r, _gdwCdStreamFlags);
|
gImgFiles[gNumImages] = open(r, _gdwCdStreamFlags);
|
||||||
|
|
|
@ -37,7 +37,7 @@ static myFILE myfiles[NUMFILES];
|
||||||
// Case-insensitivity on linux (from https://github.com/OneSadCookie/fcaseopen)
|
// Case-insensitivity on linux (from https://github.com/OneSadCookie/fcaseopen)
|
||||||
void mychdir(char const *path)
|
void mychdir(char const *path)
|
||||||
{
|
{
|
||||||
char *r = (char*)alloca(strlen(path) + 2);
|
char *r = (char*)alloca(strlen(path) + 4);
|
||||||
if (casepath(path, r))
|
if (casepath(path, r))
|
||||||
{
|
{
|
||||||
chdir(r);
|
chdir(r);
|
||||||
|
@ -88,7 +88,7 @@ found:
|
||||||
// Be case-insensitive on linux (from https://github.com/OneSadCookie/fcaseopen/)
|
// Be case-insensitive on linux (from https://github.com/OneSadCookie/fcaseopen/)
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
if (!myfiles[fd].file) {
|
if (!myfiles[fd].file) {
|
||||||
char *r = (char*)alloca(strlen(newPath) + 2);
|
char *r = (char*)alloca(strlen(newPath) + 4);
|
||||||
if (casepath(newPath, r))
|
if (casepath(newPath, r))
|
||||||
{
|
{
|
||||||
myfiles[fd].file = fopen(r, realmode);
|
myfiles[fd].file = fopen(r, realmode);
|
||||||
|
|
|
@ -379,7 +379,7 @@ RwStream *RwStreamOpen(RwStreamType type, RwStreamAccessType accessType, const v
|
||||||
FILE* first = fopen((char*)pData, "r");
|
FILE* first = fopen((char*)pData, "r");
|
||||||
char *r;
|
char *r;
|
||||||
if (!first) {
|
if (!first) {
|
||||||
r = (char*)alloca(strlen((char*)pData) + 2);
|
r = (char*)alloca(strlen((char*)pData) + 4);
|
||||||
// Use default path(and pass error handling to librw) if we can't find any match
|
// Use default path(and pass error handling to librw) if we can't find any match
|
||||||
if (!casepath((char*)pData, r))
|
if (!casepath((char*)pData, r))
|
||||||
r = (char*)pData;
|
r = (char*)pData;
|
||||||
|
@ -862,7 +862,7 @@ RtBMPImageWrite(RwImage *image, const RwChar *imageName)
|
||||||
char *r = nil;
|
char *r = nil;
|
||||||
FILE *valid = fopen((char *)imageName, "r");
|
FILE *valid = fopen((char *)imageName, "r");
|
||||||
if(!valid) {
|
if(!valid) {
|
||||||
char *r = (char *)alloca(strlen((char *)imageName) + 2);
|
char *r = (char *)alloca(strlen((char *)imageName) + 4);
|
||||||
// Use default path(and pass error handling to librw) if we can't find any match
|
// Use default path(and pass error handling to librw) if we can't find any match
|
||||||
if(!casepath((char *)imageName, r)) r = (char *)imageName;
|
if(!casepath((char *)imageName, r)) r = (char *)imageName;
|
||||||
} else
|
} else
|
||||||
|
@ -880,7 +880,7 @@ RtBMPImageRead(const RwChar *imageName)
|
||||||
char *r = nil;
|
char *r = nil;
|
||||||
FILE *valid = fopen((char *)imageName, "r");
|
FILE *valid = fopen((char *)imageName, "r");
|
||||||
if(!valid) {
|
if(!valid) {
|
||||||
r = (char *)alloca(strlen((char *)imageName) + 2);
|
r = (char *)alloca(strlen((char *)imageName) + 4);
|
||||||
// Use default path(and pass error handling to librw) if we can't find any match
|
// Use default path(and pass error handling to librw) if we can't find any match
|
||||||
if(!casepath((char *)imageName, r)) r = (char *)imageName;
|
if(!casepath((char *)imageName, r)) r = (char *)imageName;
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in a new issue