[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-server-cvs
Subject:    [Server-cvs] common/netio/pub sio.h,1.3,1.4
From:       dcollins () helixcommunity ! org
Date:       2010-05-18 17:57:26
Message-ID: 201005181757.o4IHvmOM026826 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/server/common/netio/pub
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv23305/common/netio/pub

Modified Files:
	sio.h 
Log Message:
Synopsis
========
Windows VC10 64-bit-related updates to eliminate several thousand compiler warnings


Branches: HEAD
Suggested Reviewer: Jamie


Description
===========

[Resend to common-dev of the public portions of this diff.]

The attached diffs signficantly reduce the compiler warnings when
building the Helix Server in 64-bit mode with Microsoft VC10.
Warnings are reduced from over 10,000 to ~3,000.

The most common mistakes these correct are listed below.

1) The difference between pointers is potentially a 64-bit value.
This was often being assigned to a 32-bit integer.  In most cases this
is fine since in actuality both pointers point into the same buffer or
string, so the delta between them will be a small value.

2) strlen() returns a size_t value, and again this can be 64-bits.  This
was commonly being used as either the size field to a IHXBuffer::Set()
or SetSize() call.  Since these are ULONG32, this triggers a warning.
Again, this is harmless, I don't believe we will ever deal with strings
too large for a ULONG32.

3) time_t values were being assigned to integers.

4) Several Windows API calls were being passed ints that needed to be
passed DWORD, or other similar Windows API call mistakes.  These were
often harmeless in 32-bits but potentially serious bugs in 64-bits.

5) Windows SOCKETs are not 32-bit integers!  In one case I found they
were being used as the key to CHXMapLongToObj.  I changed it to use the
CHXMapU64ToObj map instead.


For #1 and #2 above, where feasible, variables were changed to be
size_t rather than int/UINT32/etc., unless this introduced a ton of more
warnings, in which case the strlen() or pointer difference would be cast
to the desired type.

In several cases it was far more effective to adjust methods/functions
to allow larger values as arguments.  The following were modified to
allow size_t sizes values (in these cases, the underlying code still only
supports 32-bits in size, but the caller doesn't have to cast the size,
the callee handles this):

  * CHXString constructors
  * NEW_STRING_BUFFER
  * CreateAndSetBufferCCF()
  * CreateSizedBufferCCF()
  * CreateAndSetBufferWithoutAllocCCF()
  * CreateSizedBuffer()
  * SafeSprintf(), SafeStrCat(), SafeStrCpy()
  * IsNumericAddr()


Files Affected
==============

