an error on the following declaration, disable it for your
platform. */
-extern char *strdup (const char *s1);
+/*extern char *strdup (const char *s1);*/
/* Eventually, these might deal with making a safe copy or mounting
and unmounting a partition. Until such time as we actually do
struct seekopt {
char filename[256];
uint32 last_time;
- long next_packet;
+ int32 next_packet;
};
static struct seekopt seekOpt[SEEK_OPT_MAX];
int32 SavePacket(EggCarton *cart) {
FILE *fp;
char *packet, datatmp[255], datafile[255], *sp;
- int32 pktime, res;
+ uint32 pktime, res;
pktime = cart->records[0].timestamp;
#ifdef STORAGE_DEBUG
- fprintf(stderr, "SavePacket for %lu: %s", pktime, asctime(gmtime((time_t *) &pktime)));
+ time_t pktime_val = pktime;
+ fprintf(stderr, "SavePacket for %u: %s", pktime, asctime(gmtime(&pktime_val)));
#endif
/* Generate the file name corresponding to the date of
int32 res;
#ifdef STORAGE_DEBUG
- fprintf(stderr, "OpenDatabase: Egg = %d, tindex = %ld %s",
- eggid, tindex, asctime(gmtime((time_t *) &tindex)));
+ time_t tindex_val = tindex;
+ fprintf(stderr, "OpenDatabase: Egg = %d, tindex = %u %s",
+ eggid, tindex, asctime(gmtime(&tindex_val)));
#endif
dbp->eggind = 0;
dbp->fp = NULL;
findex = PROJSTART;
}
#ifdef STORAGE_DEBUG
- fprintf(stderr, "LoadNextPacket(%s, %lu, %d)\n", dbp->fn, tindex, eggid);
+ fprintf(stderr, "LoadNextPacket(%s, %u, %d)\n", dbp->fn, tindex, eggid);
#endif
/* See if the start address for this request is present
seekOpt[i].last_time == tindex) {
fseek(dbp->fp, seekOpt[i].next_packet, SEEK_SET);
#ifdef STORAGE_DEBUG
- fprintf(stderr, "LoadNextPacket; Seek optimised [%ld] to %ld for\n file %s at %lu %s",
+ time_t last_time_val = seekOpt[i].last_time;
+ fprintf(stderr, "LoadNextPacket; Seek optimised [%d] to %d for\n file %s at %u %s",
i,
seekOpt[i].next_packet,
seekOpt[i].filename,
seekOpt[i].last_time,
- asctime(gmtime((time_t *) &(seekOpt[i].last_time))));
+ asctime(gmtime(&last_time_val)));
#endif
break;
}
if (i == seekOptIndex) {
#ifdef STORAGE_DEBUG
- fprintf(stderr, "LoadNextPacket; Cannot optimise seek in file %s\n at %lu %s",
- dbp->fn, tindex, asctime(gmtime((time_t *) &(tindex))));
+ time_t tindex_val = tindex;
+ fprintf(stderr, "LoadNextPacket; Cannot optimise seek in file %s\n at %u %s",
+ dbp->fn, tindex, asctime(gmtime(&tindex_val)));
#endif
break; /* Search wrapped table--cannot optimise */
}
#define SECONDS_PER_DAY (24L * 60 * 60)
findex = ((findex / SECONDS_PER_DAY) + 1) * SECONDS_PER_DAY;
#ifdef STORAGE_DEBUG
- fprintf(stderr, "LoadNextPacket; EOF, CloseDatabase, findex = %lu: %s",
- findex, asctime(gmtime((time_t *) &findex)));
+ time_t findex_val = findex;
+ fprintf(stderr, "LoadNextPacket; EOF, CloseDatabase, findex = %u: %s",
+ findex, asctime(gmtime(&findex_val)));
#endif
if (findex > now) {
#ifdef STORAGE_DEBUG
- fprintf(stderr, "LoadNextPacket; EOF findex = %lu > now = %lu %s",
- findex, now, asctime(gmtime((time_t *) &now)));
+ time_t now_val = now;
+ fprintf(stderr, "LoadNextPacket; EOF findex = %u > now = %u %s",
+ findex, now, asctime(gmtime(&now_val)));
#endif
return ERR_EOF;
}
seekOpt[seekOptIndex].last_time = pktbuf.records[pktbuf.hdr.numrec - 1].timestamp;
seekOpt[seekOptIndex].next_packet = ftell(dbp->fp);
#ifdef STORAGE_DEBUG
- fprintf(stderr, "LoadNextPacket; Seek optimisation[%d] for %s\n to address %ld for time %lu %s",
+ time_t last_time_val = seekOpt[seekOptIndex].last_time;
+ fprintf(stderr, "LoadNextPacket; Seek optimisation[%d] for %s\n to address %d for time %u %s",
seekOptIndex,
seekOpt[seekOptIndex].filename,
seekOpt[seekOptIndex].next_packet,
seekOpt[seekOptIndex].last_time,
- asctime(gmtime((time_t *) &(seekOpt[seekOptIndex].last_time))));
+ asctime(gmtime(&last_time_val)));
#endif
seekOptIndex = (seekOptIndex + 1) % SEEK_OPT_MAX;
return ERR_NONE;
char ldf[255];
#ifdef STORAGE_DEBUG
- fprintf(stderr, "next_filename: egg = %d, mustexist = %d, tindex = %lu %s",
- eggid, mustexist, tindex, asctime(gmtime((time_t *) &tindex)));
+ time_t tindex_val = tindex;
+ fprintf(stderr, "next_filename: egg = %d, mustexist = %d, tindex = %u %s",
+ eggid, mustexist, tindex, asctime(gmtime(&tindex_val)));
#endif
if (eggid < 0 && !mustexist) {
#ifdef STORAGE_DEBUG
int16 eggind;
struct tm *tm;
- tm = gmtime((time_t *) &tindex);
+ time_t time_index = tindex;
+ tm = gmtime(&time_index);
strftime(datatmp, 255, datafmt, tm);
#ifdef STORAGE_DEBUG
- fprintf(stderr, "next_poss_fn: egg = %d, tindex = %lu %s",
+ fprintf(stderr, "next_poss_fn: egg = %d, tindex = %u %s",
eggid, tindex, asctime(tm));
#endif