Revert "- fix linux compile"

This reverts commit b8c0e78c91 et al.

Instead, use the already provided access function I_FindName to get the file name from findstate_t.
Also made the contents of findstate_t private so that use of the access functions is required to retrieve the information and direct access triggers a compile error.
This commit is contained in:
Christoph Oelckers 2017-08-20 08:01:41 +02:00
parent 1ee3239f9e
commit 9878477612
3 changed files with 30 additions and 14 deletions

View file

@ -426,18 +426,19 @@ void FIWadManager::AddIWADCandidates(const char *dir)
{
if (!(I_FindAttr(&findstate) & FA_DIREC))
{
auto p = strrchr(FS_ENTRYNAME, '.');
auto FindName = I_FindName(&findstate);
auto p = strrchr(FindName, '.');
if (p != nullptr)
{
// special IWAD extension.
if (!stricmp(p, ".iwad") || !stricmp(p, ".ipk3") || !stricmp(p, "ipk7"))
{
mFoundWads.Push(FFoundWadInfo{ slasheddir + FS_ENTRYNAME, "", -1 });
mFoundWads.Push(FFoundWadInfo{ slasheddir + FindName, "", -1 });
}
}
for (auto &name : mIWadNames)
{
if (!stricmp(name, FS_ENTRYNAME))
if (!stricmp(name, FindName))
{
mFoundWads.Push(FFoundWadInfo{ slasheddir + name, "", -1 });
}
@ -530,7 +531,7 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
{
for (auto &dir : mSearchPaths)
{
FStringf fullpath("%s/%s", dir.GetChars(), custwad.GetChars());
FStringf fullpath("%s/%s", dir, custwad.GetChars());
if (FileExists(fullpath))
{
mFoundWads.Push({ fullpath, "", -1 });
@ -744,4 +745,4 @@ const FIWADInfo *FIWadManager::FindIWAD(TArray<FString> &wadfiles, const char *i
}
I_SetIWADInfo();
return iwad_info;
}
}

View file

@ -149,9 +149,15 @@ bool I_SetCursor(FTexture *);
struct findstate_t
{
private:
int count;
struct dirent **namelist;
int current;
friend void *I_FindFirst(const char *filespec, findstate_t *fileinfo);
friend int I_FindNext(void *handle, findstate_t *fileinfo);
friend const char *I_FindName(findstate_t *fileinfo);
friend int I_FindAttr(findstate_t *fileinfo);
};
void *I_FindFirst (const char *filespec, findstate_t *fileinfo);
@ -159,7 +165,10 @@ int I_FindNext (void *handle, findstate_t *fileinfo);
int I_FindClose (void *handle);
int I_FindAttr (findstate_t *fileinfo);
#define I_FindName(a) ((a)->namelist[(a)->current]->d_name)
inline const char *I_FindName(findstate_t *fileinfo)
{
return (fileinfo->namelist[fileinfo->current]->d_name);
}
#define FA_RDONLY 1
#define FA_HIDDEN 2
@ -178,7 +187,4 @@ static inline char *strlwr(char *str)
return str;
}
// for the IWAD handling
#define FS_ENTRYNAME findstate.namelist[findstate.current]->d_name
#endif

View file

@ -172,20 +172,32 @@ FString I_GetLongPathName(FString shortpath);
struct findstate_t
{
private:
uint32_t Attribs;
uint32_t Times[3*2];
uint32_t Size[2];
uint32_t Reserved[2];
char Name[MAX_PATH];
char AltName[14];
friend void *I_FindFirst(const char *filespec, findstate_t *fileinfo);
friend int I_FindNext(void *handle, findstate_t *fileinfo);
friend const char *I_FindName(findstate_t *fileinfo);
friend int I_FindAttr(findstate_t *fileinfo);
};
void *I_FindFirst (const char *filespec, findstate_t *fileinfo);
int I_FindNext (void *handle, findstate_t *fileinfo);
int I_FindClose (void *handle);
#define I_FindName(a) ((a)->Name)
#define I_FindAttr(a) ((a)->Attribs)
inline const char *I_FindName(findstate_t *fileinfo)
{
return fileinfo->Name;
}
inline int I_FindAttr(findstate_t *fileinfo)
{
return fileinfo->Attribs;
}
#define FA_RDONLY 0x00000001
#define FA_HIDDEN 0x00000002
@ -193,7 +205,4 @@ int I_FindClose (void *handle);
#define FA_DIREC 0x00000010
#define FA_ARCH 0x00000020
// for the IWAD handling
#define FS_ENTRYNAME findstate.Name
#endif