You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by John Vandenberg <ja...@gmail.com> on 2005/06/28 06:09:17 UTC

win32 DWORD and right shift of 32

Hi,

One of the warnings MinGW emits is a bit curious.

/apr/include  -o file_io/win32/readwrite.lo -c
file_io/win32/readwrite.c && touch file_io/win32/readwrite.lo
file_io/win32/readwrite.c: In function `read_with_timeout':
file_io/win32/readwrite.c:70: warning: right shift count >= width of type
file_io/win32/readwrite.c: In function `apr_file_write':
file_io/win32/readwrite.c:245: warning: right shift count >= width of type
file_io/win32/readwrite.c:290: warning: right shift count >= width of type
/bin/sh /libtool --silent --mode=compile gcc -g -O2   -DHAVE_CONFIG_H 
  -I./include -I/d/workpits/apr/include/arch/win32
-I./include/arch/unix -I/d/workpits/apr/include  -o
file_io/win32/seek.lo -c file_io/win32/seek.c && touch
file_io/win32/seek.lo
file_io/win32/seek.c: In function `setptr':
file_io/win32/seek.c:40: warning: right shift count >= width of type
file_io/win32/seek.c: In function `apr_file_seek':
file_io/win32/seek.c:117: warning: right shift count >= width of type
file_io/win32/seek.c:137: warning: left shift count >= width of type
file_io/win32/seek.c: In function `apr_file_trunc':
file_io/win32/seek.c:147: warning: right shift count >= width of type

Is this a general Win32 problem, or is a DWORD in MSVC land 33 bits ?

Cheers,
John

RE: win32 DWORD and right shift of 32

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
John,

  unless you are building only for Win9x (ewww) apr_off_t is 
most definitely not an int.  It needs to resolve to APR_INT64 
or perhaps with gcc, as a long long.  Since your patch carries
on the use of the win32 api (and not faux-posix), it most
definitely can use the whole 64 bit file space.

  I like most of the patch as-is, with a bit of work needed in
apr.h.in and perhaps some stuff to improve on the edges.  I'll
try to commit all but the few files I want to review further
a bit later tonight.  I agree with all of your suggested includes
changes, and that will make the patch we discuss much shorter :)

  Nice work!

Bill



At 11:07 AM 6/28/2005, Dan Johnson wrote:
>apr_file_t.filePtr is of type apr_off_t. On Win32, this is typically an
>int, so shifting it right 32 bits really does zero it.
>
>Dan
>
>Daniel M. Johnson Software Engineer | One Hornet Way, MS 9M52/W6
>Northrop Grumman Integrated Systems | El Segundo, CA 90245-2804
>J-UCAS Vehicle Management Systems | Telephone: (310) 345-5253
>
>
>-----Original Message-----
>From: John Vandenberg [mailto:jayvdb@gmail.com] 
>Sent: Monday, June 27, 2005 9:09 PM
>To: dev@apr.apache.org
>Subject: win32 DWORD and right shift of 32
>
>Hi,
>
>One of the warnings MinGW emits is a bit curious.
>
>/apr/include  -o file_io/win32/readwrite.lo -c
>file_io/win32/readwrite.c && touch file_io/win32/readwrite.lo
>file_io/win32/readwrite.c: In function `read_with_timeout':
>file_io/win32/readwrite.c:70: warning: right shift count >= width of
>type
>file_io/win32/readwrite.c: In function `apr_file_write':
>file_io/win32/readwrite.c:245: warning: right shift count >= width of
>type
>file_io/win32/readwrite.c:290: warning: right shift count >= width of
>type
>/bin/sh /libtool --silent --mode=compile gcc -g -O2   -DHAVE_CONFIG_H 
>  -I./include -I/d/workpits/apr/include/arch/win32
>-I./include/arch/unix -I/d/workpits/apr/include  -o
>file_io/win32/seek.lo -c file_io/win32/seek.c && touch
>file_io/win32/seek.lo
>file_io/win32/seek.c: In function `setptr':
>file_io/win32/seek.c:40: warning: right shift count >= width of type
>file_io/win32/seek.c: In function `apr_file_seek':
>file_io/win32/seek.c:117: warning: right shift count >= width of type
>file_io/win32/seek.c:137: warning: left shift count >= width of type
>file_io/win32/seek.c: In function `apr_file_trunc':
>file_io/win32/seek.c:147: warning: right shift count >= width of type
>
>Is this a general Win32 problem, or is a DWORD in MSVC land 33 bits ?
>
>Cheers,
>John



RE: win32 DWORD and right shift of 32

Posted by Dan Johnson <dm...@nrtc.northrop.com>.
apr_file_t.filePtr is of type apr_off_t. On Win32, this is typically an
int, so shifting it right 32 bits really does zero it.

Dan

Daniel M. Johnson Software Engineer | One Hornet Way, MS 9M52/W6
Northrop Grumman Integrated Systems | El Segundo, CA 90245-2804
J-UCAS Vehicle Management Systems | Telephone: (310) 345-5253


-----Original Message-----
From: John Vandenberg [mailto:jayvdb@gmail.com] 
Sent: Monday, June 27, 2005 9:09 PM
To: dev@apr.apache.org
Subject: win32 DWORD and right shift of 32

Hi,

One of the warnings MinGW emits is a bit curious.

/apr/include  -o file_io/win32/readwrite.lo -c
file_io/win32/readwrite.c && touch file_io/win32/readwrite.lo
file_io/win32/readwrite.c: In function `read_with_timeout':
file_io/win32/readwrite.c:70: warning: right shift count >= width of
type
file_io/win32/readwrite.c: In function `apr_file_write':
file_io/win32/readwrite.c:245: warning: right shift count >= width of
type
file_io/win32/readwrite.c:290: warning: right shift count >= width of
type
/bin/sh /libtool --silent --mode=compile gcc -g -O2   -DHAVE_CONFIG_H 
  -I./include -I/d/workpits/apr/include/arch/win32
-I./include/arch/unix -I/d/workpits/apr/include  -o
file_io/win32/seek.lo -c file_io/win32/seek.c && touch
file_io/win32/seek.lo
file_io/win32/seek.c: In function `setptr':
file_io/win32/seek.c:40: warning: right shift count >= width of type
file_io/win32/seek.c: In function `apr_file_seek':
file_io/win32/seek.c:117: warning: right shift count >= width of type
file_io/win32/seek.c:137: warning: left shift count >= width of type
file_io/win32/seek.c: In function `apr_file_trunc':
file_io/win32/seek.c:147: warning: right shift count >= width of type

Is this a general Win32 problem, or is a DWORD in MSVC land 33 bits ?

Cheers,
John