summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>1998-12-10 17:09:48 +0000
committerwtc%netscape.com <devnull@localhost>1998-12-10 17:09:48 +0000
commit7b7416a848f97c66f5136bab551f9544b6d0a922 (patch)
tree2c3f3a35c182c72c5dbfe3ed3ce885ce14b8f938
parentdd1f5714091196871f69ff27270e4b96cfb90c61 (diff)
downloadnspr-hg-7b7416a848f97c66f5136bab551f9544b6d0a922.tar.gz
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.
-rw-r--r--pr/include/md/_unixos.h2
-rw-r--r--pr/include/prio.h6
-rw-r--r--pr/include/private/primpl.h2
-rw-r--r--pr/src/cplus/rcfileio.cpp3
-rw-r--r--pr/src/cplus/rcfileio.h3
-rw-r--r--pr/src/cplus/rcio.h2
-rw-r--r--pr/src/cplus/rcnetio.cpp2
-rw-r--r--pr/src/cplus/rcnetio.h2
-rw-r--r--pr/src/io/priometh.c4
-rw-r--r--pr/src/io/prlayer.c4
-rw-r--r--pr/src/io/prsocket.c28
-rw-r--r--pr/src/md/mac/macsockotpt.c2
-rw-r--r--pr/src/md/os2/os2sock.c2
-rw-r--r--pr/src/md/unix/unix.c2
-rw-r--r--pr/src/md/windows/ntio.c6
-rw-r--r--pr/src/md/windows/w16sock.c2
-rw-r--r--pr/src/md/windows/w95sock.c2
-rw-r--r--pr/src/pthreads/ptio.c4
18 files changed, 42 insertions, 36 deletions
diff --git a/pr/include/md/_unixos.h b/pr/include/md/_unixos.h
index 284b76b6..85918612 100644
--- a/pr/include/md/_unixos.h
+++ b/pr/include/md/_unixos.h
@@ -385,7 +385,7 @@ 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
diff --git a/pr/include/prio.h b/pr/include/prio.h
index 82cdcb0e..b1531d6c 100644
--- a/pr/include/prio.h
+++ b/pr/include/prio.h
@@ -307,7 +307,7 @@ typedef PRInt64 (PR_CALLBACK *PRSeek64FN)(PRFileDesc *fd, PRInt64 offset, PRSeek
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) (
@@ -666,7 +666,7 @@ PR_EXTERN(PRInt32) PR_Write(PRFileDesc *fd,const void *buf,PRInt32 amount);
* 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;
@@ -689,7 +689,7 @@ PR_EXTERN(PRInt32) PR_Write(PRFileDesc *fd,const void *buf,PRInt32 amount);
#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);
/*
***************************************************************************
diff --git a/pr/include/private/primpl.h b/pr/include/private/primpl.h
index 55dea3f1..e5335cdd 100644
--- a/pr/include/private/primpl.h
+++ b/pr/include/private/primpl.h
@@ -983,7 +983,7 @@ 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
diff --git a/pr/src/cplus/rcfileio.cpp b/pr/src/cplus/rcfileio.cpp
index 4e371903..8b1cc019 100644
--- a/pr/src/cplus/rcfileio.cpp
+++ b/pr/src/cplus/rcfileio.cpp
@@ -70,7 +70,8 @@ PRInt64 RCFileIO::Seek(PRInt64 offset, RCIO::Whence how)
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)
diff --git a/pr/src/cplus/rcfileio.h b/pr/src/cplus/rcfileio.h
index 0ed18426..77d08ea3 100644
--- a/pr/src/cplus/rcfileio.h
+++ b/pr/src/cplus/rcfileio.h
@@ -54,7 +54,8 @@ public:
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:
diff --git a/pr/src/cplus/rcio.h b/pr/src/cplus/rcio.h
index 5bab1d27..3acd8055 100644
--- a/pr/src/cplus/rcio.h
+++ b/pr/src/cplus/rcio.h
@@ -101,7 +101,7 @@ public:
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:
diff --git a/pr/src/cplus/rcnetio.cpp b/pr/src/cplus/rcnetio.cpp
index 02a6b61a..57303501 100644
--- a/pr/src/cplus/rcnetio.cpp
+++ b/pr/src/cplus/rcnetio.cpp
@@ -149,7 +149,7 @@ 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); }
/*
diff --git a/pr/src/cplus/rcnetio.h b/pr/src/cplus/rcnetio.h
index ef6f8a34..90334874 100644
--- a/pr/src/cplus/rcnetio.h
+++ b/pr/src/cplus/rcnetio.h
@@ -83,7 +83,7 @@ public:
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:
diff --git a/pr/src/io/priometh.c b/pr/src/io/priometh.c
index e9e4847c..3701ffa5 100644
--- a/pr/src/io/priometh.c
+++ b/pr/src/io/priometh.c
@@ -193,8 +193,8 @@ 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)
{
diff --git a/pr/src/io/prlayer.c b/pr/src/io/prlayer.c
index f6e1828f..34d1b5ad 100644
--- a/pr/src/io/prlayer.c
+++ b/pr/src/io/prlayer.c
@@ -131,8 +131,8 @@ static PRStatus PR_CALLBACK pl_DefFileInfo64 (PRFileDesc *fd, PRFileInfo64 *info
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);
diff --git a/pr/src/io/prsocket.c b/pr/src/io/prsocket.c
index 5ad9c720..bbe4d42b 100644
--- a/pr/src/io/prsocket.c
+++ b/pr/src/io/prsocket.c
@@ -72,14 +72,15 @@ static PRBool IsValidNetAddrLen(const PRNetAddr *addr, PRInt32 addr_len)
#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. */
@@ -131,29 +132,32 @@ PRIntervalTime timeout)
* 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;
}
diff --git a/pr/src/md/mac/macsockotpt.c b/pr/src/md/mac/macsockotpt.c
index 4af516cc..5acad847 100644
--- a/pr/src/md/mac/macsockotpt.c
+++ b/pr/src/md/mac/macsockotpt.c
@@ -1244,7 +1244,7 @@ ErrorExit:
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)
diff --git a/pr/src/md/os2/os2sock.c b/pr/src/md/os2/os2sock.c
index b895007d..438fd443 100644
--- a/pr/src/md/os2/os2sock.c
+++ b/pr/src/md/os2/os2sock.c
@@ -665,7 +665,7 @@ _PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags,
}
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;
diff --git a/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c
index cafd3b1b..dc1cc9f0 100644
--- a/pr/src/md/unix/unix.c
+++ b/pr/src/md/unix/unix.c
@@ -948,7 +948,7 @@ done:
}
PRInt32 _MD_writev(
- PRFileDesc *fd, PRIOVec *iov,
+ PRFileDesc *fd, const PRIOVec *iov,
PRInt32 iov_size, PRIntervalTime timeout)
{
PRInt32 rv, err;
diff --git a/pr/src/md/windows/ntio.c b/pr/src/md/windows/ntio.c
index 537bb652..77f8f710 100644
--- a/pr/src/md/windows/ntio.c
+++ b/pr/src/md/windows/ntio.c
@@ -83,7 +83,7 @@ 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);
@@ -1615,7 +1615,7 @@ _PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags,
/* 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;
@@ -3260,7 +3260,7 @@ PRInt32 _nt_nonblock_send(PRFileDesc *fd, char *buf, int len, PRIntervalTime tim
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;
diff --git a/pr/src/md/windows/w16sock.c b/pr/src/md/windows/w16sock.c
index 13231324..f8313054 100644
--- a/pr/src/md/windows/w16sock.c
+++ b/pr/src/md/windows/w16sock.c
@@ -448,7 +448,7 @@ done:
}
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;
diff --git a/pr/src/md/windows/w95sock.c b/pr/src/md/windows/w95sock.c
index 75030f55..3347901b 100644
--- a/pr/src/md/windows/w95sock.c
+++ b/pr/src/md/windows/w95sock.c
@@ -310,7 +310,7 @@ _PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags,
}
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;
diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c
index c8bdd963..658e0819 100644
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -1253,7 +1253,7 @@ static PRInt32 pt_Write(PRFileDesc *fd, const void *buf, PRInt32 amount)
} /* 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;
@@ -1266,7 +1266,7 @@ static PRInt32 pt_Writev(
* 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;
/*