This patch contains all of the changes I have posted so far in this thread, and more, now as a Subversion diff, with log messages.

The one bug fixed here is that the functions apr_signal_block and apr_signal_unblock were not being implemented because they were testing for APR_HAS_SIGACTION instead of APR_HAVE_SIGACTION.

All of the other changes are to resolve inconsistencies that I found from compiler warnings. (SuSE 9.1 GNU/Linux, GCC 3.3.3 with extra warnings enabled).

- Julian

Fix some inconsistencies and a bug that compiler warnings alerted me to.

* apr/acconfig.h
  Test whether "BEOS" is defined, not whether it is non-zero.

* apr/file_io/unix/tempdir.c
  (test_tempdir): Remove "const" to avoid casting it away.

* apr/network_io/unix/sendrecv.c
  (apr_socket_sendfile): Remove a spurious carriage return from the source.

* apr/threadproc/unix/signals.c
  (apr_signal_block, apr_signal_unblock): Test the correct symbol, so that
    these functions will actually be implemented on appropriate platforms.

Index: apr/acconfig.h
===================================================================
--- apr/acconfig.h      (revision 65585)
+++ apr/acconfig.h      (working copy)
@@ -19,7 +19,7 @@
 #undef ssize_t
 
 /* switch this on if we have a BeOS version below BONE */
-#if BEOS && !HAVE_BONE_VERSION
+#if defined(BEOS) && !HAVE_BONE_VERSION
 #define BEOS_R5 1
 #else
 #define BEOS_BONE 1
