Re: More on 64-bit code changes



On Mon, 21 May 2001, Mark Murnane wrote:

> Tim,
> 
> I've gone over your comments on the proposed set of 64-bit changes. 
> I've attached a new diff which basically includes all of the
> uncontroversial changes, i.e. sizes and the like.  I'm still looking at
> some of the others, i.e. hashing, casting macros, etc.
> 
> I'll hopefully have more to add on that subject tomorrow.
> 					
> Anyway, these ones shouldn't cause too much of a problem.


> Index: ghash.c
> ===================================================================
> RCS file: /sgnome/cvsroots/GNOME/glib/ghash.c,v
> retrieving revision 1.26
> diff -u -r1.26 ghash.c
> --- ghash.c	2001/05/04 17:01:53	1.26
> +++ ghash.c	2001/05/21 16:00:20
> @@ -32,6 +32,7 @@
>  #include <config.h>
>  #endif
>  
> +#include <stdio.h>
>  #include "glib.h"
>  

(we usually don't need stdio.h)
what did you add this for here?

> @@ -759,7 +759,7 @@
>  #ifdef P_tmpdir
>        if (!g_tmp_dir)
>         {
> -         int k;
> +         gsize k;
>           g_tmp_dir = g_strdup (P_tmpdir);
>           k = strlen (g_tmp_dir);
>           if (g_tmp_dir[k-1] == G_DIR_SEPARATOR)
> @@ -827,7 +827,7 @@
>          struct passwd pwd;
>  #    ifdef _SC_GETPW_R_SIZE_MAX
>         /* This reurns the maximum length */
> -        guint bufsize = sysconf (_SC_GETPW_R_SIZE_MAX);
> +        guint bufsize = (guint)sysconf (_SC_GETPW_R_SIZE_MAX);
>  #    else /* _SC_GETPW_R_SIZE_MAX */
>          guint bufsize = 64;
>  #    endif /* _SC_GETPW_R_SIZE_MAX */

there's really no need to cast long->int here.

> @@ -130,15 +130,14 @@
> 
>  /* Miscellaneous utility functions
>   */
> -guint                 g_parse_debug_string (const gchar     *string,
> -                                           const GDebugKey *keys,
> -                                           guint            nkeys);
> -
> -gint                  g_snprintf           (gchar       *string,
> +guint                 g_parse_debug_string (const gchar *string,
> +                                           const GDebugKey   *keys,
> +                                           guint        nkeys);
> +glong                 g_snprintf           (gchar       *string,
>                                             gulong       n,
>                                             gchar const *format,
>                                             ...) G_GNUC_PRINTF (3, 4);
> -gint                  g_vsnprintf          (gchar       *string,
> +glong                 g_vsnprintf          (gchar       *string,
>                                             gulong       n,
>                                             gchar const *format,
>                                             va_list      args);

since standard printf() is still returning an int,
g_snprintf and g_vsnprintf should as well.

i'd like to get a final ok from owen before changing
GSource timeouts from int to long (though as i said
in my last mail, i think this change is for the
good, especially since we just revamped that API already).

other than that, the patch looks fine to me.


> 
> Thanks,
> 
> Mark
> 

---
ciaoTJ





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]