Commit 98d552e0 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

Consistently use gsize rather than size_t. (#333310, Morten Welinder)

2006-12-27  Matthias Clasen  <mclasen@redhat.com>

        * glib/gconvert.[hc]:
        * glib/gfileutils.c:
        * glib/giochannel.c:
        * glib/goption.c:
        * glib/gspawn.c:
        * glib/gunicollate.c:
        * glib/gutils.c:
        * tests/timeloop-basic.c:
        Consistently use gsize rather than size_t.  (#333310,
        Morten Welinder)
parent f678ea97
2006-12-27 Matthias Clasen <mclasen@redhat.com>
* glib/gconvert.[hc]:
* glib/gfileutils.c:
* glib/giochannel.c:
* glib/goption.c:
* glib/gspawn.c:
* glib/gunicollate.c:
* glib/gutils.c:
* tests/timeloop-basic.c:
Consistently use gsize rather than size_t. (#333310,
Morten Welinder)
2006-12-27 Matthias Clasen <mclasen@redhat.com>
* configure.in: Use AC_CACHE_CHECK for the nl_langinfo
......
......@@ -157,7 +157,7 @@ g_iconv_open (const gchar *to_codeset,
*
* Return value: count of non-reversible conversions, or -1 on error
**/
size_t
gsize
g_iconv (GIConv converter,
gchar **inbuf,
gsize *inbytes_left,
......@@ -596,7 +596,7 @@ g_convert_with_iconv (const gchar *str,
{
err = g_iconv (converter, (char **)&p, &inbytes_remaining, &outp, &outbytes_remaining);
if (err == (size_t) -1)
if (err == (gsize) -1)
{
switch (errno)
{
......@@ -606,7 +606,7 @@ g_convert_with_iconv (const gchar *str,
break;
case E2BIG:
{
size_t used = outp - dest;
gsize used = outp - dest;
outbuf_size *= 2;
dest = g_realloc (dest, outbuf_size);
......@@ -880,11 +880,11 @@ g_convert_with_fallback (const gchar *str,
while (!done && !have_error)
{
size_t inbytes_tmp = inbytes_remaining;
gsize inbytes_tmp = inbytes_remaining;
err = g_iconv (cd, (char **)&p, &inbytes_tmp, &outp, &outbytes_remaining);
inbytes_remaining = inbytes_tmp;
if (err == (size_t) -1)
if (err == (gsize) -1)
{
switch (errno)
{
......@@ -893,7 +893,7 @@ g_convert_with_fallback (const gchar *str,
break;
case E2BIG:
{
size_t used = outp - dest;
gsize used = outp - dest;
outbuf_size *= 2;
dest = g_realloc (dest, outbuf_size);
......
......@@ -27,7 +27,6 @@
#ifndef __G_CONVERT_H__
#define __G_CONVERT_H__
#include <stddef.h> /* For size_t */
#include <glib/gerror.h>
G_BEGIN_DECLS
......@@ -51,7 +50,7 @@ typedef struct _GIConv *GIConv;
GIConv g_iconv_open (const gchar *to_codeset,
const gchar *from_codeset);
size_t g_iconv (GIConv converter,
gsize g_iconv (GIConv converter,
gchar **inbuf,
gsize *inbytes_left,
gchar **outbuf,
......
......@@ -525,10 +525,10 @@ get_contents_stdio (const gchar *display_filename,
GError **error)
{
gchar buf[4096];
size_t bytes;
gsize bytes;
gchar *str = NULL;
size_t total_bytes = 0;
size_t total_allocated = 0;
gsize total_bytes = 0;
gsize total_allocated = 0;
gchar *tmp;
g_assert (f != NULL);
......@@ -613,9 +613,9 @@ get_contents_regfile (const gchar *display_filename,
GError **error)
{
gchar *buf;
size_t bytes_read;
size_t size;
size_t alloc_size;
gsize bytes_read;
gsize size;
gsize alloc_size;
size = stat_buf->st_size;
......@@ -954,7 +954,7 @@ write_to_temp_file (const gchar *contents,
if (length > 0)
{
size_t n_written;
gsize n_written;
errno = 0;
......
......@@ -1263,7 +1263,7 @@ g_io_channel_fill_buffer (GIOChannel *channel,
if (channel->do_encode)
{
size_t errnum, inbytes_left, outbytes_left;
gsize errnum, inbytes_left, outbytes_left;
gchar *inbuf, *outbuf;
int errval;
......@@ -1297,7 +1297,7 @@ reencode:
g_string_truncate (channel->encoded_read_buf,
channel->encoded_read_buf->len - outbytes_left);
if (errnum == (size_t) -1)
if (errnum == (gsize) -1)
{
switch (errval)
{
......@@ -2055,7 +2055,7 @@ g_io_channel_write_chars (GIOChannel *channel,
{
const gchar *from_buf;
gsize from_buf_len, from_buf_old_len, left_len;
size_t err;
gsize err;
gint errnum;
if (channel->partial_write_buf[0] != '\0')
......@@ -2102,29 +2102,29 @@ reconvert:
if (try_len == from_buf_len)
{
errnum = EINVAL;
err = (size_t) -1;
err = (gsize) -1;
}
else
{
errnum = 0;
err = (size_t) 0;
err = (gsize) 0;
}
break;
case -1:
g_warning ("Invalid UTF-8 passed to g_io_channel_write_chars().");
/* FIXME bail here? */
errnum = EILSEQ;
err = (size_t) -1;
err = (gsize) -1;
break;
default:
g_assert_not_reached ();
err = (size_t) -1;
err = (gsize) -1;
errnum = 0; /* Don't confunse the compiler */
}
}
else
{
err = (size_t) 0;
err = (gsize) 0;
errnum = 0;
left_len = from_buf_len - try_len;
}
......@@ -2149,7 +2149,7 @@ reconvert:
- space_in_buf);
}
if (err == (size_t) -1)
if (err == (gsize) -1)
{
switch (errnum)
{
......
......@@ -1476,8 +1476,8 @@ g_execute (const gchar *file,
gboolean got_eacces = 0;
const gchar *path, *p;
gchar *name, *freeme;
size_t len;
size_t pathlen;
gsize len;
gsize pathlen;
path = g_getenv ("PATH");
if (path == NULL)
......
......@@ -32,10 +32,10 @@
#ifdef _MSC_VER
/* Workaround for bug in MSVCR80.DLL */
static size_t
static gsize
msc_strxfrm_wrapper (char *string1,
const char *string2,
size_t count)
gsize count)
{
if (!string1 || count <= 0)
{
......@@ -200,14 +200,14 @@ g_utf8_collate_key (const gchar *str,
gssize len)
{
gchar *result;
size_t xfrm_len;
gsize xfrm_len;
#ifdef __STDC_ISO_10646__
gunichar *str_norm;
wchar_t *result_wc;
size_t i;
size_t result_len = 0;
gsize i;
gsize result_len = 0;
g_return_val_if_fail (str != NULL, NULL);
......
......@@ -391,8 +391,8 @@ g_find_program_in_path (const gchar *program)
wchar_t wfilename[MAXPATHLEN], wsysdir[MAXPATHLEN],
wwindir[MAXPATHLEN];
#endif
size_t len;
size_t pathlen;
gsize len;
gsize pathlen;
g_return_val_if_fail (program != NULL, NULL);
......
......@@ -33,8 +33,8 @@ my_pipe (int *fds)
int
read_all (int fd, char *buf, int len)
{
size_t bytes_read = 0;
ssize_t count;
gsize bytes_read = 0;
gssize count;
while (bytes_read < len)
{
......@@ -56,8 +56,8 @@ read_all (int fd, char *buf, int len)
int
write_all (int fd, char *buf, int len)
{
size_t bytes_written = 0;
ssize_t count;
gsize bytes_written = 0;
gssize count;
while (bytes_written < len)
{
......
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