client/common/container/plghand2.cpp
common/container/buffer.cpp
common/container/hxbuffer.cpp
common/container/hxbufferpool.cpp
common/container/hxguid.cpp
common/container/hxmaputils.cpp
common/container/hxstradv.cpp
common/container/hxstrfmt.cpp
common/container/hxstring.cpp
common/container/pub/buffer.h
common/container/pub/growingq.h
common/container/pub/hxbuffer.h
common/container/pub/hxsbuffer.h
common/container/pub/hxstring.h
common/container/pub/timebuff.h
common/fileio/pub/sio.h
common/include/hxmutexlock.h
common/include/rmfftype.h
common/include/rule2flg.h
common/lang/xml/pub/xmlconfig.h
common/netio/pub/platform/posix/nettypes.h
common/runtime/pub/hlxclib/string.h
common/runtime/pub/safestring.h
common/runtime/safestring.cpp
common/system/pub/hxtime.h
common/util/activewrap.cpp
common/util/addupcol.cpp
common/util/asmrulep.cpp
common/util/buffutil.cpp
common/util/char_stack.cpp
common/util/chxcharstack.cpp
common/util/commreg.cpp
common/util/cookies.cpp
common/util/cpacemkr.cpp
common/util/dbcs.cpp
common/util/encstr.cpp
common/util/hxinfcod.cpp
common/util/hxmangle.cpp
common/util/hxprefutil.cpp
common/util/hxstringutil.cpp
common/util/hxstrutl.cpp
common/util/hxurlrep.cpp
common/util/hxurlutil.cpp
common/util/iso639.cpp
common/util/key.cpp
common/util/mimechk.cpp
common/util/netbyte.cpp
common/util/nptime.cpp
common/util/packedvalues.cpp
common/util/pckunpck.cpp
common/util/platform/win/resstr.cpp
common/util/platform/win/win_pref.cpp
common/util/platform/win/wrvsarry.cpp
common/util/platform/win/wrvstrng.cpp
common/util/portaddr.cpp
common/util/pub/basepkt.h
common/util/pub/buffutil.h
common/util/pub/char_stack.h
common/util/pub/hxstrutl.h
common/util/pub/netbyte.h
common/util/pub/nptime.h
common/util/pub/pckunpck.h
common/util/rtsputil.cpp
common/util/tconverter/flpoint/tconverter_flp.h
common/util/tparse.c
common/util/win.pcf
datatype/aiff/fileformat/aiffplin.cpp
datatype/common/include/legacy.h
datatype/image/common/parseurl.cpp
datatype/image/common/pub/gstring.h
datatype/image/common/pub/rpfile.h
datatype/image/common/pxerror.cpp
datatype/image/common/rpparser.cpp
datatype/image/common/wirefmgr.cpp
datatype/mp4/fileformat/pub/qtatoms.h
protocol/rtsp/rtspclnt.cpp
protocol/transport/rtp/pub/rtppkt.h
protocol/transport/rtp/pub/rtpwrap.h
server/common/netio/fsio.cpp
server/common/netio/pub/platform/win/udpio.h
server/common/netio/pub/sio.h
server/common/struct/servbuffer.cpp
server/common/struct/servpckts.cpp
server/common/struct/tsmap.cpp
server/common/util/filecacheable.cpp
server/common/util/header_helper.cpp
server/common/util/mphandle.cpp
server/common/util/packetreordershim.cpp
server/common/util/plgnhand.cpp
server/common/util/ppvtime.cpp
server/common/util/pub/bandcalc.h
server/common/util/pub/livepacketq.h
server/common/util/pub/url.h
server/common/util/rafile.cpp
server/common/util/reglog.cpp
server/common/util/url.cpp
server/common/util/urlparser.cpp
server/engine/core/bcastmgr.cpp
server/engine/core/clientguid.cpp
server/engine/core/clientregtree.cpp
server/engine/core/core_proc.cpp
server/engine/core/loadinfo.cpp
server/engine/core/_main.cpp
server/engine/core/malloc.cpp
server/engine/core/mem_cache.cpp
server/engine/core/memreap_proc.cpp
server/engine/core/platform/win/main.cpp
server/engine/core/platform/win/reg.cpp
server/engine/core/pub/globals.h
server/engine/core/pub/loadinfo.h
server/engine/core/pub/mem_cache.h
server/engine/core/pub/platform/win/callback_container.h
server/engine/core/pub/platform/win/servcallback.h
server/engine/core/pub/server_info.h
server/engine/core/pub/shmem.h
server/engine/core/pub/shmem_od.h
server/engine/core/resolve_proc.cpp
server/engine/core/server_engine.cpp
server/engine/core/server_info.cpp
server/engine/core/shutdown.cpp
server/engine/dataflow/basicpcktflow.cpp
server/engine/dataflow/fsmanager.cpp
server/engine/dataflow/http.cpp
server/engine/session/clientsession.cpp
server/engine/session/server_request.cpp
server/engine/session/source_finder.cpp


Testing Performed
=================

Unit Tests:
- N/A

Integration Tests:
- N/A

Leak Tests:
- N/A

Performance Tests:
- N/A

Platforms Tested: not tested yet, some minimal checks prior to checkin
Build verified: win-x86_64-vc10, win-x86-vc10, 
                linux-rhel5-x86_64, linux-rhel5-x86,
                sunos-5.10-sparc64, sunos-5.10-sparc32


QA Hints
========
* N/A


Index: sio.h
===================================================================
RCS file: /cvsroot/server/common/netio/pub/sio.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sio.h	13 Mar 2003 00:54:00 -0000	1.3
+++ sio.h	18 May 2010 17:57:24 -0000	1.4
@@ -192,17 +192,17 @@
 
 inline int
 SIO::_read_count() {
-    return reader.end - reader.ptr;
+    return (int)(reader.end - reader.ptr);
 }
 
 inline int
 SIO::_read_space() {
-    return reader.creg->limit - reader.end;
+    return (int)(reader.creg->limit - reader.end);
 }
 
 inline off_t
 SIO::read_offset() {
-    return reader.creg->off + (reader.ptr - reader.creg->base);
+    return (off_t)(reader.creg->off + (reader.ptr - reader.creg->base));
 }
 
 inline Byte*
@@ -307,12 +307,12 @@
 
 inline int
 SIO::_write_count() {
-    return writer.end - writer.ptr;
+    return (int)(writer.end - writer.ptr);
 }
 
 inline int
 SIO::_write_space() {
-    return writer.creg->limit - writer.ptr;
+    return (int)(writer.creg->limit - writer.ptr);
 }
 
 inline Byte*
@@ -400,7 +400,7 @@
 
 inline off_t
 SIO::write_offset() {
-    return writer.creg->off + (writer.ptr - writer.creg->base);
+    return (off_t)(writer.creg->off + (writer.ptr - writer.creg->base));
 }
 
 inline void


_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic