Commit 1864ab91 authored by rswindell's avatar rswindell
Browse files

Resolve some new(ish) GCC warnings.

parent 4f84221d
......@@ -81,7 +81,7 @@ void global_settings(void)
sprintf(opt[i++], "%-25s %s", "Use FTN Domain/Zone Map", cfg.use_ftn_domains ? "Enabled" : "Disabled");
sprintf(opt[i++], "%-25s %s", "BSY Mutex File Timeout", duration_to_vstr(cfg.bsy_timeout, duration, sizeof(duration)));
sprintf(opt[i++], "%-25s %s", "BSO Lock Attempt Delay", duration_to_vstr(cfg.bso_lock_delay, duration, sizeof(duration)));
sprintf(opt[i++], "%-25s %u", "BSO Lock Attempt Limit", cfg.bso_lock_attempts);
sprintf(opt[i++], "%-25s %lu", "BSO Lock Attempt Limit", cfg.bso_lock_attempts);
sprintf(opt[i++], "%-25s %u", "Config File Backups", cfg.cfgfile_backups);
opt[i][0] = 0;
uifc.helpbuf=
......@@ -189,7 +189,7 @@ void global_settings(void)
break;
case 7:
sprintf(str, "%u", cfg.bso_lock_attempts);
sprintf(str, "%lu", cfg.bso_lock_attempts);
if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "Maximum BSO Lock Attempts", str, 5, K_EDIT|K_NUMBER) > 0)
cfg.bso_lock_attempts = atoi(str);
break;
......
......@@ -287,6 +287,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
ushort type;
ushort agent;
int32 i32;
uint32 u32;
jsval val;
JSObject* array;
JSObject* field;
......@@ -757,9 +758,9 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
msg->idx.votes=msg->hdr.votes;
}
if(JS_GetProperty(cx, hdr, "auxattr", &val) && !JSVAL_NULL_OR_VOID(val)) {
if(!JS_ValueToUint32(cx,val,&i32))
if(!JS_ValueToUint32(cx,val,&u32))
goto err;
msg->hdr.auxattr=i32;
msg->hdr.auxattr=u32;
}
if(JS_GetProperty(cx, hdr, "netattr", &val) && !JSVAL_NULL_OR_VOID(val)) {
if(!JS_ValueToInt32(cx,val,&i32))
......
......@@ -112,7 +112,7 @@ char DLLCALL c_unescape_char(char ch)
/****************************************************************************/
/* Return character value of C-escaped (\) character literal sequence */
/* supports \x## (hex) and \### sequences (for octal or decimal)
/* supports \x## (hex) and \### sequences (for octal or decimal) */
/****************************************************************************/
char DLLCALL c_unescape_char_ptr(const char* str, char** endptr)
{
......@@ -266,13 +266,13 @@ int64_t DLLCALL parse_byte_count(const char* str, ulong unit)
*/
char* DLLCALL byte_count_to_str(int64_t bytes, char* str, size_t size)
{
if(fmod((double)bytes,1024.0*1024.0*1024.0*1024.0)==0)
if(bytes && fmod((double)bytes,1024.0*1024.0*1024.0*1024.0)==0)
safe_snprintf(str, size, "%gT",bytes/(1024.0*1024.0*1024.0*1024.0));
else if(fmod((double)bytes,1024.0*1024.0*1024.0)==0)
else if(bytes && fmod((double)bytes,1024.0*1024.0*1024.0)==0)
safe_snprintf(str, size, "%gG",bytes/(1024.0*1024.0*1024.0));
else if(fmod((double)bytes,1024.0*1024.0)==0)
else if(bytes && fmod((double)bytes,1024.0*1024.0)==0)
safe_snprintf(str, size, "%gM",bytes/(1024.0*1024.0));
else if(fmod((double)bytes,1024.0)==0)
else if(bytes && fmod((double)bytes,1024.0)==0)
safe_snprintf(str, size, "%gK",bytes/1024.0);
else
safe_snprintf(str, size, "%"PRIi64, bytes);
......@@ -309,15 +309,15 @@ double DLLCALL parse_duration(const char* str)
*/
char* DLLCALL duration_to_str(double value, char* str, size_t size)
{
if(fmod(value,365.0*24.0*60.0*60.0)==0)
if(value && fmod(value,365.0*24.0*60.0*60.0)==0)
safe_snprintf(str, size, "%gY",value/(365.0*24.0*60.0*60.0));
else if(fmod(value,7.0*24.0*60.0*60.0)==0)
else if(value && fmod(value,7.0*24.0*60.0*60.0)==0)
safe_snprintf(str, size, "%gW",value/(7.0*24.0*60.0*60.0));
else if(fmod(value,24.0*60.0*60.0)==0)
else if(value && fmod(value,24.0*60.0*60.0)==0)
safe_snprintf(str, size, "%gD",value/(24.0*60.0*60.0));
else if(fmod(value,60.0*60.0)==0)
else if(value && fmod(value,60.0*60.0)==0)
safe_snprintf(str, size, "%gH",value/(60.0*60.0));
else if(fmod(value,60.0)==0)
else if(value && fmod(value,60.0)==0)
safe_snprintf(str, size, "%gM",value/60.0);
else
safe_snprintf(str, size, "%gS",value);
......@@ -331,28 +331,28 @@ char* DLLCALL duration_to_str(double value, char* str, size_t size)
*/
char* DLLCALL duration_to_vstr(double value, char* str, size_t size)
{
if(fmod(value,365.0*24.0*60.0*60.0)==0) {
if(value && fmod(value,365.0*24.0*60.0*60.0)==0) {
value /= (365.0*24.0*60.0*60.0);
safe_snprintf(str, size, "%g year%s", value, value > 1 ? "s":"");
safe_snprintf(str, size, "%g year%s", value, value == 1 ? "":"s");
}
else if(fmod(value,7.0*24.0*60.0*60.0)==0) {
else if(value && fmod(value,7.0*24.0*60.0*60.0)==0) {
value /= (7.0*24.0*60.0*60.0);
safe_snprintf(str, size, "%g week%s", value, value > 1 ? "s":"");
safe_snprintf(str, size, "%g week%s", value, value == 1 ? "":"s");
}
else if(fmod(value,24.0*60.0*60.0)==0) {
else if(value && fmod(value,24.0*60.0*60.0)==0) {
value /= (24.0*60.0*60.0);
safe_snprintf(str, size, "%g day%s", value, value > 1 ? "s":"");
safe_snprintf(str, size, "%g day%s", value, value == 1 ? "":"s");
}
else if(fmod(value,60.0*60.0)==0) {
else if(value && fmod(value,60.0*60.0)==0) {
value /= (60.0*60.0);
safe_snprintf(str, size, "%g hour%s", value, value > 1 ? "s":"");
safe_snprintf(str, size, "%g hour%s", value, value == 1 ? "":"s");
}
else if(fmod(value,60.0)==0) {
else if(value && fmod(value,60.0)==0) {
value /= 60.0;
safe_snprintf(str, size, "%g minute%s", value, value > 1 ? "s":"");
safe_snprintf(str, size, "%g minute%s", value, value == 1 ? "":"s");
}
else
safe_snprintf(str, size, "%g second%s", value, value > 1 ? "s":"");
safe_snprintf(str, size, "%g second%s", value, value == 1 ? "":"s");
return str;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment