Made the second argument for PR_Writev a const pointer
authorwtc%netscape.com
Thu, 10 Dec 1998 17:09:48 +0000
changeset 361 c5f44d270e671293b9ce29b18668f186f9ea8b82
parent 360 31a0e5eebda78be79bb14ec10cef180b93d38466
child 362 2dc0f69d1f52a61312c25c5e2028428f446f4fc8
push idunknown
push userunknown
push dateunknown
Made the second argument for PR_Writev a const pointer (const PRIOVec *iov). Modified files: prio.h, _unixos.h, primpl.h, rcfileio.cpp, rcfileio.h, rcio.h, rcnetio.cpp, rcnetio.h, priometh.c, prlayer.c, prsocket.c, macsockotpt.c, os2sock.c, solaris.c, unix.c, ntio.c, w16sock.c, w95sock.c, ptio.c.
pr/include/md/_unixos.h
pr/include/prio.h
pr/include/private/primpl.h
pr/src/cplus/rcfileio.cpp
pr/src/cplus/rcfileio.h
pr/src/cplus/rcio.h
pr/src/cplus/rcnetio.cpp
pr/src/cplus/rcnetio.h
pr/src/io/priometh.c
pr/src/io/prlayer.c
pr/src/io/prsocket.c
pr/src/md/mac/macsockotpt.c
pr/src/md/os2/os2sock.c
pr/src/md/unix/unix.c
pr/src/md/windows/ntio.c
pr/src/md/windows/w16sock.c
pr/src/md/windows/w95sock.c
pr/src/pthreads/ptio.c
--- a/pr/include/md/_unixos.h
+++ b/pr/include/md/_unixos.h
@@ -380,17 +380,17 @@ extern PRInt32		_MD_send(PRFileDesc *fd,
 extern PRInt32		_MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount,
 						PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen,
 											PRIntervalTime timeout);
 #define _MD_RECVFROM	_MD_recvfrom
 extern PRInt32 _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount,
 							PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen,
 												PRIntervalTime timeout);
 #define _MD_SENDTO	_MD_sendto
