Because FCGI doesn't support fscanf() and fgetc(), the FILE pointers need to be

wrapped in a call to FCGI_ToFILE().  In the case where FCGI isn't being used
FCGI_ToFILE(x) is defined to (x).

svn path=/trunk/boinc/; revision=5387
This commit is contained in:
Eric J. Korpela 2005-02-10 19:39:37 +00:00
parent 738ddf7b57
commit c05d6d23a0
2 changed files with 7 additions and 7 deletions

View File

@ -46,6 +46,8 @@ using namespace std;
#ifdef _USING_FCGI_
#include "fcgi_stdio.h"
#else
#define FCGI_ToFILE(x) (x)
#endif
const int MIN_SECONDS_TO_SEND = 0;
@ -339,7 +341,6 @@ URLTYPE* read_download_list() {
if (cached) return cached;
#ifndef _USING_FCGI_
if (!(fp=fopen("../download_servers", "r"))) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
@ -357,7 +358,7 @@ URLTYPE* read_download_list() {
}
// read timezone offset and URL from file, and store in cache
// list
if (2==fscanf(fp, "%d %s", &(cached[count].zone), cached[count].name)) {
if (2==fscanf(FCGI_ToFILE(fp), "%d %s", &(cached[count].zone), cached[count].name)) {
count++;
} else {
// provide a null terminator so we don't need to keep
@ -393,7 +394,6 @@ URLTYPE* read_download_list() {
SCHED_MSG_LOG::DEBUG, "zone=%+d url=%s\n", cached[i].zone, cached[i].name
);
}
#endif
return cached;
}

View File

@ -39,6 +39,8 @@
#ifdef _USING_FCGI_
#include "fcgi_stdio.h"
#else
#define FCGI_ToFILE(x) (x)
#endif
static struct random_init {
@ -70,7 +72,6 @@ static bool got_md5_info(
double *nbytes
) {
bool retval=false;
#ifndef _USING_FCGI_
// look for file named FILENAME.md5 containing md5sum and length.
// If found, and newer mod time than file, read md5 sum and file
// length from it.
@ -97,9 +98,9 @@ static bool got_md5_info(
// read two quantities: md5 sum and length. If we can't read
// these, or there is MORE stuff in the file' it's not an md5
// cache file
if (3 == fscanf(fp, "%s %lf%c", md5data, nbytes, &endline) &&
if (3 == fscanf(FCGI_ToFILE(fp), "%s %lf%c", md5data, nbytes, &endline) &&
endline=='\n' &&
EOF==fgetc(fp)
EOF==fgetc(FCGI_ToFILE(fp))
)
retval=true;
fclose(fp);
@ -110,7 +111,6 @@ static bool got_md5_info(
unlink(md5name);
retval=false;
}
#endif
return retval;
}