mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
fixed code style and whitespaces
This commit is contained in:
parent
1ea6100a3b
commit
52da970427
|
@ -314,51 +314,51 @@ public:
|
||||||
|
|
||||||
struct CFindCBData
|
struct CFindCBData
|
||||||
{
|
{
|
||||||
CStorage *pStorage;
|
CStorage *m_pStorage;
|
||||||
const char *pFilename;
|
const char *m_pFilename;
|
||||||
const char *pPath;
|
const char *m_pPath;
|
||||||
char *pBuffer;
|
char *m_pBuffer;
|
||||||
int BufferSize;
|
int m_BufferSize;
|
||||||
unsigned WantedCrc;
|
unsigned m_WantedCrc;
|
||||||
unsigned WantedSize;
|
unsigned m_WantedSize;
|
||||||
bool *pCrcSizeMatch;
|
bool *m_pCrcSizeMatch;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int FindFileCallback(const char *pName, int IsDir, int Type, void *pUser)
|
static int FindFileCallback(const char *pName, int IsDir, int Type, void *pUser)
|
||||||
{
|
{
|
||||||
CFindCBData *Data = static_cast<CFindCBData *>(pUser);
|
CFindCBData *pData = static_cast<CFindCBData *>(pUser);
|
||||||
if(IsDir)
|
if(IsDir)
|
||||||
{
|
{
|
||||||
if(pName[0] == '.')
|
if(pName[0] == '.')
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// search within the folder
|
// search within the folder
|
||||||
char aBuf[MAX_PATH_LENGTH];
|
char aBuf[MAX_PATH_LENGTH];
|
||||||
char aPath[MAX_PATH_LENGTH];
|
char aPath[MAX_PATH_LENGTH];
|
||||||
str_format(aPath, sizeof(aPath), "%s/%s", Data->pPath, pName);
|
str_format(aPath, sizeof(aPath), "%s/%s", pData->m_pPath, pName);
|
||||||
Data->pPath = aPath;
|
pData->m_pPath = aPath;
|
||||||
fs_listdir(Data->pStorage->GetPath(Type, aPath, aBuf, sizeof(aBuf)), FindFileCallback, Type, Data);
|
fs_listdir(pData->m_pStorage->GetPath(Type, aPath, aBuf, sizeof(aBuf)), FindFileCallback, Type, pData);
|
||||||
if(Data->pBuffer[0])
|
if(pData->m_pBuffer[0])
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if(!str_comp(pName, Data->pFilename))
|
else if(!str_comp(pName, pData->m_pFilename))
|
||||||
{
|
{
|
||||||
// found the file
|
// found the file
|
||||||
str_format(Data->pBuffer, Data->BufferSize, "%s/%s", Data->pPath, Data->pFilename);
|
str_format(pData->m_pBuffer, pData->m_BufferSize, "%s/%s", pData->m_pPath, pData->m_pFilename);
|
||||||
|
|
||||||
// check crc and size
|
// check crc and size
|
||||||
if(Data->pCrcSizeMatch != 0)
|
if(pData->m_pCrcSizeMatch != 0)
|
||||||
{
|
{
|
||||||
unsigned Crc = 0;
|
unsigned Crc = 0;
|
||||||
unsigned Size = 0;
|
unsigned Size = 0;
|
||||||
if(!Data->pStorage->GetCrcSize(Data->pBuffer, Type, &Crc, &Size) || Crc != Data->WantedCrc || Size != Data->WantedSize)
|
if(!pData->m_pStorage->GetCrcSize(pData->m_pBuffer, Type, &Crc, &Size) || Crc != pData->m_WantedCrc || Size != pData->m_WantedSize)
|
||||||
{
|
{
|
||||||
*Data->pCrcSizeMatch = false;
|
*pData->m_pCrcSizeMatch = false;
|
||||||
Data->pBuffer[0] = 0;
|
pData->m_pBuffer[0] = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*Data->pCrcSizeMatch = true;
|
*pData->m_pCrcSizeMatch = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -367,24 +367,24 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool FindFile(const char *pFilename, const char *pPath, int Type, char *pBuffer, int BufferSize, unsigned WantedCrc, unsigned WantedSize, bool *pCrcSizeMatch)
|
virtual bool FindFile(const char *pFilename, const char *pPath, int Type, char *pBuffer, int BufferSize, unsigned WantedCrc = 0, unsigned WantedSize = 0, bool *pCrcSizeMatch = 0)
|
||||||
{
|
{
|
||||||
if(BufferSize < 1)
|
if(BufferSize < 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
pBuffer[0] = 0;
|
pBuffer[0] = 0;
|
||||||
*pCrcSizeMatch = false;
|
*pCrcSizeMatch = false;
|
||||||
|
|
||||||
char aBuf[MAX_PATH_LENGTH];
|
char aBuf[MAX_PATH_LENGTH];
|
||||||
CFindCBData Data;
|
CFindCBData Data;
|
||||||
Data.pStorage = this;
|
Data.m_pStorage = this;
|
||||||
Data.pFilename = pFilename;
|
Data.m_pFilename = pFilename;
|
||||||
Data.pPath = pPath;
|
Data.m_pPath = pPath;
|
||||||
Data.pBuffer = pBuffer;
|
Data.m_pBuffer = pBuffer;
|
||||||
Data.BufferSize = BufferSize;
|
Data.m_BufferSize = BufferSize;
|
||||||
Data.WantedCrc = WantedCrc;
|
Data.m_WantedCrc = WantedCrc;
|
||||||
Data.WantedSize = WantedSize;
|
Data.m_WantedSize = WantedSize;
|
||||||
Data.pCrcSizeMatch = pCrcSizeMatch;
|
Data.m_pCrcSizeMatch = pCrcSizeMatch;
|
||||||
|
|
||||||
if(Type == TYPE_ALL)
|
if(Type == TYPE_ALL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue