apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam TH <...@uchicago.edu>
Subject Re: cvs commit: apr/include apr_lib.h
Date Sun, 03 Dec 2000 17:29:35 GMT
On Sun, Dec 03, 2000 at 08:21:35AM -0800, rbb@covalent.net wrote:
> 
> > This still doesn't work.  It turns out that neither BEOS nor
> > __POWER_PC__ is defined at the point in Subversion that this gets used
> > and likely not in other APR-using apps either.  So, new patch, using
> > HAVE_isascii, which doesn't require including apr_private.h, despite
> > Ryan's worry.  Also, defining it before using it is helpful. :-)
> 
> Well, David already committed a very good patch, but I'll comment anyway
> :-)
> 
> I had gone to bed before the rest of this stuff was discussed, so
> obviously I didn't get to comment last night.  
> 
> I just search all of the include directory, and the only place
> HAVE_isascii is defined is apr_private.h.in, so I can't see how
> we could check HAVE_isascii without that file.
 
My guess is, as Greg suggested, that it just wasn't defined, and
therefore was treated as false.  Which gives the desired behavior on
Be/PPC, but not anywhere else. Good to see we now have this done
right.

As for the tests, there were a bunch of type mismatches, virtually all
related to the signedness of character strings.  Then there was the
function apr_socket_from_file, which wasn't implemented on BeOS at
all.  So I copied the function exactly from the Unix implementation,
and that worked.  

After that, the only proble was testdso, which is a dynamically loaded
binary.  Naturally the syntax didn't translate well, so I just
commented it out entirely.  However, this mean that I couldn't run
most of the tests.  So, the upshot is, here's the test results:

User data is working ok
Testing file functions.
	Opening file.......OK
	Checking file.......OK
OK
	Moving to start of file.......OK
	This platform supports files_like_sockets
		Making file look like a socket.......OK
Select caused an error
		Checking for incoming data......../testfile failed

Here are the patches:

First, all the casts.  Greg, feel free to do this correctly.  

RCS file: /home/cvspublic/apr/test/client.c,v
retrieving revision 1.21
diff -u -r1.21 client.c
--- test//client.c	2000/11/21 19:15:27	1.21
+++ test//client.c	2000/12/03 17:26:23
@@ -150,7 +150,7 @@
 
     fprintf(stdout, "\tClient:  Trying to send data over socket.......");
     length = STRLEN;