-extern PRInt32		_MD_writev(PRFileDesc *fd, struct PRIOVec *iov,
+extern PRInt32		_MD_writev(PRFileDesc *fd, const struct PRIOVec *iov,
 								PRInt32 iov_size, PRIntervalTime timeout);
 #define _MD_WRITEV	_MD_writev
 
 extern PRInt32		_MD_socketavailable(PRFileDesc *fd);
 #define	_MD_SOCKETAVAILABLE		_MD_socketavailable
 extern PRInt64		_MD_socketavailable64(PRFileDesc *fd);
 #define	_MD_SOCKETAVAILABLE64		_MD_socketavailable64
 
--- a/pr/include/prio.h
+++ b/pr/include/prio.h
@@ -302,17 +302,17 @@ typedef PRInt32 (PR_CALLBACK *PRWriteFN)
 typedef PRInt32 (PR_CALLBACK *PRAvailableFN)(PRFileDesc *fd);
 typedef PRInt64 (PR_CALLBACK *PRAvailable64FN)(PRFileDesc *fd);
 typedef PRStatus (PR_CALLBACK *PRFsyncFN)(PRFileDesc *fd);
 typedef PRInt32 (PR_CALLBACK *PRSeekFN)(PRFileDesc *fd, PRInt32 offset, PRSeekWhence how);
 typedef PRInt64 (PR_CALLBACK *PRSeek64FN)(PRFileDesc *fd, PRInt64 offset, PRSeekWhence how);
 typedef PRStatus (PR_CALLBACK *PRFileInfoFN)(PRFileDesc *fd, PRFileInfo *info);
 typedef PRStatus (PR_CALLBACK *PRFileInfo64FN)(PRFileDesc *fd, PRFileInfo64 *info);
 typedef PRInt32 (PR_CALLBACK *PRWritevFN)(
-    PRFileDesc *fd, PRIOVec *iov, PRInt32 size, PRIntervalTime timeout);
+    PRFileDesc *fd, const PRIOVec *iov, PRInt32 size, PRIntervalTime timeout);
 typedef PRStatus (PR_CALLBACK *PRConnectFN)(
     PRFileDesc *fd, const PRNetAddr *addr, PRIntervalTime timeout);
 typedef PRFileDesc* (PR_CALLBACK *PRAcceptFN) (
     PRFileDesc *fd, PRNetAddr *addr, PRIntervalTime timeout);
 typedef PRStatus (PR_CALLBACK *PRBindFN)(PRFileDesc *fd, const PRNetAddr *addr);
 typedef PRStatus (PR_CALLBACK *PRListenFN)(PRFileDesc *fd, PRIntn backlog);
 typedef PRStatus (PR_CALLBACK *PRShutdownFN)(PRFileDesc *fd, PRIntn how);
 typedef PRInt32 (PR_CALLBACK *PRRecvFN)(
@@ -661,17 +661,17 @@ PR_EXTERN(PRInt32) PR_Write(PRFileDesc *
  * FUNCTION: PR_Writev
  * DESCRIPTION:
  *     Write data to a socket.  The data is organized in a PRIOVec array. The
  *     operation will block until all the data is written or the operation
  *     fails.
  * INPUTS:
  *     PRFileDesc *fd
  *         Pointer that points to a PRFileDesc object for a socket.
- *     PRIOVec *iov
+ *     const PRIOVec *iov
  *         An array of PRIOVec.  PRIOVec is a struct with the following
  *         two fields:
  *             char *iov_base;
  *             int iov_len;
  *     PRInt32 iov_size
  *         Number of elements in the iov array. The value of this
  *         argument must not be greater than PR_MAX_IOVECTOR_SIZE.
  *         If it is, the method will fail (PR_BUFFER_OVERFLOW_ERROR).
@@ -684,17 +684,17 @@ PR_EXTERN(PRInt32) PR_Write(PRFileDesc *
  *     A -1 is an indication that the operation failed. The reason
  *     for the failure is obtained by calling PR_GetError().
  ***************************************************************************
  */
 
 #define PR_MAX_IOVECTOR_SIZE 16   /* 'size' must be <= */
 
 PR_EXTERN(PRInt32) PR_Writev(
-    PRFileDesc *fd, PRIOVec *iov, PRInt32 size, PRIntervalTime timeout);
+    PRFileDesc *fd, const PRIOVec *iov, PRInt32 size, PRIntervalTime timeout);
 
 /*
  ***************************************************************************
  * FUNCTION: PR_Delete
  * DESCRIPTION:
  *     Delete a file from the filesystem. The operation may fail if the
  *     file is open.
  * INPUTS:
--- a/pr/include/private/primpl.h
+++ b/pr/include/private/primpl.h
@@ -978,17 +978,17 @@ extern PRInt32 _PR_MD_CLOSE_FILE(PRInt32
 
 extern PRInt32 _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 amount);
 #define    _PR_MD_READ _MD_READ
 
 extern PRInt32 _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 amount);
 #define    _PR_MD_WRITE _MD_WRITE
 
 extern PRInt32 _PR_MD_WRITEV(
-    PRFileDesc *fd, struct PRIOVec *iov,
+    PRFileDesc *fd, const struct PRIOVec *iov,
     PRInt32 iov_size, PRIntervalTime timeout);
 #define    _PR_MD_WRITEV _MD_WRITEV
 
 extern PRInt32 _PR_MD_FSYNC(PRFileDesc *fd);
 #define    _PR_MD_FSYNC _MD_FSYNC
 
 extern PRInt32 _PR_MD_DELETE(const char *name);
 #define        _PR_MD_DELETE _MD_DELETE
--- a/pr/src/cplus/rcfileio.cpp
+++ b/pr/src/cplus/rcfileio.cpp
@@ -65,17 +65,18 @@ PRInt64 RCFileIO::Seek(PRInt64 offset, R
         default: whence = (PRSeekWhence)-1;
     }
     return fd->methods->seek64(fd, offset, whence);
 }  /* RCFileIO::Seek */
 
 PRInt32 RCFileIO::Write(const void *buf, PRSize amount)
     { return fd->methods->write(fd, buf, amount); }
 
-PRInt32 RCFileIO::Writev(PRIOVec *iov, PRSize size, const RCInterval& timeout)
+PRInt32 RCFileIO::Writev(
+    const PRIOVec *iov, PRSize size, const RCInterval& timeout)
     { return fd->methods->writev(fd, iov, size, timeout); }
 
 RCIO *RCFileIO::GetSpecialFile(RCFileIO::SpecialFile special)
 {
     PRFileDesc* fd;
     PRSpecialFD which;
     RCFileIO* spec = NULL;
 
--- a/pr/src/cplus/rcfileio.h
+++ b/pr/src/cplus/rcfileio.h
@@ -49,17 +49,18 @@ public:
     virtual PRStatus    FileInfo(RCFileInfo* info) const;
     static  PRStatus    FileInfo(const char *name, RCFileInfo* info);
     virtual PRStatus    Fsync();
     virtual PRStatus    Open(const char *name, PRIntn flags, PRIntn mode);
     virtual PRInt32     Read(void *buf, PRSize amount);
     virtual PRInt64     Seek(PRInt64 offset, RCIO::Whence how);
     virtual PRInt32     Write(const void *buf, PRSize amount);
     virtual PRInt32     Writev(
-                            PRIOVec *iov, PRSize size, const RCInterval& timeout);
+                            const PRIOVec *iov, PRSize size,
+                            const RCInterval& timeout);
 
 private:
 
     /* These methods made private are unavailable for this object */
     RCFileIO(const RCFileIO&);
     void operator=(const RCFileIO&);
 
     RCIO*       Accept(RCNetAddr* addr, const RCInterval& timeout);
--- a/pr/src/cplus/rcio.h
+++ b/pr/src/cplus/rcio.h
@@ -96,17 +96,17 @@ public:
     virtual PRStatus    SetSocketOption(const PRSocketOptionData *data) = 0;
     virtual PRStatus    Shutdown(ShutdownHow how) = 0;
     virtual PRInt32     TransmitFile(
                             RCIO *source, const void *headers,
                             PRSize hlen, RCIO::FileDisposition flags,
                             const RCInterval& timeout) = 0;
     virtual PRInt32     Write(const void *buf, PRSize amount) = 0;
     virtual PRInt32     Writev(
-                            PRIOVec *iov, PRSize size,
+                            const PRIOVec *iov, PRSize size,
                             const RCInterval& timeout) = 0;
 
 protected:
     typedef enum {
         file = PR_DESC_FILE,
         tcp = PR_DESC_SOCKET_TCP,
         udp = PR_DESC_SOCKET_UDP,
         layered = PR_DESC_LAYERED} RCIOType;
--- a/pr/src/cplus/rcnetio.cpp
+++ b/pr/src/cplus/rcnetio.cpp
@@ -144,17 +144,17 @@ PRInt32 RCNetStreamIO::TransmitFile(
     RCNetStreamIO *src = (RCNetStreamIO*)source;
     return (fd->methods->transmitfile)(
         fd, src->fd, headers, hlen, (PRTransmitFileFlags)flags, timeout); }
 
 PRInt32 RCNetStreamIO::Write(const void *buf, PRSize amount)
     { return (fd->methods->write)(fd, buf, amount); }
 
 PRInt32 RCNetStreamIO::Writev(
-    PRIOVec *iov, PRSize size, const RCInterval& timeout)
+    const PRIOVec *iov, PRSize size, const RCInterval& timeout)
     { return (fd->methods->writev)(fd, iov, size, timeout); }
     
 /*
 ** Invalid functions
 */
 
 PRStatus RCNetStreamIO::Close()
     { PR_SetError(PR_INVALID_METHOD_ERROR, 0); return PR_FAILURE; }
--- a/pr/src/cplus/rcnetio.h
+++ b/pr/src/cplus/rcnetio.h
@@ -78,17 +78,17 @@ public:
     virtual PRStatus    SetSocketOption(const PRSocketOptionData *data);
     virtual PRStatus    Shutdown(ShutdownHow how);
     virtual PRInt32     TransmitFile(
                             RCIO *source, const void *headers,
                             PRSize hlen, RCIO::FileDisposition flags,
                             const RCInterval& timeout);
     virtual PRInt32     Write(const void *buf, PRSize amount);
     virtual PRInt32     Writev(
-                            PRIOVec *iov, PRSize size,
+                            const PRIOVec *iov, PRSize size,
                             const RCInterval& timeout);
 
 private:
     /* functions unavailable to this clients of this class */
     RCNetStreamIO(const RCNetStreamIO&);
 
     PRStatus    Close();
     PRStatus    Open(const char *name, PRIntn flags, PRIntn mode);
--- a/pr/src/io/priometh.c
+++ b/pr/src/io/priometh.c
@@ -188,18 +188,18 @@ PRIntn flags, PRIntervalTime timeout)
 }
 
 PR_IMPLEMENT(PRInt32) PR_Send(PRFileDesc *fd, const void *buf, PRInt32 amount,
 PRIntn flags, PRIntervalTime timeout)
 {
 	return((fd->methods->send)(fd,buf,amount,flags,timeout));
 }
 
