[TFTPD] Fix compilation, and use the #define MAX_SERVERS where needed instead of hardcoding its value.

This commit is contained in:
Hermès Bélusca-Maïto 2018-03-31 17:04:47 +02:00
parent af57aba104
commit a45713f4c2
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 22 additions and 2 deletions

View file

@ -541,7 +541,7 @@ void processRequest(void *lpParam)
bool allowed = false; bool allowed = false;
#ifdef __REACTOS__ #ifdef __REACTOS__
for (int j = 0; j < _countof(cfig.hostRanges) && cfig.hostRanges[j].rangeStart; j++) for (MYWORD j = 0; j < _countof(cfig.hostRanges) && cfig.hostRanges[j].rangeStart; j++)
#else #else
for (int j = 0; j <= 32 && cfig.hostRanges[j].rangeStart; j++) for (int j = 0; j <= 32 && cfig.hostRanges[j].rangeStart; j++)
#endif #endif
@ -755,7 +755,11 @@ void processRequest(void *lpParam)
continue; continue;
} }
#ifdef __REACTOS__
for (int i = 0; i < MAX_SERVERS; i++)
#else
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
#endif
{ {
//printf("%s=%i\n", req.filename, cfig.homes[i].alias[0]); //printf("%s=%i\n", req.filename, cfig.homes[i].alias[0]);
if (cfig.homes[i].alias[0] && !strcasecmp(req.filename, cfig.homes[i].alias)) if (cfig.homes[i].alias[0] && !strcasecmp(req.filename, cfig.homes[i].alias))
@ -1891,7 +1895,11 @@ void init(void *lpParam)
} }
else if (name[0] && strlen(name) < 64 && value[0]) else if (name[0] && strlen(name) < 64 && value[0])
{ {
#ifdef __REACTOS__
for (int i = 0; i < MAX_SERVERS; i++)
#else
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
#endif
{ {
if (cfig.homes[i].alias[0] && !strcasecmp(name, cfig.homes[i].alias)) if (cfig.homes[i].alias[0] && !strcasecmp(name, cfig.homes[i].alias))
{ {
@ -2050,7 +2058,11 @@ void init(void *lpParam)
if ((f = openSection("ALLOWED-CLIENTS", 1, iniFile))) if ((f = openSection("ALLOWED-CLIENTS", 1, iniFile)))
{ {
#ifdef __REACTOS__
MYWORD i = 0;
#else
int i = 0; int i = 0;
#endif
while (readSection(raw, f)) while (readSection(raw, f))
{ {
@ -2107,7 +2119,7 @@ void init(void *lpParam)
char temp[128]; char temp[128];
#ifdef __REACTOS__ #ifdef __REACTOS__
for (int i = 0; i < _countof(cfig.hostRanges) && cfig.hostRanges[i].rangeStart; i++) for (MYWORD i = 0; i < _countof(cfig.hostRanges) && cfig.hostRanges[i].rangeStart; i++)
#else #else
for (MYWORD i = 0; i <= sizeof(cfig.hostRanges) && cfig.hostRanges[i].rangeStart; i++) for (MYWORD i = 0; i <= sizeof(cfig.hostRanges) && cfig.hostRanges[i].rangeStart; i++)
#endif #endif
@ -2424,7 +2436,11 @@ bool detectChange()
MYDWORD eventWait = UINT_MAX; MYDWORD eventWait = UINT_MAX;
if (cfig.failureCount) if (cfig.failureCount)
#ifdef __REACTOS__
eventWait = 10000 * (1 << cfig.failureCount);
#else
eventWait = 10000 * pow(2, cfig.failureCount); eventWait = 10000 * pow(2, cfig.failureCount);
#endif
OVERLAPPED overlap; OVERLAPPED overlap;
MYDWORD ret; MYDWORD ret;

View file

@ -137,7 +137,11 @@ struct data1
struct data2 struct data2
{ {
WSADATA wsaData; WSADATA wsaData;
#ifdef __REACTOS__
home homes[MAX_SERVERS];
#else
home homes[8]; home homes[8];
#endif
FILE *logfile; FILE *logfile;
data12 hostRanges[32]; data12 hostRanges[32];
char fileRead; char fileRead;