-    if (apr_send(sock, datasend, &length) != APR_SUCCESS) {
+    if (apr_send(sock, datasend, (unsigned long *)&length) != APR_SUCCESS) {
         apr_close_socket(sock);
         fprintf(stderr, "Problem sending data\n");
         exit(-1);
@@ -170,7 +170,7 @@
     length = STRLEN; 
     fprintf(stdout, "\tClient:  Trying to receive data over socket.......");
 
-    if ((stat = apr_recv(sock, datarecv, &length)) != APR_SUCCESS) {
+    if ((stat = apr_recv(sock, datarecv, (unsigned long *)&length)) != APR_SUCCESS) {
         apr_close_socket(sock);
         fprintf(stderr, "Problem receiving data: %s (%d)\n", 
 		apr_strerror(stat, msgbuf, sizeof(msgbuf)), stat);
Index: test//server.c
===================================================================
RCS file: /home/cvspublic/apr/test/server.c,v
retrieving revision 1.22
diff -u -r1.22 server.c
--- test//server.c	2000/12/03 06:50:31	1.22
+++ test//server.c	2000/12/03 17:26:28
@@ -213,7 +213,7 @@
 
     length = STRLEN;
     fprintf(stdout, "\tServer:  Trying to recv data from socket.......");
-    if (apr_recv(sock2, datasend, &length) != APR_SUCCESS) {
+    if (apr_recv(sock2, datasend, (unsigned long *)&length) != APR_SUCCESS) {
         apr_close_socket(sock);
         apr_close_socket(sock2);
         fprintf(stderr, "Problem recving data\n");
@@ -229,7 +229,7 @@
 
     length = STRLEN;
     fprintf(stdout, "\tServer:  Sending data over socket.......");
-    if (apr_send(sock2, datarecv, &length) != APR_SUCCESS) {
+    if (apr_send(sock2, datarecv, (unsigned long *)&length) != APR_SUCCESS) {
         apr_close_socket(sock);
         apr_close_socket(sock2);
         fprintf(stderr, "Problem sending data\n");
Index: test//testfile.c
===================================================================
RCS file: /home/cvspublic/apr/test/testfile.c,v
retrieving revision 1.18
diff -u -r1.18 testfile.c
--- test//testfile.c	2000/11/15 21:46:38	1.18
+++ test//testfile.c	2000/12/03 17:26:42
@@ -124,10 +124,10 @@
         fprintf(stdout, "OK\n");
     }
 
-    fprintf(stdout, "\tWriting to file.......");
+    printf((const char *)stdout, "\tWriting to file.......");
     
     nbytes = (apr_ssize_t)strlen("this is a test");
-    if (apr_write(thefile, "this is a test", &nbytes) != APR_SUCCESS) {
+    if (apr_write(thefile, "this is a test", (unsigned long *)&nbytes) != APR_SUCCESS)
{
         perror("something's wrong");
         exit(-1);
     }
@@ -177,7 +177,7 @@
     fprintf(stdout, "\tReading from the file.......");
     nbytes = (apr_ssize_t)strlen("this is a test");
     buf = (char *)apr_palloc(context, nbytes + 1);
-    if (apr_read(thefile, buf, &nbytes) != APR_SUCCESS) {
+    if (apr_read(thefile, buf, (unsigned long *)&nbytes) != APR_SUCCESS) {
         perror("something's wrong");
         exit(-1);
     }
@@ -297,7 +297,7 @@
     }
 
     bytes = strlen("Another test!!!");
-    apr_write(file, "Another test!!", &bytes); 
+    apr_write(file, "Another test!!", (unsigned long *)&bytes); 
 	apr_close(file);
 
     fprintf(stdout, "\tOpening Directory.......");
@@ -345,7 +345,7 @@
     fprintf(stdout, "OK\n");
 
     fprintf(stdout, "\t\tFile size.......");
-    apr_dir_entry_size(&bytes, temp);
+    apr_dir_entry_size((unsigned long *)&bytes, temp);
     if (bytes != (apr_ssize_t)strlen("Another test!!!")) {
         fprintf(stderr, "Got wrong file size %d\n", bytes);
         return -1;
@@ -405,14 +405,14 @@
         exit(1);
     }
     nbytes = 4;
-    rv = apr_write(f, "abc\n", &nbytes);
+    rv = apr_write(f, "abc\n", (unsigned long *)&nbytes);
     assert(!rv && nbytes == 4);
     memset(buf, 'a', sizeof buf);
     nbytes = sizeof buf;
-    rv = apr_write(f, buf, &nbytes);
+    rv = apr_write(f, buf, (unsigned long *)&nbytes);
     assert(!rv && nbytes == sizeof buf);
     nbytes = 2;
-    rv = apr_write(f, "\n\n", &nbytes);
+    rv = apr_write(f, "\n\n", (unsigned long *)&nbytes);
     assert(!rv && nbytes == 2);
     rv = apr_close(f);
     assert(!rv);
@@ -433,7 +433,7 @@
   }
   else {
       nbytes = 1;
-      rv = apr_read(f, bytes + 1, &nbytes);
+      rv = apr_read(f, bytes + 1, (unsigned long *)&nbytes);
       assert(nbytes == 1);
   }
   assert(!rv);
@@ -522,7 +522,7 @@
     /* get APR_EOF with apr_read
      */
     nbytes = sizeof buf;
-    rv = apr_read(f, buf, &nbytes);
+    rv = apr_read(f, buf, (unsigned long *)&nbytes);
     assert(rv == APR_EOF);
     rv = apr_close(f);
     assert(!rv);
@@ -545,7 +545,7 @@
     }
     nbytes = APR_BUFFERSIZE;
     memset(buf, 0xFE, nbytes);
-    rv = apr_write(f, buf, &nbytes);
+    rv = apr_write(f, buf, (unsigned long *)&nbytes);
     assert(!rv && nbytes == APR_BUFFERSIZE);
     rv = apr_close(f);
     assert(!rv);
@@ -554,7 +554,7 @@
     rv = apr_open(&f, fname, APR_READ | extra_flags, 0, p);
     assert(!rv);
     nbytes = sizeof buf;
-    rv = apr_read(f, buf, &nbytes);
+    rv = apr_read(f, buf, (unsigned long *)&nbytes);
     assert(!rv);
     assert(nbytes == APR_BUFFERSIZE);
     rv = apr_close(f);
Index: test//testproc.c
===================================================================
RCS file: /home/cvspublic/apr/test/testproc.c,v
retrieving revision 1.21
diff -u -r1.21 testproc.c
--- test//testproc.c	2000/11/29 00:25:23	1.21
+++ test//testproc.c	2000/12/03 17:26:42
@@ -149,7 +149,7 @@
 
     length = 256;
     fprintf(stdout, "Writing the data to child.......");
-    if (apr_write(testfile, teststr, &length) == APR_SUCCESS) {
+    if (apr_write(testfile, teststr, (unsigned long *)&length) == APR_SUCCESS) {
         fprintf(stdout,"OK\n");
     }
     else fprintf(stderr, "Write failed.\n");
@@ -161,7 +161,7 @@
     length = 256;
     fprintf(stdout, "Checking the data read from pipe to child.......");
     buf = apr_pcalloc(context, length);
-    if (apr_read(testfile, buf, &length) == APR_SUCCESS) {
+    if (apr_read(testfile, buf, (unsigned long *)&length) == APR_SUCCESS) {
         if (!strcmp(buf, teststr))
             fprintf(stdout,"OK\n");
         else fprintf(stderr, "Uh-Oh\n");


Then the stuff in poll.c.  I don't know if this is the right way to do
it, but it did at least sort of work.  

Index: network_io/beos//poll.c
===================================================================
RCS file: /home/cvspublic/apr/network_io/beos/poll.c,v
retrieving revision 1.23
diff -u -r1.23 poll.c
--- network_io/beos//poll.c	2000/11/18 16:53:18	1.23
+++ network_io/beos//poll.c	2000/12/03 17:28:27
@@ -57,6 +57,7 @@
 #include "../unix/poll.c"
 #else
 #include "networkio.h"
+#include "fileio.h"
 
 /*  BeOS R4 doesn't have a poll function, but R5 will have 
  *  so for the time being we try our best with an implementaion that 
@@ -207,5 +208,20 @@
 {
     return apr_set_userdata(data, key, cleanup, pollfd->cntxt);
 }
+
+#if APR_FILES_AS_SOCKETS
+/* I'm not sure if this needs to return an apr_status_t or not, but
+ * for right now, we'll leave it this way, and change it later if
+ * necessary.
+ */
+apr_status_t apr_socket_from_file(apr_socket_t **newsock, apr_file_t *file)
+{
+    (*newsock) = apr_pcalloc(file->cntxt, sizeof(**newsock));
+    (*newsock)->socketdes = file->filedes;
+    (*newsock)->cntxt = file->cntxt;
+    return APR_SUCCESS;
+}
+#endif
+
 
 #endif /* BEOS_BONE */

           
	sam th		     
	sam@uchicago.edu
	http://www.abisource.com/~sam/
	GnuPG Key:  
	http://www.abisource.com/~sam/key

Mime
View raw message