]> rtime.felk.cvut.cz Git - frescor/forb.git/commitdiff
Fixed warnings on printf() on 64 bit systems
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 12 Jul 2009 14:44:07 +0000 (16:44 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 12 Jul 2009 14:44:07 +0000 (16:44 +0200)
forb-idl/forb-idl-c-headers.c
forb-idl/forb-idl-c-stubs.c
forb-idl/forb-idl-c-typecode.c
forb-idl/forb-idl-c-utils.c
forb-idl/forb-idl-utils.c
src/iop.c
src/object.c
src/proto_inet.c

index 061bd48ade37cbc7f6d6024d48585318136265f1..84375fab4af434d307f93cd5c00a3ec7f0e49454 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <string.h>
 #include <ctype.h>
+#include <inttypes.h>
 
 /* ch = C header */
 static void ch_output_types(IDL_tree tree, OIDL_Run_Info *rinfo, OIDL_C_Info *ci);
@@ -245,7 +246,7 @@ ch_output_var(IDL_tree val, IDL_tree name, OIDL_C_Info *ci)
 
       fprintf(ci->fh, "%s", IDL_IDENT(IDL_TYPE_ARRAY(name).ident).str);
       for(curitem = IDL_TYPE_ARRAY(name).size_list; curitem; curitem = IDL_LIST(curitem).next) {
-       fprintf(ci->fh, "[%" IDL_LL "d]", IDL_INTEGER(IDL_LIST(curitem).data).value);
+       fprintf(ci->fh, "[%" PRId64 "]", IDL_INTEGER(IDL_LIST(curitem).data).value);
       }
     }
     break;
@@ -579,7 +580,7 @@ ch_output_type_dcl(IDL_tree tree, OIDL_Run_Info *rinfo, OIDL_C_Info *ci)
 
                        fprintf (ci->fh, " %s", ctmp);
                        for (sub = IDL_TYPE_ARRAY (ent).size_list; sub; sub = IDL_LIST (sub).next)
-                               fprintf (ci->fh, "[%" IDL_LL "d]",
+                               fprintf (ci->fh, "[%" PRId64 "]",
                                         IDL_INTEGER (IDL_LIST (sub).data).value);
 
                        fprintf (ci->fh, ";\n");
@@ -590,7 +591,7 @@ ch_output_type_dcl(IDL_tree tree, OIDL_Run_Info *rinfo, OIDL_C_Info *ci)
 /*                     fprintf (ci->fh, " %s_slice", ctmp); */
 /*                     for (sub = IDL_LIST (IDL_TYPE_ARRAY (ent).size_list).next; */
 /*                          sub; sub = IDL_LIST (sub).next) */
-/*                             fprintf (ci->fh, "[%" IDL_LL "d]", IDL_INTEGER (IDL_LIST (sub).data).value); */
+/*                             fprintf (ci->fh, "[%" PRId64 "d]", IDL_INTEGER (IDL_LIST (sub).data).value); */
 /*                     fprintf(ci->fh, ";\n"); */
                        }
                        break;