-PR_IMPLEMENT(PRInt32) PR_Writev(PRFileDesc *fd, PRIOVec *iov,PRInt32 iov_size,
-PRIntervalTime timeout)
+PR_IMPLEMENT(PRInt32) PR_Writev(PRFileDesc *fd, const PRIOVec *iov,
+PRInt32 iov_size, PRIntervalTime timeout)
 {
     if (iov_size > PR_MAX_IOVECTOR_SIZE)
     {
         PR_SetError(PR_BUFFER_OVERFLOW_ERROR, 0);
         return -1;
     }
 	return((fd->methods->writev)(fd,iov,iov_size,timeout));
 }
--- a/pr/src/io/prlayer.c
+++ b/pr/src/io/prlayer.c
@@ -126,18 +126,18 @@ static PRStatus PR_CALLBACK pl_DefFileIn
 static PRStatus PR_CALLBACK pl_DefFileInfo64 (PRFileDesc *fd, PRFileInfo64 *info)
 {
     PR_ASSERT(fd != NULL);
     PR_ASSERT(fd->lower != NULL);
 
     return (fd->lower->methods->fileInfo64)(fd->lower, info);
 }
 
-static PRInt32 PR_CALLBACK pl_DefWritev (PRFileDesc *fd, PRIOVec *iov, PRInt32 size,
-                                    PRIntervalTime timeout)
+static PRInt32 PR_CALLBACK pl_DefWritev (PRFileDesc *fd, const PRIOVec *iov,
+    PRInt32 size, PRIntervalTime timeout)
 {
     PR_ASSERT(fd != NULL);
     PR_ASSERT(fd->lower != NULL);
 
     return (fd->lower->methods->writev)(fd->lower, iov, size, timeout);
 }
 
 static PRStatus PR_CALLBACK pl_DefConnect (
--- a/pr/src/io/prsocket.c
+++ b/pr/src/io/prsocket.c
@@ -67,24 +67,25 @@ static PRBool IsValidNetAddrLen(const PR
         return PR_FALSE;
 #endif
     }
     return PR_TRUE;
 }
 
 #endif /* DEBUG */
 
