Change fs usage data from 32 bit to 64 bit

Also stop compiler warnings if compiling md5c.c.
This commit is contained in:
Bill Wilson 2015-07-15 12:32:48 -05:00
parent 285adc8acd
commit 0602b3c15f
8 changed files with 27 additions and 16 deletions

View File

@ -204,7 +204,9 @@ strftime_format(gchar *format, gchar *alt_color)
else
t = &gkrellm_current_tm;
locale_format = g_locale_from_utf8 (format, -1, NULL, NULL, NULL);
locale_format = g_locale_from_utf8(format, -1, NULL, NULL, NULL);
if (!locale_format)
locale_format = g_strdup(format);
strftime(buf1, sizeof(buf1), locale_format, t);
g_free (locale_format);
format_alt_color(buf1, buf2, sizeof(buf2), alt_color);

View File

@ -96,7 +96,7 @@ typedef struct
gulong krell_factor; /* avoid krell math overflow */
gboolean busy;
glong blocks,
gint64 blocks,
bfree,
bavail,
bsize;
@ -236,7 +236,7 @@ gkrellm_fs_add_to_fstab_list(gchar *dir, gchar *dev, gchar *type, gchar *opt)
void
gkrellm_fs_assign_fsusage_data(gpointer fspointer,
glong blocks, glong bavail, glong bfree, glong bsize)
gint64 blocks, gint64 bavail, gint64 bfree, gint64 bsize)
{
FSmon *fs = (FSmon *) fspointer;
@ -358,7 +358,7 @@ static GkrellmSizeAbbrev fs_binary_abbrev[] =
static gint
format_fs_data(FSmon *fs, gchar *src_string, gchar *buf, gint size)
{
glong b, u, a;
gint64 b, u, a;
gint len;
gchar *s;
gchar tbuf[32], ubuf[32], abuf[32];

View File

@ -257,7 +257,7 @@ void gkrellm_fs_client_divert(void (*get_fsusage_func)(),
void (*get_mounts_func)(), void (*get_fstab_func)(),
gboolean (*fstab_modified_func)());
void gkrellm_fs_assign_fsusage_data(gpointer fs,
glong blocks, glong avail, glong free, glong bsize);
gint64 blocks, gint64 avail, gint64 free, gint64 bsize);
void gkrellm_fs_add_to_fstab_list(gchar *dir, gchar *dev, gchar *type,
gchar *options);
void gkrellm_fs_add_to_mounts_list(gchar *dir, gchar *dev, gchar *type);

View File

@ -105,6 +105,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
{
unsigned int count;
unsigned char *p;
uint32 *l;
/* Compute number of bytes mod 64 */
count = (ctx->bits[0] >> 3) & 0x3F;
@ -133,13 +134,21 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
byteReverse(ctx->in, 14);
/* Append length in bits and transform */
((uint32 *) ctx->in)[14] = ctx->bits[0];
((uint32 *) ctx->in)[15] = ctx->bits[1];
/* Avoid compiler warnings */
l = (uint32 *) ctx->in;
l[14] = ctx->bits[0];
l[15] = ctx->bits[1];
// ((uint32 *) ctx->in)[14] = ctx->bits[0];
// ((uint32 *) ctx->in)[15] = ctx->bits[1];
MD5Transform(ctx->buf, (uint32 *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
memmove(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
/* Doesn't make sense, but avoid compiler warning and get same binary */
memset(ctx, 0, sizeof(void *)); /* In case it's sensitive */
// memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
}
/* The four core functions - F1 is optimized somewhat */

View File

@ -310,11 +310,11 @@ gkrellm_sys_fs_get_fsusage(gpointer fs, gchar *dir)
if (!statfs(dir, &st))
#endif
gkrellm_fs_assign_fsusage_data(fs,
(glong) st.f_blocks, (glong) st.f_bavail,
(gint64) st.f_blocks, (gint64) st.f_bavail,
#if (defined(__NetBSD__) && __NetBSD_Version__ >= 299000900) /* NetBSD 2.99.9 */
(glong) st.f_bfree, (glong) st.f_frsize);
(gint64) st.f_bfree, (gint64) st.f_frsize);
#else
(glong) st.f_bfree, (glong) st.f_bsize);
(gint64) st.f_bfree, (gint64) st.f_bsize);
#endif
else
gkrellm_fs_assign_fsusage_data(fs, 0, 0, 0, 0);

View File

@ -369,8 +369,8 @@ gkrellm_sys_fs_get_fsusage(gpointer fs, gchar *dir)
glibtop_fsusage fsusage;
glibtop_get_fsusage(&fsusage, dir);
gkrellm_fs_assign_fsusage_data(fs, (glong) fsusage.blocks,
(glong) fsusage.bavail, (glong) fsusage.bfree, 512);
gkrellm_fs_assign_fsusage_data(fs, (gint64) fsusage.blocks,
(gint64) fsusage.bavail, (gint64) fsusage.bfree, 512);
}
gboolean

View File

@ -1461,8 +1461,8 @@ gkrellm_sys_fs_get_fsusage(gpointer fs, gchar *dir)
if (!statfs(dir, &st))
gkrellm_fs_assign_fsusage_data(fs,
(glong) st.f_blocks, (glong) st.f_bavail,
(glong) st.f_bfree, (glong) st.f_bsize);
(gint64) st.f_blocks, (gint64) st.f_bavail,
(gint64) st.f_bfree, (gint64) st.f_bsize);
else
gkrellm_fs_assign_fsusage_data(fs, 0, 0, 0, 0);
}

View File

@ -969,7 +969,7 @@ gkrellm_sys_fs_get_fsusage(gpointer fs, gchar *dir){
if (dir && statvfs(dir, &st) == 0) {
gkrellm_fs_assign_fsusage_data(fs,
(glong) st.f_blocks, (glong) st.f_bavail,
(gint64) st.f_blocks, (gint64) st.f_bavail,
(glong) st.f_bfree, (glong) st.f_bsize);
} else {
gkrellm_fs_assign_fsusage_data(fs, 0, 0, 0, 0);