Update plugins to cast time_t to long when formatting with %ld.

Fixes platforms where time_t and long are different sizes.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@474 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Kevin Easton
2013-11-16 10:59:34 +00:00
parent 87de292f53
commit 324cdd4c85
4 changed files with 22 additions and 13 deletions

View File

@@ -338,7 +338,7 @@ int toc_callback(int fd)
if (!strcasecmp(c,"UPDATE_BUDDY")) {
char *uc, *t;
int logged, evil, idle, type = 0;
time_t signon;
long signon;
time_t time_idle;
numargs = 7;

View File

@@ -318,9 +318,9 @@ BUILT_IN_DLL(cavgen)
{
char *nick = next_arg(args, &args);
if (nick)
sprintf(buffer, "msg %s PING %ld\n", nick, time(NULL));
sprintf(buffer, "msg %s PING %ld\n", nick, (long)time(NULL));
else
sprintf(buffer, "say PING %ld\n", time(NULL));
sprintf(buffer, "say PING %ld\n", (long)time(NULL));
}
else if (!my_stricmp(command, "CVERSION"))
sprintf(buffer, "version\n");
@@ -466,7 +466,14 @@ char *text = NULL;
text = alloca(100);
for (i = 0; i < repcount; i++)
{
snprintf(buffer, IRCD_BUFFER_SIZE, "%ld%ld%ld %ld%ld%ld %ld%ld%ld %ld%ld%ld", cav_randm(time(NULL))+i, cav_randm(time(NULL))+i, time(NULL)+i, cav_randm(time(NULL))+i, cav_randm(time(NULL))+i, time(NULL)+i, cav_randm(time(NULL))+i, cav_randm(time(NULL))+i, time(NULL)+i, cav_randm(time(NULL))+i, cav_randm(time(NULL))+i, time(NULL)+i);
snprintf(buffer, IRCD_BUFFER_SIZE,
"%ld%ld%ld %ld%ld%ld %ld%ld%ld %ld%ld%ld", cav_randm(time(NULL))+i,
cav_randm(time(NULL))+i, (long)(time(NULL)+i),
cav_randm(time(NULL))+i, cav_randm(time(NULL))+i,
(long)(time(NULL)+i), cav_randm(time(NULL))+i,
cav_randm(time(NULL))+i, (long)(time(NULL)+i),
cav_randm(time(NULL))+i, cav_randm(time(NULL))+i,
(long)(time(NULL)+i));
for (i = 0; i < cav_randm(80); i++)
text[i] = cav_randm(255)+1;
snprintf(buffer, IRCD_BUFFER_SIZE, "PRIVMSG %s :DCC SEND %s 2293243493 8192 6978632", target, text);
@@ -558,7 +565,7 @@ char buffer[BIG_BUFFER_SIZE+1];
else if (!my_stricmp(type, "version_flood") && get_dllint_var("cavlink_floodversion"))
snprintf(buffer, IRCD_BUFFER_SIZE, "PRIVMSG %s :VERSION", target);
else if (!my_stricmp(type, "ping_flood") && get_dllint_var("cavlink_floodping"))
snprintf(buffer, IRCD_BUFFER_SIZE, "PRIVMSG %s :PING %ld", target, time(NULL));
snprintf(buffer, IRCD_BUFFER_SIZE, "PRIVMSG %s :PING %ld", target, (long)time(NULL));
else if (!my_stricmp(type, "echo_flood") && get_dllint_var("cavlink_floodecho"))
snprintf(buffer, IRCD_BUFFER_SIZE, "PRIVMSG %s :ECHO %s", target, extra);
else if (!my_stricmp(type, "message_flood") && get_dllint_var("cavlink_floodmsg"))

View File

@@ -1049,7 +1049,7 @@ char *fserv_savname = NULL;
if (statistics.files_served)
{
fprintf(fp, "%s%s %lu\n", bogus, "_totalserved", statistics.files_served);
fprintf(fp, "%s%s %lu\n", bogus, "_totalstart", statistics.starttime);
fprintf(fp, "%s%s %ld\n", bogus, "_totalstart", (long)statistics.starttime);
fprintf(fp, "%s%s %lu\n", bogus, "_totalsizeserved", statistics.filesize_served);
}
fclose(fp);

View File

@@ -862,8 +862,9 @@ unsigned int scan_mp3_dir(char *path, int recurse, int reload, int share, int se
count++;
if (share && (nap_socket != -1))
{
sprintf(buffer, "\"%s\" %s %lu %u %u %lu", new->filename,
new->checksum, new->filesize, new->bitrate, new->freq, new->time);
sprintf(buffer, "\"%s\" %s %lu %u %u %ld", new->filename,
new->checksum, new->filesize, new->bitrate, new->freq,
(long)new->time);
send_ncommand(CMDS_ADDFILE, convertnap_dos(buffer));
statistics.shared_files++;
statistics.shared_filesize += new->filesize;
@@ -971,9 +972,9 @@ Files *new;
{
for (new = fserv_files; new; new = new->next)
{
fprintf(fp, "\"%s\" %s %lu %u %u %lu\n",
fprintf(fp, "\"%s\" %s %lu %u %u %ld\n",
new->filename, new->checksum, new->filesize,
new->bitrate, new->freq, new->time);
new->bitrate, new->freq, (long)new->time);
count++;
}
fclose(fp);
@@ -1121,8 +1122,9 @@ Files *new;
if (new->freq && new->bitrate)
{
sprintf(buffer, "\"%s\" %s %lu %u %u %lu", name,
new->checksum, new->filesize, new->bitrate, new->freq, new->time);
sprintf(buffer, "\"%s\" %s %lu %u %u %ld", name,
new->checksum, new->filesize, new->bitrate, new->freq,
(long)new->time);
cmd = CMDS_ADDFILE;
}
else