-static PRInt32 PR_CALLBACK SocketWritev(PRFileDesc *fd, PRIOVec *iov, PRInt32 iov_size,
-PRIntervalTime timeout)
+static PRInt32 PR_CALLBACK SocketWritev(PRFileDesc *fd, const PRIOVec *iov,
+PRInt32 iov_size, PRIntervalTime timeout)
 {
 	PRThread *me = _PR_MD_CURRENT_THREAD();
 	int w = 0;
-	PRIOVec *tmp_iov = NULL;
+	const PRIOVec *tmp_iov;
 #define LOCAL_MAXIOV    8
 	PRIOVec local_iov[LOCAL_MAXIOV];
+	PRIOVec *iov_copy = NULL;
 	int tmp_out;
 	int index, iov_cnt;
 	int count=0, sz = 0;    /* 'count' is the return value. */
 
 	if (_PR_PENDING_INTERRUPT(me)) {
 		me->flags &= ~_PR_INTERRUPT;
 		PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0);
 		return -1;
@@ -126,39 +127,42 @@ PRIntervalTime timeout)
 			if (tmp_iov == iov) {
 				/*
 				 * The first writev failed so we
 				 * must copy iov's around.
 				 * Avoid calloc/free if there
 				 * are few enough iov's.
 				 */
 				if (iov_size - index <= LOCAL_MAXIOV)
-					tmp_iov = local_iov;
-				else if ((tmp_iov = (PRIOVec *) PR_CALLOC((iov_size - index) *
-					sizeof *tmp_iov)) == NULL) {
+					iov_copy = local_iov;
+				else if ((iov_copy = (PRIOVec *) PR_CALLOC((iov_size - index) *
+					sizeof *iov_copy)) == NULL) {
 					PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
 					return -1;
 				}
+				tmp_iov = iov_copy;
 			}
 
+			PR_ASSERT(tmp_iov == iov_copy);
+
 			/* fill in the first partial read */
-			tmp_iov[0].iov_base = &(((char *)iov[index].iov_base)[tmp_out]);
-			tmp_iov[0].iov_len = iov[index].iov_len - tmp_out;
+			iov_copy[0].iov_base = &(((char *)iov[index].iov_base)[tmp_out]);
+			iov_copy[0].iov_len = iov[index].iov_len - tmp_out;
 			index++;
 
 			/* copy the remaining vectors */
 			for (iov_cnt=1; index<iov_size; iov_cnt++, index++) {
-				tmp_iov[iov_cnt].iov_base = iov[index].iov_base;
-				tmp_iov[iov_cnt].iov_len = iov[index].iov_len;
+				iov_copy[iov_cnt].iov_base = iov[index].iov_base;
+				iov_copy[iov_cnt].iov_len = iov[index].iov_len;
 			}
 		}
 	}
 
