Attached is a patch that resolves about 1/2 of the remaining warings
when compiling at msvc 2005 level 3 with 64 bit warnings.  All of these
shoud be safe to do , and generally take the form of changing the data
declaration types without having to bounds check the data.  I have
additional patches to follow that will require harder decisions to be
made about how to handle them.  All of these changes *should* be safe.
I wil catch up with Kai and Pekka to address the additional warnings
later.


Mike
> -----Original Message-----
> From: Pekka Pessi [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 07, 2006 9:24 AM
> To: Michael Jerris
> Cc: [email protected]; Kai Vehmanen
> Subject: Re: [Sofia-sip-devel] MSVC detected 64 bit issues.
> 
> On 9/7/06, Pekka Pessi <[EMAIL PROTECTED]> wrote:
> > Could you please check if win64 compiler still complains about
size_t
> > truncation?
> 
> I forgot to tell about ai_addrlen. ai_addrlen or tp_addrlen are not
> yet casted explicitly to socklen_t,  so you get warnings there.
> 
> --Pekka
New patches:

[fix msvc 2005 level 3 warnings
[EMAIL PROTECTED] {
hunk ./libsofia-sip-ua/sresolv/sres.c 91
+#include <sofia-sip/su.h>
hunk ./libsofia-sip-ua/su/su_alloc.c 1129
-  int term = -size;
+  int term = -((int)size);
}

[fix safe to fix msvc 2005 level 3 warnings with /w64 by changing many types of 
variables internal to fuctions, to be more strongly typed to function 
prototypes and returns
[EMAIL PROTECTED] {
hunk ./libsofia-sip-ua/http/http_extra.c 157
-      int qlen = span_quoted(s);
+      isize_t qlen = span_quoted(s);
hunk ./libsofia-sip-ua/http/http_extra.c 229
-  int rv = offset;
+  isize_t rv = offset;
hunk ./libsofia-sip-ua/http/http_extra.c 446
-  int rv = offset;
+  isize_t rv = offset;
hunk ./libsofia-sip-ua/http/http_parser.c 87
-  unsigned body_len;
+  size_t body_len;
hunk ./libsofia-sip-ua/http/http_parser.c 329
-    int l1 = 0, l2 = 0, n;
+    size_t l1 = 0, l2 = 0, n;
hunk ./libsofia-sip-ua/ipt/base64.c 94
-      decode[code[i]] = i;
+      decode[code[i]] = (unsigned char)i;
hunk ./libsofia-sip-ua/iptsec/auth_client.c 723
-  int dlen = body ? body->pl_len : 0;
+  usize_t dlen = body ? body->pl_len : 0;
hunk ./libsofia-sip-ua/iptsec/auth_module.c 512
-  int n, upsize;
+  size_t n, upsize;
hunk ./libsofia-sip-ua/msg/msg_header_copy.c 57
-  int n = msg_params_count(pp);
+  size_t n = msg_params_count(pp);
hunk ./libsofia-sip-ua/msg/msg_header_copy.c 71
-  int n = msg_params_count(src);
+  size_t n = msg_params_count(src);
hunk ./libsofia-sip-ua/msg/msg_parser.c 474
-      unsigned n = MSG_CHUNK_AVAIL(pl);
+      size_t n = MSG_CHUNK_AVAIL(pl);
hunk ./libsofia-sip-ua/msg/msg_parser.c 557
-  unsigned n;
+  usize_t n;
hunk ./libsofia-sip-ua/msg/msg_parser.c 1303
-    unsigned current, rest;
+    usize_t current, rest;
hunk ./libsofia-sip-ua/msg/msg_tag.c 197
-  int rv;
+  size_t rv;
hunk ./libsofia-sip-ua/nea/nea_server.c 1219
-  int len = strlen(name);
+  size_t len = strlen(name);
hunk ./libsofia-sip-ua/nta/nta.c 1874
-  int n;
+  isize_t n;
hunk ./libsofia-sip-ua/nta/nta.c 2267
-    int rlen;
+    size_t rlen;
hunk ./libsofia-sip-ua/nta/nta.c 8479
-  int i, hlen;
+  int i;
+  size_t hlen;
hunk ./libsofia-sip-ua/nta/nta.c 8489
-    int plen = strlen(prefix);
+    size_t plen = strlen(prefix);
hunk ./libsofia-sip-ua/nta/nta.c 8602
-  int i, j, order = -1, rlen;
+  int i, j, order = -1;
+  size_t rlen;
hunk ./libsofia-sip-ua/nta/nta.c 8768
-  int i, tlen;
+  int i;
+  size_t tlen;
hunk ./libsofia-sip-ua/nta/sl_read_payload.c 75
-  int n;
+  size_t n;
hunk ./libsofia-sip-ua/nta/sl_utils_log.c 270
-    int n = strncspn(s, end - s, "\r\n");
-    int crlf = strnspn(s + n, end - s - n, "\r\n");
+    size_t n = strncspn(s, end - s, "\r\n");
+    size_t crlf = strnspn(s + n, end - s - n, "\r\n");
hunk ./libsofia-sip-ua/nta/sl_utils_print.c 231
-  int n, crlf = 1, total = 0;
+  size_t n, total = 0, crlf = 1; 
hunk ./libsofia-sip-ua/nth/nth_server.c 904
-    unsigned len = 0;
+    usize_t len = 0;
hunk ./libsofia-sip-ua/nua/outbound.c 269
-    int len = span_token(s);
+    size_t len = span_token(s);
hunk ./libsofia-sip-ua/sdp/sdp.c 434
-  int rv = sizeof(*o);
+  size_t rv = sizeof(*o);
hunk ./libsofia-sip-ua/sdp/sdp.c 459
-  int rv = sizeof(*c);
+  size_t rv = sizeof(*c);
hunk ./libsofia-sip-ua/sdp/sdp.c 482
-  int rv = sizeof(*b);
+  size_t rv = sizeof(*b);
hunk ./libsofia-sip-ua/sdp/sdp.c 506
-  int rv = sizeof(*t);
+  size_t rv = sizeof(*t);
hunk ./libsofia-sip-ua/sdp/sdp.c 572
-  int rv = sizeof(*k);
+  size_t rv = sizeof(*k);
hunk ./libsofia-sip-ua/sdp/sdp.c 597
-  int rv = sizeof(*a);
+  size_t rv = sizeof(*a);
hunk ./libsofia-sip-ua/sdp/sdp.c 623
-  int rv = sizeof(*m);
+  size_t rv = sizeof(*m);
hunk ./libsofia-sip-ua/sdp/sdp.c 751
-  int rv = 0;
+  size_t rv = 0;
hunk ./libsofia-sip-ua/sdp/sdp.c 785
-  int rv = sizeof(*l);
+  size_t rv = sizeof(*l);
hunk ./libsofia-sip-ua/sdp/sdp.c 808
-  int rv = sizeof(*rm);
+  size_t rv = sizeof(*rm);
hunk ./libsofia-sip-ua/sdp/sdp.c 838
-  int rv = 0;
+  size_t rv = 0;
hunk ./libsofia-sip-ua/sdp/sdp.c 900
-  int rv = sizeof(*sdp);
+  size_t rv = sizeof(*sdp);
hunk ./libsofia-sip-ua/sdp/sdp.c 971
-  int rv = sizeof(*sdp);
+  size_t rv = sizeof(*sdp);
hunk ./libsofia-sip-ua/sdp/sdp.c 1083
-  int retval;
+  size_t retval;
hunk ./libsofia-sip-ua/sdp/sdp_print.c 708
-       int size;
+       size_t size;
hunk ./libsofia-sip-ua/sip/sip_basic.c 984
-  int n = strlen(h->sh_call_id->i_id);
+  issize_t n = strlen(h->sh_call_id->i_id);
hunk ./libsofia-sip-ua/sip/sip_basic.c 1047
-  int xtra = su_guid_strlen + 1 + (domain ? strlen(domain) + 1 : 0);
+  size_t xtra = su_guid_strlen + 1 + (domain ? strlen(domain) + 1 : 0);
hunk ./libsofia-sip-ua/sip/sip_parser.c 507
-  unsigned len = 0;
+  usize_t len = 0;
hunk ./libsofia-sip-ua/sip/sip_pref_util.c 339
-  unsigned i, S, N, eq;
+  unsigned i, S, N;
+  size_t eq;
hunk ./libsofia-sip-ua/sip/sip_tag_class.c 135
-    stub[0].t_value = (long)h;
+    stub[0].t_value = (tag_value_t)h;
hunk ./libsofia-sip-ua/sip/sip_util.c 369
-    int n = span_lws(s);
+    isize_t n = span_lws(s);
hunk ./libsofia-sip-ua/stun/stun_common.c 767
-  int error, address_size;
+  int error;
+  size_t address_size;
hunk ./libsofia-sip-ua/su/su_md5.c 144
-  ctx->bits[1] += len >> 29;
+  ctx->bits[1] += (uint32_t)(len >> 29);
hunk ./libsofia-sip-ua/su/su_md5.c 213
-  ctx->bits[1] += len >> 29;
+  ctx->bits[1] += (uint32_t)(len >> 29);
hunk ./libsofia-sip-ua/su/su_md5.c 225
-      mem_i_cpy(p, buf, len);
+      mem_i_cpy(p, buf, (uint32_t)len);
hunk ./libsofia-sip-ua/su/su_md5.c 243
-  mem_i_cpy(ctx->in, buf, len);
+  mem_i_cpy(ctx->in, buf, (uint32_t)len);
hunk ./libsofia-sip-ua/su/su_strlst.c 581
-  int n = sep ? strlen(sep) : 0;
+  size_t n = sep ? strlen(sep) : 0;
hunk ./libsofia-sip-ua/su/su_vector.c 234
-  unsigned index = vector->v_len;
+  size_t index = vector->v_len;
hunk ./libsofia-sip-ua/tport/tport.c 688
-  socklen_t sulen = ai->ai_addrlen;
+  socklen_t sulen = (socklen_t)(ai->ai_addrlen);
hunk ./libsofia-sip-ua/tport/tport.c 690
-  if (bind(socket, ai->ai_addr, ai->ai_addrlen) == -1) {
+  if (bind(socket, ai->ai_addr, sulen) == -1) {
hunk ./libsofia-sip-ua/tport/tport.c 924
-  if (connect(s, ai->ai_addr, ai->ai_addrlen) == SOCKET_ERROR) {
+  if (connect(s, ai->ai_addr, (socklen_t)(ai->ai_addrlen)) == SOCKET_ERROR) {
hunk ./libsofia-sip-ua/tport/tport_logging.c 166
-    int len = iov[i].mv_len;
+    size_t len = iov[i].mv_len;
hunk ./libsofia-sip-ua/tport/tport_type_tcp.c 240
-  msg_set_address(msg, self->tp_addr, self->tp_addrlen);
+  msg_set_address(msg, self->tp_addr, (socklen_t)(self->tp_addrlen));
hunk ./libsofia-sip-ua/tport/tport_type_udp.c 240
-  from = (su_sockaddr_t *)ai->ai_addr, fromlen = ai->ai_addrlen;
+  from = (su_sockaddr_t *)ai->ai_addr, fromlen = (socklen_t)(ai->ai_addrlen);
hunk ./libsofia-sip-ua/url/url.c 1119
-    int len = sizeof(*src) + url_xtra(src), actual;
+    isize_t len = sizeof(*src) + url_xtra(src), actual;
hunk ./libsofia-sip-ua/url/url_tag.c 95
-    dst->t_value = (long)d;
+    dst->t_value = (tag_value_t)d;
}

Context:

[su_win32/sofia-sip/su_configure.h: take 3 on defining suitable values for 
win32/win64. Now use __w64 as explained by Michael Jerris.
[EMAIL PROTECTED] 
[win32/sofia-sip/su_configure.h: using values from <basetsd.h>
[EMAIL PROTECTED]
 
 Always defining isize_t, usize_t as size_t on Windows, issize_t as ssize_t. 
 
 Note that <limits.h> with _POSIX_ on VC uses 16-bit values for SSIZE_MAX,
 for instance.
] 
[sofia-sip/su_types.h: documenting isize_t, issize_t, and usize_t.
[EMAIL PROTECTED] 
[Added a workaround for platforms such as VC6 that do not support %z modifier 
for printing size/ssize_t (a C99 feature).
[EMAIL PROTECTED] 
[Avoid preprocessor warning in tport about redefining version.
[EMAIL PROTECTED] 
[Allow test_nta.c to be built without dirent.h interface.
[EMAIL PROTECTED] 
[Fixed a segfault handling an invalid tagtype in su_taglist.
[EMAIL PROTECTED] 
[Warn users that NUTAG_IDENTITY is not yet implemented.
[EMAIL PROTECTED] 
[Updated TODO list.
[EMAIL PROTECTED] 
[Added ability to select transport to use by passing NTATAG_TPORT() to 
nta_outgoing_*create() functions.
Kai Vehmanen <[EMAIL PROTECTED]>**20060907132931] 
[RELEASE: describing nutag_early_answer, isize_t&co.
[EMAIL PROTECTED] 
[nua: optionally include answer in 1XX response.
[EMAIL PROTECTED]
 
 The SDP answer is included in non-realiable 1XX response, if
 NUTAG_EARLY_ANSWER(1) is included in nua_response() tags, or the user SDP is
 specified with SOATAG_USER_SDP() or SOATAG_USER_SDP_STR() in nua_response()
 tags. 
 
 test_basic_call.c: added test_basic_call_2() for testing the call setup
 where 180 contains the answer and the SDP in 200 OK is ignored.
] 
[win32/sofia-sip/su_configure.h: fixed SU_INTPTR_T definition. Defining 
SIZE_MAX and SSIZE_MAX if needed.
[EMAIL PROTECTED] 
[su_tag_inline.h: fixed t_xtra() return type (size_t instead of int).
[EMAIL PROTECTED] 
[su: using isize_t, usize_t, issize_t in API.
[EMAIL PROTECTED]
 
 Internally using size_t.
] 
[nth_client.c: not using su_salloc().
[EMAIL PROTECTED] 
[nua: using isize_t, size_t.
[EMAIL PROTECTED] 
[nta: using usize_t in tport API.
[EMAIL PROTECTED] 
[sres.c: using size_t.
[EMAIL PROTECTED] 
[su_configure.h.in, sac-su2.m4: added compatibility types for size parameters.
[EMAIL PROTECTED]
 
 Sofia-SIP 1.12 API passes size in int or unsigned int in numerous places.
 Now use typedes isize_t (used instead of int), usize_t (used instead of
 unsigned) and issize_t (used instead of int when returning signed size).
 
 With --disable-size-compat, make API to use size_t or ssize_t instead of
 int/unsigned int.
 
 win32/sofia-sip/su_configure.h: define suitable values for isize_t, usize_t
 and issize_t.
] 
[url module: using isize_t, usize_t, issize_t in API.
[EMAIL PROTECTED] 
[msg module: using isize_t, usize_t, issize_t in API.
[EMAIL PROTECTED]
 
] 
[tport module: using isize_t/usize_t/issize_t in API.
[EMAIL PROTECTED] 
[soa module: using isize_t/usize_t/issize_t in API.
[EMAIL PROTECTED] 
[sdp module: using isize_t in API.
[EMAIL PROTECTED] 
[iptsec: using isize_t, usize_t, issize_t in API.
[EMAIL PROTECTED]
 
 Fixed basic authentication crashing with too long username/password.
] 
[sip module: using isize_t, usize_t, issize_t in API.
[EMAIL PROTECTED] 
[bnf module: using isize_t and issize_t in API.
[EMAIL PROTECTED] 
[http: using isize_t, usize_t, issize_t in API.
[EMAIL PROTECTED]
 
 Internally using size_t/ssize_t.
] 
[tport module: using isize_t, usize_t, issize_t in API.
[EMAIL PROTECTED]
 
 Using internally size_t.
] 
[stun: using isize_t, usize_t, and issize_t in API.
[EMAIL PROTECTED]
 
 Internally, this looks like all mess. 
] 
[tport.c, nta.c. nth_client.c: using msg_addr() sparingly.
[EMAIL PROTECTED] 
[ipt: using isize_t, usize_t, issize_t in API.
[EMAIL PROTECTED]
 
 Internally using size_t.
] 
[fix msvc warnings for hash_value_t
Michael Jerris <[EMAIL PROTECTED]>**20060904182655] 
[Using su_socket() and su_socket_t. Added socket_tag_class, tag_socket_v(), 
tag_socket_vr().
[EMAIL PROTECTED] 
[su module: use socklen_t where appropriate.
[EMAIL PROTECTED]
 
 su.h, su_localinfo.h (li_addrlen), su_addrinfo.c, su_localinfo.c.
] 
[htable.h: allow template user to define hash value type.
[EMAIL PROTECTED]
 
 Added HTABLE_DECLARE_WITH(), HTABLE_PROTOS_WITH(), HTABLE_BODIES_WITH().
] 
[msg.c, sofia-sip/msg_addr.h: removed deprecated function msg_addrlen().
[EMAIL PROTECTED] 
[sresolv: use sres_socket_t in API instead of plain int.
[EMAIL PROTECTED]
 
 sres_socket_t is typedef to SOCKET or int.
] 
[Fixed to in internal nua functions: subsribe->subscribe
[EMAIL PROTECTED] 
[soa_static.c: fixed problem of a new offer not including active codec.
[EMAIL PROTECTED]
 
 test_soa.c: added test for dropping codecs from new offer.
 
 Based on patch by Legostayev Denis.
] 
[nua module: updated doxygen documentation.
[EMAIL PROTECTED] 
[nta_check.c: updated documentation.
[EMAIL PROTECTED] 
[tport module: fixed doxygen file entries.
[EMAIL PROTECTED] 
[RELEASE: updated.
[EMAIL PROTECTED] 
[su_root.c: fixed race condition in su_task_execute().
[EMAIL PROTECTED]
 
 Patch #1552626 by Andrzej Ciarkowski:
 
 While running test_nua example it crashes on
 su_task_execute() (called from test_nat_flush()). The
 function has race condition - call to
 pthread_cond_wait(frame->cond, frame->mutex); may
 happen when memory pointed by frame is already
 deallocated by the message dispatcher. This is clearly
 visible in VC++ Debug builds, as debug version of
 Windows allocator overwrites freed memory with some
 rubbish, so that mutex and cond both point into
 garbage. The frame probably should not be allocated as
 a part of the message.
] 
[test_soa.c: testing codec negotiation when new codecs are added to previously 
rejected media.
[EMAIL PROTECTED] 
[test_soa.c: testing SOATAG_AUDIO_AUX().
[EMAIL PROTECTED] 
[soa_static.c: added new tag SOATAG_AUDIO_AUX() for listing auxiliary codecs.
[EMAIL PROTECTED]
 
 Auxiliary codecs are now included in m=line even if there is no matching
 codec at remote end. They are also ignored when selecting common codecs.
] 
[soa_tag.h, soa_tag.c: added SOATAG_AUDIO_AUX().
[EMAIL PROTECTED] 
[soa_static.c: always upgrade answer if offer has changed.
[EMAIL PROTECTED]
 
 sdp.c: fixed sdp_media_cmp() - now include m_mode in comparison.
 
 Based on bug report and initial patch submitted by Legostayev Denis.
] 
[nta.c, nta.docs: updated stateless callback documentation.
[EMAIL PROTECTED]
 
 Updated documentation of nta_outgoing_tcancel(), too.
] 
[sip_util.c: fixed return value for 405.
[EMAIL PROTECTED] 
[RELEASE: mention UPDATE bug.
[EMAIL PROTECTED] 
[nua_session.c: fixed problem of UAC receiving UPDATE on an early dialog.
[EMAIL PROTECTED]
 
 test_100rel.c: added test for original UAS sending UPDATE.
] 
[msrps:// URL scheme
[EMAIL PROTECTED] 
[test_sresolv warnings
[EMAIL PROTECTED] 
[test_nua_params.c: fixed test of refer_expires.
[EMAIL PROTECTED] 
[TAG not-rel-sofia-sip-ua-1.2.1work2
[EMAIL PROTECTED] 
Patch bundle hash:
b808c4f53c6defeb4a9f6b8233e27f2037e240cf
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sofia-sip-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to