Change the size to an guint64 and use the G_GUINT64_FORMAT.
authorNicolas Cornu <nicolas.cornu@ensi-bourges.fr>
Tue, 10 Aug 2010 02:06:46 +0200
changeset 88 8b12ebd75c1a
parent 87 43e7d48f6d84
child 89 88bb2d0f9ff8
Change the size to an guint64 and use the G_GUINT64_FORMAT.
jingle-filetransfer/filetransfer.c
jingle-filetransfer/filetransfer.h
--- a/jingle-filetransfer/filetransfer.c	Tue Aug 10 01:48:51 2010 +0200
+++ b/jingle-filetransfer/filetransfer.c	Tue Aug 10 02:06:46 2010 +0200
@@ -74,6 +74,7 @@
 {
   JingleFT *ft = NULL;
   LmMessageNode *node;
+  gint64 tmpsize;
   const gchar *datestr, *sizestr;
 
   node = lm_message_node_get_child(cn->description, "offer");
@@ -111,15 +112,16 @@
   }
 
   ft->date = from_iso8601(datestr, 1);
-  ft->size = g_ascii_strtoll(sizestr, NULL, 10);
+  tmpsize = g_ascii_strtoll(sizestr, NULL, 10);
 
   // the size attribute is a xs:integer an therefore can be negative.
-  if (ft->size < 0) {
+  if (tmpsize < 0) {
     g_set_error(err, JINGLE_CHECK_ERROR, JINGLE_CHECK_ERROR_BADVALUE,
                 "the offered file has a negative size");
     g_free(ft);
     return NULL;
   }
+  ft->size = tmpsize;
 
   ft->name = g_path_get_basename(ft->name);
   
@@ -286,7 +288,7 @@
 
   node2 = lm_message_node_add_child(node2, "file", NULL);
 
-  size = g_strdup_printf("%lli", jft->size);
+  size = g_strdup_printf("%" G_GUINT64_FORMAT, jft->size);
   
   lm_message_node_set_attributes(node2, "xmlns", NS_SI_FT, "name", jft->name,
                                  "size", size, NULL);
--- a/jingle-filetransfer/filetransfer.h	Tue Aug 10 01:48:51 2010 +0200
+++ b/jingle-filetransfer/filetransfer.h	Tue Aug 10 02:06:46 2010 +0200
@@ -21,7 +21,7 @@
   gchar *name;
 
   /* the size, in bytes, of the data to be sent */
-  gint64 size;
+  guint64 size;
 
   /* descriptor to the output file */
   GIOChannel *outfile;