-	if (tmp_iov != iov && tmp_iov != local_iov)
-		PR_DELETE(tmp_iov);
+	if (iov_copy != local_iov)
+		PR_DELETE(iov_copy);
 	return count;
 }
 
 /************************************************************************/
 
 PR_IMPLEMENT(PRFileDesc *) PR_ImportTCPSocket(PRInt32 osfd)
 {
 PRFileDesc *fd;
--- a/pr/src/md/mac/macsockotpt.c
+++ b/pr/src/md/mac/macsockotpt.c
@@ -1239,17 +1239,17 @@ PRInt32 _MD_closesocket(PRInt32 osfd)
 
     return kOTNoError;
 
 ErrorExit:
     macsock_map_error(err);
     return -1;
 }                               
 
-PRInt32 _MD_writev(PRFileDesc *fd, struct PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)
+PRInt32 _MD_writev(PRFileDesc *fd, const struct PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)
 {
 #pragma unused (fd, iov, iov_size, timeout)
 
     PR_ASSERT(0);
     _PR_MD_CURRENT_THREAD()->md.osErrCode = unimpErr;
     return -1;
 }                               
 
--- a/pr/src/md/os2/os2sock.c
+++ b/pr/src/md/os2/os2sock.c
@@ -660,17 +660,17 @@ PRInt32
 			_PR_MD_MAP_RECVFROM_ERROR(err);
             break;
         }
     }
     return(rv);
 }
 
 PRInt32