Index: apr/file_io/unix/tempdir.c
===================================================================
--- apr/file_io/unix/tempdir.c  (revision 65585)
+++ apr/file_io/unix/tempdir.c  (working copy)
@@ -23,9 +23,9 @@
 static int test_tempdir(const char *temp_dir, apr_pool_t *p)
 {
     apr_file_t *dummy_file;
-    const char *path = apr_pstrcat(p, temp_dir, "/apr-tmp.XXXXXX", NULL);
+    char *path = apr_pstrcat(p, temp_dir, "/apr-tmp.XXXXXX", NULL);
 
-    if (apr_file_mktemp(&dummy_file, (char *)path, 0, p) == APR_SUCCESS) {
+    if (apr_file_mktemp(&dummy_file, path, 0, p) == APR_SUCCESS) {
         if (apr_file_putc('!', dummy_file) == APR_SUCCESS) {
             if (apr_file_close(dummy_file) == APR_SUCCESS) {
                 return 1;
Index: apr/network_io/unix/sendrecv.c
===================================================================
--- apr/network_io/unix/sendrecv.c      (revision 65585)
+++ apr/network_io/unix/sendrecv.c      (working copy)
@@ -316,7 +316,7 @@ apr_status_t apr_socket_sendfile(apr_soc
                       *len);   /* number of bytes to send */
     } while (rv == -1 && errno == EINTR);
 
-    if ((rv == -1) && 
(errno == EAGAIN || errno == EWOULDBLOCK) 
+    if ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) 
                    && (sock->timeout > 0)) {
 do_select:
         arv = apr_wait_for_io_or_timeout(NULL, sock, 0);
Index: apr/threadproc/unix/signals.c
===================================================================
--- apr/threadproc/unix/signals.c       (revision 65585)
+++ apr/threadproc/unix/signals.c       (working copy)
@@ -427,7 +427,7 @@ APR_DECLARE(apr_status_t) apr_setup_sign
 
 APR_DECLARE(apr_status_t) apr_signal_block(int signum)
 {
-#if APR_HAS_SIGACTION
+#if APR_HAVE_SIGACTION
     sigset_t sig_mask;
     int rv;
 
@@ -454,7 +454,7 @@ APR_DECLARE(apr_status_t) apr_signal_blo
 
 APR_DECLARE(apr_status_t) apr_signal_unblock(int signum)
 {
-#if APR_HAS_SIGACTION
+#if APR_HAVE_SIGACTION
     sigset_t sig_mask;
     int rv;
 
Fix some inconsistencies that compiler warnings alerted me to.
No functional change.

* apr-util/crypto/apr_md5.c
  (apr_md5_encode): Remove unnecessary type casts that were casting away 
"const".

* apr-util/misc/apr_queue.c
  Include the header that defines the symbols we are testing.

Index: apr-util/crypto/apr_md5.c
===================================================================
--- apr-util/crypto/apr_md5.c   (revision 65585)
+++ apr-util/crypto/apr_md5.c   (working copy)
@@ -536,25 +536,25 @@ APU_DECLARE(apr_status_t) apr_md5_encode
     /*
      * The password first, since that is what is most unknown
      */
-    apr_md5_update(&ctx, (unsigned char *)pw, strlen(pw));
+    apr_md5_update(&ctx, pw, strlen(pw));
 
     /*
      * Then our magic string
      */
-    apr_md5_update(&ctx, (unsigned char *)apr1_id, strlen(apr1_id));
+    apr_md5_update(&ctx, apr1_id, strlen(apr1_id));
 
     /*
      * Then the raw salt
      */
-    apr_md5_update(&ctx, (unsigned char *)sp, sl);
+    apr_md5_update(&ctx, sp, sl);
 
     /*
      * Then just as many characters of the MD5(pw, salt, pw)
      */
     apr_md5_init(&ctx1);
-    apr_md5_update(&ctx1, (unsigned char *)pw, strlen(pw));
-    apr_md5_update(&ctx1, (unsigned char *)sp, sl);
-    apr_md5_update(&ctx1, (unsigned char *)pw, strlen(pw));
+    apr_md5_update(&ctx1, pw, strlen(pw));
+    apr_md5_update(&ctx1, sp, sl);
+    apr_md5_update(&ctx1, pw, strlen(pw));
     apr_md5_final(final, &ctx1);
     for (pl = strlen(pw); pl > 0; pl -= APR_MD5_DIGESTSIZE) {
         apr_md5_update(&ctx, final, 
@@ -574,7 +574,7 @@ APU_DECLARE(apr_status_t) apr_md5_encode
             apr_md5_update(&ctx, final, 1);
         }
         else {
-            apr_md5_update(&ctx, (unsigned char *)pw, 1);
+            apr_md5_update(&ctx, pw, 1);
         }
     }
 
@@ -596,24 +596,24 @@ APU_DECLARE(apr_status_t) apr_md5_encode
     for (i = 0; i < 1000; i++) {
         apr_md5_init(&ctx1);
         if (i & 1) {
-            apr_md5_update(&ctx1, (unsigned char *)pw, strlen(pw));
+            apr_md5_update(&ctx1, pw, strlen(pw));
         }
         else {
             apr_md5_update(&ctx1, final, APR_MD5_DIGESTSIZE);
         }
         if (i % 3) {
-            apr_md5_update(&ctx1, (unsigned char *)sp, sl);
+            apr_md5_update(&ctx1, sp, sl);
         }
 
         if (i % 7) {
-            apr_md5_update(&ctx1, (unsigned char *)pw, strlen(pw));
+            apr_md5_update(&ctx1, pw, strlen(pw));
         }
 
         if (i & 1) {
             apr_md5_update(&ctx1, final, APR_MD5_DIGESTSIZE);
         }
         else {
-            apr_md5_update(&ctx1, (unsigned char *)pw, strlen(pw));
+            apr_md5_update(&ctx1, pw, strlen(pw));
         }
         apr_md5_final(final,&ctx1);
     }
Index: apr-util/misc/apr_queue.c
===================================================================
--- apr-util/misc/apr_queue.c   (revision 65585)
+++ apr-util/misc/apr_queue.c   (working copy)
@@ -12,6 +12,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+#include "apr.h"
+
 #if APR_HAVE_STDIO_H
 #include <stdio.h>
 #endif

Reply via email to