Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/eglib
diff options
context:
space:
mode:
authorJeffrey Stedfast <jeff@xamarin.com>2013-08-13 19:59:52 +0400
committerJeffrey Stedfast <jeff@xamarin.com>2013-08-13 19:59:52 +0400
commit91bf902e2e78c6a58df40f7bfd7157aedff5fc11 (patch)
tree2ec0d65b1125d6aa90f2138c919eaae03e2b46de /eglib
parent82219acd3c65ef4939e35e4db6cac561b7e60560 (diff)
Improved fix for g_iconv() compiler warnings
Diffstat (limited to 'eglib')
-rw-r--r--eglib/src/giconv.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/eglib/src/giconv.c b/eglib/src/giconv.c
index 55e2e8a62b8..f70a417f5be 100644
--- a/eglib/src/giconv.c
+++ b/eglib/src/giconv.c
@@ -174,7 +174,7 @@ gsize
g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
gchar **outbytes, gsize *outbytesleft)
{
- size_t inleft, outleft;
+ gsize inleft, outleft;
char *inptr, *outptr;
gunichar c;
int rc = 0;
@@ -183,18 +183,24 @@ g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
if (cd->cd != (iconv_t) -1) {
/* Note: gsize may have a different size than size_t, so we need to
remap inbytesleft and outbytesleft to size_t's. */
- size_t *outleftptr;
+ size_t *outleftptr, *inleftptr;
+ size_t n_outleft, n_inleft;
+
+ if (inbytesleft) {
+ n_inleft = *inbytesleft;
+ inleftptr = &n_inleft;
+ } else {
+ inleftptr = NULL;
+ }
if (outbytesleft) {
- outleft = *outbytesleft;
- outleftptr = &outleft;
+ n_outleft = *outbytesleft;
+ outleftptr = &n_outleft;
} else {
outleftptr = NULL;
}
- inleft = inbytesleft ? *inbytesleft : 0;
-
- return iconv (cd->cd, inbytes, &inleft, outbytes, outleftptr);
+ return iconv (cd->cd, inbytes, inleftptr, outbytes, outleftptr);
}
#endif
@@ -654,7 +660,7 @@ gchar *
g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *from_charset,
gsize *bytes_read, gsize *bytes_written, GError **err)
{
- size_t outsize, outused, outleft, inleft, grow, rc;
+ gsize outsize, outused, outleft, inleft, grow, rc;
char *result, *outbuf, *inbuf;
gboolean flush = FALSE;
gboolean done = FALSE;
@@ -690,7 +696,7 @@ g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *f
else
rc = g_iconv (cd, NULL, NULL, &outbuf, &outleft);
- if (rc == (size_t) -1) {
+ if (rc == (gsize) -1) {
switch (errno) {
case E2BIG:
/* grow our result buffer */