-_PR_MD_WRITEV(PRFileDesc *fd, PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)
+_PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)
 {
     int index;
     int sent = 0;
     int rv;
 
     for (index=0; index < iov_size; index++) 
     {
         rv = _PR_MD_SEND(fd, iov[index].iov_base, iov[index].iov_len, 0, timeout);
--- a/pr/src/md/unix/unix.c
+++ b/pr/src/md/unix/unix.c
@@ -943,17 +943,17 @@ PRInt32 _MD_sendto(
     if (rv < 0) {
         _PR_MD_MAP_SENDTO_ERROR(err);
     }
 done:
     return(rv);
 }
 
 PRInt32 _MD_writev(
-    PRFileDesc *fd, PRIOVec *iov,
+    PRFileDesc *fd, const PRIOVec *iov,
     PRInt32 iov_size, PRIntervalTime timeout)
 {
     PRInt32 rv, err;
     PRThread *me = _PR_MD_CURRENT_THREAD();
     PRInt32 index, amount = 0;
     PRInt32 osfd = fd->secret->md.osfd;
 
     /*
--- a/pr/src/md/windows/ntio.c
+++ b/pr/src/md/windows/ntio.c
@@ -78,17 +78,17 @@ static PRInt32 _md_MakeNonblock(HANDLE);
 
 /* The _nt_use_async flag is used to prevent nspr from using any async io.
  * this is a temporary hack.  Don't learn to rely on it.
  */
 static int _nt_use_async = 1;
 PRInt32 _nt_nonblock_accept(PRFileDesc *fd, struct sockaddr_in *addr, int *len, PRIntervalTime);
 PRInt32 _nt_nonblock_recv(PRFileDesc *fd, char *buf, int len, PRIntervalTime);
 PRInt32 _nt_nonblock_send(PRFileDesc *fd, char *buf, int len, PRIntervalTime);
-PRInt32 _nt_nonblock_writev(PRFileDesc *fd, PRIOVec *iov, int size, PRIntervalTime);
+PRInt32 _nt_nonblock_writev(PRFileDesc *fd, const PRIOVec *iov, int size, PRIntervalTime);
 PRInt32 _nt_nonblock_sendto(PRFileDesc *, const char *, int, const struct sockaddr *, int, PRIntervalTime);
 PRInt32 _nt_nonblock_recvfrom(PRFileDesc *, char *, int, struct sockaddr *, int *, PRIntervalTime);
 
 /*
  * UDP support
  * 
  * UDP is supported on NT by the continuation thread mechanism.
  * The code is borrowed from ptio.c in pthreads nspr, hence the
@@ -1610,17 +1610,17 @@ PRInt32
     if (_nt_use_async && !fd->secret->nonblocking)
         return pt_RecvFrom(osfd, buf, amount, flags, addr, addrlen, timeout);
     else
         return _nt_nonblock_recvfrom(fd, buf, amount, (struct sockaddr *)addr, addrlen, timeout);
 }
 
 /* XXXMB - for now this is a sockets call only */
 PRInt32
-_PR_MD_WRITEV(PRFileDesc *fd, PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)
+_PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)
 {
     PRInt32 osfd = fd->secret->md.osfd;
     int index;
     int sent = 0;
     int rv;
 
     if (!_nt_use_async || fd->secret->nonblocking) {
         if (!fd->secret->md.io_model_committed) {
@@ -3255,17 +3255,17 @@ PRInt32 _nt_nonblock_send(PRFileDesc *fd
 				PR_SetError(PR_IO_TIMEOUT_ERROR, 0);
                 return -1;
             }
         }
     }
     return bytesSent;
 }
 
-PRInt32 _nt_nonblock_writev(PRFileDesc *fd, PRIOVec *iov, int size, PRIntervalTime timeout)
+PRInt32 _nt_nonblock_writev(PRFileDesc *fd, const PRIOVec *iov, int size, PRIntervalTime timeout)
 {
     int index;
     int sent = 0;
     int rv;
 
     for (index=0; index<size; index++) {
         rv = _nt_nonblock_send(fd, iov[index].iov_base, iov[index].iov_len, timeout);
         if (rv > 0) 
--- a/pr/src/md/windows/w16sock.c
+++ b/pr/src/md/windows/w16sock.c
@@ -443,17 +443,17 @@ PRInt32
     if (rv < 0) {
         _PR_MD_MAP_RECVFROM_ERROR(err);
     }
 done:
     return(rv);
 }
 
 PRInt32
-_PR_MD_WRITEV(PRFileDesc *fd, PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)
+_PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)
 {
     int index;
     int sent = 0;
     int rv;
 
     for (index=0; index < iov_size; index++) 
     {
 
--- a/pr/src/md/windows/w95sock.c
+++ b/pr/src/md/windows/w95sock.c
@@ -305,17 +305,17 @@ PRInt32
             _PR_MD_MAP_RECVFROM_ERROR(err);
             break;
         }
     }
     return(rv);
 }
 
 PRInt32
-_PR_MD_WRITEV(PRFileDesc *fd, PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)
+_PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)
 {
     int index;
     int sent = 0;
     int rv;
 
     for (index=0; index < iov_size; index++) 
     {
         rv = _PR_MD_SEND(fd, iov[index].iov_base, iov[index].iov_len, 0, timeout);
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -1248,30 +1248,30 @@ static PRInt32 pt_Write(PRFileDesc *fd, 
         syserrno = op.syserrno;
     }
     if (bytes == -1)
         pt_MapError(_PR_MD_MAP_WRITE_ERROR, syserrno);
     return bytes;
 }  /* pt_Write */
 
 static PRInt32 pt_Writev(
-    PRFileDesc *fd, PRIOVec *iov, PRInt32 iov_len, PRIntervalTime timeout)
+    PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_len, PRIntervalTime timeout)
 {
     PRIntn iov_index = 0;
     PRBool fNeedContinue = PR_FALSE;
     PRInt32 syserrno, bytes = -1, rv = -1;
 
     if (pt_TestAbort()) return rv;
 
     /*
      * The first shot at this can use the client's iov directly.
      * Only if we have to continue the operation do we have to
      * make a copy that we can modify.
      */
-    rv = bytes = writev(fd->secret->md.osfd, (struct iovec*)iov, iov_len);
+    rv = bytes = writev(fd->secret->md.osfd, (const struct iovec*)iov, iov_len);
     syserrno = errno;
 
     /*
      * If we moved some bytes (ie., bytes > 0) how does that implicate
      * the i/o vector list. In other words, exactly where are we within
      * that array? What are the parameters for resumption? Maybe we're
      * done!
      */