apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Allan Edwards <a...@us.ibm.com>
Subject Re: Windows 2003 IA64 builds?
Date Tue, 17 Aug 2004 22:29:34 GMT
Here's a snapshot of work in progress. This patch
is against HEAD but I'm actually developing on the
0.9 branch and with Visual Studio 6 + IA64 SDK
cross compile.

As I mentioned in my previous note there are a lot
of warnings thrown when compiling 64 bit and this
just hits the low lying fruit for /W2 compile and
eliminates a couple of obvious bugs.

What is a little puzzling is that most of the
remaining  warnings are in common code, but it
appears that a Linux IA64 build is pretty clean
even with -Wall.

eg. even backing off to /W2 the Win 64 compile throws
__int64 to int mismatch warnings for pointer arithmetic
char *p1, *p2;
int diff = p2 -p1;

also lots of size_t mismatch warnings show up with /W3.

I'm wondering why gcc doesn't do the same since
int=4 ptr=8 bytes for both platforms, is gcc just not
as strict? And how to proceed, do we start fixing
these warnings for Win64 even though they may not
represent real life concerns in order to achieve a
warning free /W3 compile for Win 64?

Allan
-----------------------------------------------------

Index: apr/file_io/win32/open.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/open.c,v
retrieving revision 1.121
diff -u -3 -r1.121 open.c
--- apr/file_io/win32/open.c	13 Feb 2004 09:38:27 -0000	1.121
+++ apr/file_io/win32/open.c	17 Aug 2004 20:59:19 -0000
@@ -47,7 +47,7 @@
       * Note that the \\?\ form only works for local drive paths, and
       * \\?\UNC\ is needed UNC paths.
       */
-    int srcremains = strlen(srcstr) + 1;
+    apr_size_t srcremains = strlen(srcstr) + 1;
      apr_wchar_t *t = retstr;
      apr_status_t rv;

@@ -101,7 +101,7 @@
       * then transform \\'s back into /'s since the \\?\ form never
       * allows '/' path seperators, and APR always uses '/'s.
       */
-    int srcremains = wcslen(srcstr) + 1;
+    apr_size_t srcremains = wcslen(srcstr) + 1;
      apr_status_t rv;
      char *t = retstr;
      if (srcstr[0] == L'\\' && srcstr[1] == L'\\' &&
Index: apr/file_io/win32/readwrite.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/readwrite.c,v
retrieving revision 1.80
diff -u -3 -r1.80 readwrite.c
--- apr/file_io/win32/readwrite.c	13 Feb 2004 09:38:27 -0000	1.80
+++ apr/file_io/win32/readwrite.c	17 Aug 2004 20:59:19 -0000
@@ -27,8 +27,9 @@
   * read_with_timeout()
   * Uses async i/o to emulate unix non-blocking i/o with timeouts.
   */
-static apr_status_t read_with_timeout(apr_file_t *file, void *buf, apr_size_t len, apr_size_t
*nbytes)
+static apr_status_t read_with_timeout(apr_file_t *file, void *buf, apr_size_t len_in, apr_size_t
*nbytes)
  {
+    DWORD len = (DWORD)len_in;
      apr_status_t rv;
      *nbytes = 0;

@@ -68,7 +69,7 @@
          file->pOverlapped->OffsetHigh = (DWORD)(file->filePtr >> 32);
      }

-    rv = ReadFile(file->filehand, buf, len, nbytes, file->pOverlapped);
+    rv = ReadFile(file->filehand, buf, len, (LPDWORD)nbytes, file->pOverlapped);

      if (!rv) {
          rv = apr_get_os_error();
@@ -85,7 +86,7 @@
              switch (rv) {
              case WAIT_OBJECT_0:
                  GetOverlappedResult(file->filehand, file->pOverlapped,
-                                    nbytes, TRUE);
+                                    (LPDWORD)nbytes, TRUE);
                  rv = APR_SUCCESS;
                  break;
              case WAIT_TIMEOUT:
@@ -309,7 +310,7 @@
                  rv = WaitForSingleObject(thefile->pOverlapped->hEvent, INFINITE);
                  switch (rv) {
                      case WAIT_OBJECT_0:
-                        GetOverlappedResult(thefile->filehand, thefile->pOverlapped,
nbytes, TRUE);
+                        GetOverlappedResult(thefile->filehand, thefile->pOverlapped,
(LPDWORD)nbytes, TRUE);
                          rv = APR_SUCCESS;
                          break;
                      case WAIT_TIMEOUT:
@@ -343,7 +344,7 @@
  {
      apr_status_t rv = APR_SUCCESS;
      apr_size_t i;
-    DWORD bwrote = 0;
+    size_t bwrote = 0;
      char *buf;

      *nbytes = 0;
@@ -361,7 +362,7 @@

  APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile)
  {
-    DWORD len = 1;
+    apr_size_t len = 1;

      return apr_file_write(thefile, &ch, &len);
  }
@@ -375,7 +376,7 @@
  APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile)
  {
      apr_status_t rc;
-    int bread;
+    apr_size_t bread;

      bread = 1;
      rc = apr_file_read(thefile, ch, &bread);
@@ -393,7 +394,7 @@

  APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile)
  {
-    DWORD len = strlen(str);
+    apr_size_t len = strlen(str);

      return apr_file_write(thefile, str, &len);
  }
Index: apr/network_io/win32/sendrecv.c
===================================================================
RCS file: /home/cvs/apr/network_io/win32/sendrecv.c,v
retrieving revision 1.67
diff -u -3 -r1.67 sendrecv.c
--- apr/network_io/win32/sendrecv.c	22 Jul 2004 01:48:34 -0000	1.67
+++ apr/network_io/win32/sendrecv.c	17 Aug 2004 20:59:19 -0000
@@ -228,7 +228,7 @@
      apr_ssize_t rv;
      apr_off_t curoff = *offset;
      DWORD dwFlags = 0;
-    DWORD nbytes;
+    apr_size_t nbytes;
      TRANSMIT_FILE_BUFFERS tfb, *ptfb = NULL;
      int ptr = 0;
      int bytes_to_send;   /* Bytes to send out of the file (not including headers) */
@@ -269,7 +269,7 @@
      if (hdtr && hdtr->numheaders) {
          ptfb = &tfb;
          nbytes = 0;
-        rv = collapse_iovec((char **)&ptfb->Head, &ptfb->HeadLength,
+        rv = collapse_iovec((char **)&ptfb->Head, (apr_size_t *)&ptfb->HeadLength,
                              hdtr->headers, hdtr->numheaders,
                              hdtrbuf, sizeof(hdtrbuf));
          /* If not enough buffer, punt to sendv */
@@ -298,7 +298,7 @@
              /* Collapse the trailers into a single buffer */
              if (hdtr && hdtr->numtrailers) {
                  ptfb = &tfb;
-                rv = collapse_iovec((char**) &ptfb->Tail, &ptfb->TailLength,
+                rv = collapse_iovec((char**) &ptfb->Tail, (apr_size_t *)&ptfb->TailLength,
                                      hdtr->trailers, hdtr->numtrailers,
                                      hdtrbuf + ptfb->HeadLength,
                                      sizeof(hdtrbuf) - ptfb->HeadLength);
@@ -341,7 +341,7 @@
                      if (!disconnected) {
                          if (!WSAGetOverlappedResult(sock->socketdes,
                                                      sock->overlapped,
-                                                    &nbytes,
+                                                    (LPDWORD)&nbytes,
                                                      FALSE,
                                                      &dwFlags)) {
                              status = apr_get_netos_error();



Mime
View raw message