index 60c1f6405832e8f8bcf1ab945aeb32d6cb10a23b..f553283be8ef856bdd7afc1692bad599bf49184d 100644 (file)
@@ -46,7 +46,7 @@ cs_output_stub (IDL_tree     tree,
         fprintf(of, "  if (ev) ev->major = FORB_EX_NONE;\n");
         fprintf(of, "  if (forb_object_is_local(_obj)) {\n");
         fprintf(of, "    if (!_obj->interface ||\n"
-                    "        strncmp(_obj->interface->name, \"%s\", %d) != 0) {\n"
+                    "        strncmp(_obj->interface->name, \"%s\", %zd) != 0) {\n"
                     "      ev->major = FORB_EX_BAD_OPERATION;\n"
                     "      return %s;\n"
                     "    }\n", iface_id, strlen(iface_id), has_retval ? FORB_RETVAL_VAR_NAME : "");
index b267ff288b03518d44461a724f3a6772cc4f8238..c0023fb95cc538b5b6b47e8453c5d713eb790b3e 100644 (file)
@@ -1,6 +1,7 @@
 #include "forb-idl-c-backend.h"
 
 #include <string.h>
+#include <inttypes.h>
 
 typedef struct {
        IDL_tree     ts;
@@ -729,7 +730,7 @@ static void
 forb_output_tcstruct_digits_scale (FILE *fh, IDL_tree node)
 {
        if (IDL_NODE_TYPE (node) == IDLN_TYPE_FIXED) {
-               fprintf (fh, "%" IDL_LL "d, %" IDL_LL "d" ,
+               fprintf (fh, "%" PRId64 ", %" PRId64 ,
                         IDL_INTEGER (IDL_TYPE_FIXED (node).positive_int_const).value,
                         IDL_INTEGER (IDL_TYPE_FIXED (node).integer_lit).value);
        }
index f05b8468870bc7a7663c68f6d7e3c77584fe56ec..3d8aee64d3b5e2c2ebfd8aad71cf821f074e0f9e 100644 (file)
@@ -3,6 +3,7 @@
 #include "forb-idl-c-backend.h"
 
 #include <string.h>
+#include <inttypes.h>
 
 /** 
  * 
@@ -61,7 +62,7 @@ forb_cbe_write_ser_var(FILE *of, IDL_tree ts, IDL_tree name,
                        indent++;
                        for (i=0; i<indent+1; i++)
                                fprintf(of, "  ");
-                       fprintf(of, "for (%c=0; %c<%" IDL_LL "d; %c++) \n",
+                       fprintf(of, "for (%c=0; %c<%" PRId64 "; %c++) \n",
                                var, var, IDL_INTEGER(IDL_LIST(curitem).data).value, var);
                        var++;
                }
@@ -191,7 +192,7 @@ forb_cbe_get_typespec_str(IDL_tree tree)
     }
     break;
   case IDLN_TYPE_FIXED:
-    return g_strdup_printf( "CORBA_fixed_%" IDL_LL "d_%" IDL_LL "d",
+    return g_strdup_printf( "CORBA_fixed_%" PRId64 "_%" PRId64 "",
                     IDL_INTEGER(IDL_TYPE_FIXED(tree).positive_int_const).value,
                     IDL_INTEGER(IDL_TYPE_FIXED(tree).integer_lit).value);
     break;
@@ -434,7 +435,7 @@ forb_cbe_get_const(IDL_tree tree)
     g_string_printf(tmpstr, "%f", IDL_FLOAT(tree).value);
     break;
   case IDLN_INTEGER:
-    g_string_printf(tmpstr, "%" IDL_LL "d", IDL_INTEGER(tree).value);
+    g_string_printf(tmpstr, "%" PRId64 "", IDL_INTEGER(tree).value);
     break;
   case IDLN_STRING:
     g_string_printf(tmpstr, "\"%s\"", IDL_STRING(tree).value);
index bac2f9cc5af8f4c9238d2d378b877da2586be537..759aff281a340d656c766ea8ec3993bd26db8671 100644 (file)
@@ -1,6 +1,7 @@
 #include "config.h"
 #include "forb-idl2.h"
 #include <string.h>
+#include <inttypes.h>
 
 void
 forb_idl_check_oneway_op (IDL_tree op)
@@ -119,7 +120,7 @@ forb_idl_print_node(IDL_tree node, int indent_level)
     break;
 
   case IDLN_INTEGER:
-    g_print("INTEGER: %" IDL_LL "d\n", IDL_INTEGER(node).value);
+    g_print("INTEGER: %" PRId64 "\n", IDL_INTEGER(node).value);
     break;
 
   case IDLN_STRING:
index 94c351d6ddeaefb17f8398c7c83a4298b346f46a..51330693aba314314b387304cfc6f198b840d9a2 100644 (file)
--- a/src/iop.c
+++ b/src/iop.c
@@ -574,7 +574,7 @@ process_message(forb_port_t *port, const forb_iop_message_header *mh,
 
        if (FORB_CDR_data_size(codec) != data_size - mh->message_size) {
                size_t processed = data_size - FORB_CDR_data_size(codec);
-               ul_logmsg("Message of type %d handled incorrectly (size=%d, processed=%d); fixing\n",
+               ul_logmsg("Message of type %d handled incorrectly (size=%d, processed=%zu); fixing\n",
                          mh->message_type, mh->message_size, processed);
                ;
                codec->rptr += mh->message_size - processed;
@@ -610,7 +610,7 @@ void *forb_iop_receiver_thread(void *arg)
                                   &c->buffer[c->wptr],
                                   c->wptr_max - c->wptr);
                if (rcvd < 0) {
-                       ul_logerr("recv returned error %d (%s), exiting\n", rcvd, strerror(errno));
+                       ul_logerr("recv returned error %zd (%s), exiting\n", rcvd, strerror(errno));
                        return NULL;
                }
                c->wptr += rcvd;
index 8b9fedf8e5c7500cbb5b65d2b303342b12ca2127..7fdac275e0129261e8e7e739b256ac4ad2c45e37 100644 (file)
@@ -60,6 +60,7 @@
 #include <forb/cdr_codec.h>
 #include <forb/cdr.h>
 #include "forb_utils.h"
+#include <inttypes.h>
 
 GAVL_CUST_NODE_INT_IMP(forb_objects_nolock /* cust_prefix */,
                       forb_t /* cust_root_t */,
@@ -222,7 +223,7 @@ forb_object_to_string(const forb_object obj)
 
        forb_server_id_to_string(server_id, &obj->server, s);
        key = forb_object_to_key(obj);
-       snprintf(str, s, "%s-%llx", server_id, key);
+       snprintf(str, s, "%s-%"PRIu64, server_id, key);
 
        return str;
 }
@@ -253,7 +254,7 @@ forb_string_to_object(const forb_orb orb, const char *string)
        if (string[2*sizeof(server_id)] != '-')
                return NULL;
 
-       ret = sscanf(&string[2*sizeof(server_id)+1], "%llx", &key);
+       ret = sscanf(&string[2*sizeof(server_id)+1], "%"SCNu64, &key);
        if (ret == 0 || ret == EOF)
                return NULL;
 
index b960f01adb2e8aac0ed0e6d436c810790095c17e..a97b20d417974fad82418b2ffcce0b43046d7e9f 100644 (file)
@@ -244,7 +244,7 @@ inet_send(forb_peer_t *peer, const void *buf, size_t len)
        }
 
        sent = 0;
-       ul_logtrash("send fd=%d len=%d\n", ipeer->socket, len);
+       ul_logtrash("send fd=%d len=%zu\n", ipeer->socket, len);
        do {
                ret = send(ipeer->socket, buf, len, 0);
                if (ret < 0) {
@@ -405,7 +405,7 @@ inet_recv(forb_port_t *port, void *buf, size_t len)
                        iport->last_recv_fd = -1;
                        continue;
                }
-               ul_logtrash("recv fd=%d len=%d\n", iport->last_recv_fd, ret);
+               ul_logtrash("recv fd=%d len=%zd\n", iport->last_recv_fd, ret);
                return ret;
        }
 #else