Fixed int/size_t mismatches (deadly on 64-bit platforms).
authorZdeněk Salvet <salvet@ics.muni.cz>
Mon, 29 Nov 2004 19:12:51 +0000 (19:12 +0000)
committerZdeněk Salvet <salvet@ics.muni.cz>
Mon, 29 Nov 2004 19:12:51 +0000 (19:12 +0000)
org.glite.lb.client/src/prod_proto.c
org.glite.lb.common/src/mini_http.c
org.glite.lb.logger/src/logd_proto.c
org.glite.lb.logger/src/send_event.c
org.glite.lb.server/src/il_lbproxy.c
org.glite.lb.server/src/il_notification.c
org.glite.lb.server/src/ws_plugin.c

index 3709ada..1428f85 100644 (file)
@@ -31,7 +31,7 @@ int edg_wll_log_proto_client(edg_wll_Context context, edg_wll_GssConnection *con
        int     err;
        int     answer;
        u_int8_t answer_end[4];
-       int     count;
+       size_t  count;
        int     size;
        u_int8_t size_end[4];
        edg_wll_GssStatus gss_code;
index 5890ec4..99282be 100644 (file)
@@ -256,7 +256,7 @@ error:
 
 static int real_write(edg_wll_Context ctx, edg_wll_GssConnection *con,const char *data,int len)
 {
-       int     total = 0;
+       size_t  total = 0;
        struct sigaction        sa,osa;
        edg_wll_GssStatus       gss_code;
        int     ret;
index 6235592..463266a 100644 (file)
@@ -38,7 +38,7 @@ int edg_wll_ll_log_level;
  *----------------------------------------------------------------------
  */
 static int send_answer_back(edg_wll_GssConnection *con, int answer, struct timeval *timeout) {
-       int count = 0;
+       size_t count = 0;
        int err = 0;
        int ans = answer;
        u_int8_t ans_end[4];
@@ -310,7 +310,8 @@ int edg_wll_log_proto_server(edg_wll_GssConnection *con, char *name, char *prefi
        char    *buf,*dglllid,*dguser,*jobId,*name_esc;
        char    header[EDG_WLL_LOG_SOCKET_HEADER_LENGTH+1];
        char    outfilename[FILENAME_MAX];
-       int     count,count_total,size;
+       size_t  count;
+       int     count_total,size;
        u_int8_t size_end[4];
        size_t  msg_size,dglllid_size,dguser_size;
        int     i,answer,answer_sent;
index 83de250..5d8958f 100644 (file)
@@ -102,7 +102,8 @@ get_reply(struct event_queue *eq, char **buf, int *code_min)
 {
   char buffer[17];
   char *msg, *p;
-  int len, code, l;
+  int inlen, code;
+  size_t len, l;
   edg_wll_GssConnection *gss;
   struct timeval tv;
   edg_wll_GssStatus gss_stat;
@@ -126,11 +127,12 @@ get_reply(struct event_queue *eq, char **buf, int *code_min)
     
   buffer[16] = 0;
 
-  sscanf(buffer, "%d", &len);
-  if(len > MAXLEN) {
+  sscanf(buffer, "%d", &inlen);
+  if(inlen < 0 || inlen > MAXLEN) {
     set_error(IL_PROTO, LB_NOMEM, "get_reply: error reading reply length");
     return(-1);
   }
+  len = (size_t) inlen;
 
   /* allocate room for message body */
   if((msg = malloc(len)) == NULL) {
@@ -251,7 +253,8 @@ event_queue_send(struct event_queue *eq)
   while (!event_queue_empty(eq)) {
     struct server_msg *msg;
     char *rep;
-    int  ret, code, code_min, bytes_sent;
+    int  ret, code, code_min;
+    size_t bytes_sent;
     struct timeval tv;
     edg_wll_GssStatus gss_stat;
 
index 053ec33..e4c228b 100644 (file)
@@ -243,7 +243,8 @@ notif_send_socket(edg_wll_Context       context,
 {
        int ret;
        struct sockaddr_un saddr;
-       int msg_sock, flags, count;
+       int msg_sock, flags;
+       size_t count;
        struct timeval timeout;
 
        timeout.tv_sec = EDG_WLL_LOG_TIMEOUT_MAX;
index 88a699a..bccc008 100644 (file)
@@ -239,7 +239,8 @@ notif_send_socket(edg_wll_Context       context,
 {
        int ret;
        struct sockaddr_un saddr;
-       int msg_sock, flags, count;
+       int msg_sock, flags;
+       size_t count;
        struct timeval timeout;
 
        timeout.tv_sec = EDG_WLL_LOG_TIMEOUT_MAX;
index 6a3df26..926c26b 100644 (file)
@@ -130,8 +130,8 @@ static int edg_wll_ws_send(struct soap *soap, const char *buf, size_t bufsz)
        edg_wll_Context         ctx = (edg_wll_Context) soap_lookup_plugin(soap, plugin_id);
        edg_wll_GssStatus       gss_code;
        struct sigaction        sa, osa;
-       int                                     total = 0,
-                                               ret;
+       size_t                  total = 0;
+       int                     ret;
 
 
        edg_wll_ResetError(ctx);