From 184587ade75d53e5bbe09a41e9b5aa348e8dd09b Mon Sep 17 00:00:00 2001 From: "cathleen%netscape.com" Date: Fri, 8 Feb 2002 01:11:33 +0000 Subject: [PATCH] eliminate 24 callers to nsCRT::memmove to use memmove from libC instead. removed nsCRT::memove() bug 118135 r=dp sr=brendan git-svn-id: svn://10.0.0.236/trunk@113965 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/style/src/nsHTMLAttributes.cpp | 4 ++-- .../source/CAppFileLocationProvider.cpp | 2 +- .../mailnews/base/util/nsMsgLineBuffer.cpp | 2 +- mozilla/mailnews/base/util/nsUInt32Array.cpp | 8 ++++---- mozilla/mailnews/base/util/nsUint8Array.cpp | 8 ++++---- .../mailnews/compose/src/nsMsgCompUtils.cpp | 2 +- mozilla/mailnews/mime/src/mimedrft.cpp | 2 +- mozilla/modules/libimg/gifcom/gif.cpp | 4 ++-- mozilla/modules/libpr0n/decoders/gif/GIF2.cpp | 4 ++-- .../libpr0n/decoders/jpeg/nsJPEGDecoder.cpp | 6 +++--- mozilla/xpcom/ds/nsByteBuffer.cpp | 2 +- mozilla/xpcom/ds/nsCRT.h | 8 ++++---- mozilla/xpcom/ds/nsUnicharBuffer.cpp | 4 ++-- mozilla/xpcom/ds/nsValueArray.cpp | 4 ++-- mozilla/xpcom/ds/nsVoidArray.cpp | 20 +++++++++---------- 15 files changed, 40 insertions(+), 40 deletions(-) diff --git a/mozilla/content/html/style/src/nsHTMLAttributes.cpp b/mozilla/content/html/style/src/nsHTMLAttributes.cpp index 2c329015a74..5824b0c40e3 100644 --- a/mozilla/content/html/style/src/nsHTMLAttributes.cpp +++ b/mozilla/content/html/style/src/nsHTMLAttributes.cpp @@ -1094,8 +1094,8 @@ HTMLAttributesImpl::UnsetAttributeName(nsIAtom* aAttrName, PRBool& aFound) } else { if (index < mAttrCount) { - nsCRT::memmove(&(mAttrNames[index]), &(mAttrNames[index + 1]), - (mAttrCount - index) * sizeof(nsIAtom*)); + memmove(&(mAttrNames[index]), &(mAttrNames[index + 1]), + (mAttrCount - index) * sizeof(nsIAtom*)); } } NS_RELEASE(aAttrName); diff --git a/mozilla/embedding/browser/powerplant/source/CAppFileLocationProvider.cpp b/mozilla/embedding/browser/powerplant/source/CAppFileLocationProvider.cpp index d5cb3db192e..76c9b6dd072 100755 --- a/mozilla/embedding/browser/powerplant/source/CAppFileLocationProvider.cpp +++ b/mozilla/embedding/browser/powerplant/source/CAppFileLocationProvider.cpp @@ -270,7 +270,7 @@ static char* GetResCString(PRInt32 stringIndex, Str255& buf) // Because of different availability of Pascal to C conversion routines // in Carbon and not, just do it by hand. PRInt32 len = buf[0]; - nsCRT::memmove(buf, buf + 1, len); + memmove(buf, buf + 1, len); buf[len] = '\0'; return (char *)buf; diff --git a/mozilla/mailnews/base/util/nsMsgLineBuffer.cpp b/mozilla/mailnews/base/util/nsMsgLineBuffer.cpp index 694e03bfadf..b55f09ce506 100644 --- a/mozilla/mailnews/base/util/nsMsgLineBuffer.cpp +++ b/mozilla/mailnews/base/util/nsMsgLineBuffer.cpp @@ -356,7 +356,7 @@ char * nsMsgLineStreamBuffer::ReadNextLine(nsIInputStream * aInputStream, PRUint { if (m_numBytesInBuffer && m_startPos) { - nsCRT::memmove(m_dataBuffer, startOfLine, m_numBytesInBuffer); + memmove(m_dataBuffer, startOfLine, m_numBytesInBuffer); m_dataBuffer[m_numBytesInBuffer] = '\0'; // make sure the end // of the buffer is // terminated diff --git a/mozilla/mailnews/base/util/nsUInt32Array.cpp b/mozilla/mailnews/base/util/nsUInt32Array.cpp index 8a4ed347183..4ad8c36a1f2 100644 --- a/mozilla/mailnews/base/util/nsUInt32Array.cpp +++ b/mozilla/mailnews/base/util/nsUInt32Array.cpp @@ -202,8 +202,8 @@ void nsUInt32Array::InsertAt(PRUint32 nIndex, PRUint32 newElement, PRUint32 nCou SetSize(m_nSize + nCount); // Move the data after the insertion point - nsCRT::memmove(&m_pData[nIndex + nCount], &m_pData[nIndex], - (nOldSize - nIndex) * sizeof(PRUint32)); + memmove(&m_pData[nIndex + nCount], &m_pData[nIndex], + (nOldSize - nIndex) * sizeof(PRUint32)); } // Insert the new elements @@ -241,8 +241,8 @@ void nsUInt32Array::RemoveAt(PRUint32 nIndex, PRUint32 nCount) // Make sure not to overstep the end of the array int nMoveCount = m_nSize - (nIndex + nCount); if (nCount && nMoveCount) - nsCRT::memmove(&m_pData[nIndex], &m_pData[nIndex + nCount], - nMoveCount * sizeof(PRUint32)); + memmove(&m_pData[nIndex], &m_pData[nIndex + nCount], + nMoveCount * sizeof(PRUint32)); m_nSize -= nCount; } diff --git a/mozilla/mailnews/base/util/nsUint8Array.cpp b/mozilla/mailnews/base/util/nsUint8Array.cpp index aa33b385c91..e4c2049beff 100644 --- a/mozilla/mailnews/base/util/nsUint8Array.cpp +++ b/mozilla/mailnews/base/util/nsUint8Array.cpp @@ -167,8 +167,8 @@ nsresult nsUint8Array::InsertAt(PRInt32 nIndex, PRUint8 newElement, PRInt32 nCou PRInt32 nOldSize = m_nSize; SetSize(m_nSize + nCount); // grow it to new size // shift old data up to fill gap - nsCRT::memmove(&m_pData[nIndex+nCount], &m_pData[nIndex], - (nOldSize-nIndex) * sizeof(PRUint8)); + memmove(&m_pData[nIndex+nCount], &m_pData[nIndex], + (nOldSize-nIndex) * sizeof(PRUint8)); // re-init slots we copied from @@ -196,8 +196,8 @@ void nsUint8Array::RemoveAt(PRInt32 nIndex, PRInt32 nCount) NS_ASSERTION(nMoveCount >= 0, "can't remove nothing"); if (nMoveCount >= 0) - nsCRT::memmove(&m_pData[nIndex], &m_pData[nIndex + nCount], - nMoveCount * sizeof(PRUint8)); + memmove(&m_pData[nIndex], &m_pData[nIndex + nCount], + nMoveCount * sizeof(PRUint8)); m_nSize -= nCount; } diff --git a/mozilla/mailnews/compose/src/nsMsgCompUtils.cpp b/mozilla/mailnews/compose/src/nsMsgCompUtils.cpp index a5b7d990e44..e1d1833b65c 100644 --- a/mozilla/mailnews/compose/src/nsMsgCompUtils.cpp +++ b/mozilla/mailnews/compose/src/nsMsgCompUtils.cpp @@ -719,7 +719,7 @@ mime_generate_headers (nsMsgCompFields *fields, while (references && PL_strlen(references) >= 986 && trimAt) { ptr = PL_strchr(trimAt+1, '<'); if (ptr) - nsCRT::memmove(trimAt, ptr, PL_strlen(ptr)+1); // including the + memmove(trimAt, ptr, PL_strlen(ptr)+1); // including the else break; } diff --git a/mozilla/mailnews/mime/src/mimedrft.cpp b/mozilla/mailnews/mime/src/mimedrft.cpp index fd5ad0fbeaf..684dd902331 100644 --- a/mozilla/mailnews/mime/src/mimedrft.cpp +++ b/mozilla/mailnews/mime/src/mimedrft.cpp @@ -631,7 +631,7 @@ mime_fix_up_html_address( char **addr) NS_ASSERTION (*addr, "out of memory fixing up html address"); lt = PL_strchr(*addr, '<'); NS_ASSERTION(lt, "couldn't find < char in address"); - nsCRT::memmove(lt+4, lt+1, newLen - 4 - (lt - *addr)); + memmove(lt+4, lt+1, newLen - 4 - (lt - *addr)); *lt++ = '&'; *lt++ = 'l'; *lt++ = 't'; diff --git a/mozilla/modules/libimg/gifcom/gif.cpp b/mozilla/modules/libimg/gifcom/gif.cpp index 17a34c810ab..7ab52ef8753 100644 --- a/mozilla/modules/libimg/gifcom/gif.cpp +++ b/mozilla/modules/libimg/gifcom/gif.cpp @@ -254,7 +254,7 @@ il_BACat (char **destination, if (*destination == NULL) return(NULL); - nsCRT::memmove(*destination + destination_length, source, source_length); + memmove(*destination + destination_length, source, source_length); } else @@ -1585,7 +1585,7 @@ il_gif_write(il_container *ic, const PRUint8 *buf, int32 len) /* Shift remaining data to the head of the buffer */ if (gs->gathered && (gs->gather_head != gs->hold)) { - nsCRT::memmove(gs->hold, gs->gather_head, gs->gathered); + memmove(gs->hold, gs->gather_head, gs->gathered); gs->gather_head = gs->hold; } diff --git a/mozilla/modules/libpr0n/decoders/gif/GIF2.cpp b/mozilla/modules/libpr0n/decoders/gif/GIF2.cpp index fdacda1cae6..8872bca0cca 100644 --- a/mozilla/modules/libpr0n/decoders/gif/GIF2.cpp +++ b/mozilla/modules/libpr0n/decoders/gif/GIF2.cpp @@ -134,7 +134,7 @@ il_BACat (char **destination, if (*destination == NULL) return(NULL); - nsCRT::memmove(*destination + destination_length, source, source_length); + memmove(*destination + destination_length, source, source_length); } else { @@ -1448,7 +1448,7 @@ PRStatus gif_write(gif_struct *gs, const PRUint8 *buf, PRUint32 len) /* Shift remaining data to the head of the buffer */ if (gs->gathered && (gs->gather_head != gs->hold)) { - nsCRT::memmove(gs->hold, gs->gather_head, gs->gathered); + memmove(gs->hold, gs->gather_head, gs->gathered); gs->gather_head = gs->hold; } diff --git a/mozilla/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp b/mozilla/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp index e702ea0cf58..63f8f9cc452 100644 --- a/mozilla/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp +++ b/mozilla/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp @@ -781,9 +781,9 @@ fill_input_buffer (j_decompress_ptr jd) /* Copy remainder of netlib buffer into backtrack buffer. */ - nsCRT::memmove(src->decoder->mBackBuffer + src->decoder->mBackBufferLen, - src->pub.next_input_byte, - src->pub.bytes_in_buffer); + memmove(src->decoder->mBackBuffer + src->decoder->mBackBufferLen, + src->pub.next_input_byte, + src->pub.bytes_in_buffer); /* Point to start of data to be rescanned. */ diff --git a/mozilla/xpcom/ds/nsByteBuffer.cpp b/mozilla/xpcom/ds/nsByteBuffer.cpp index cfec19227f9..795353e7503 100644 --- a/mozilla/xpcom/ds/nsByteBuffer.cpp +++ b/mozilla/xpcom/ds/nsByteBuffer.cpp @@ -137,7 +137,7 @@ ByteBufferImpl::Fill(nsresult* aErrorCode, nsIInputStream* aStream, if (0 != aKeep) { // Slide over kept data - nsCRT::memmove(mBuffer, mBuffer + (mLength - aKeep), aKeep); + memmove(mBuffer, mBuffer + (mLength - aKeep), aKeep); } // Read in some new data diff --git a/mozilla/xpcom/ds/nsCRT.h b/mozilla/xpcom/ds/nsCRT.h index be9adc35604..8dcb2e09109 100644 --- a/mozilla/xpcom/ds/nsCRT.h +++ b/mozilla/xpcom/ds/nsCRT.h @@ -124,10 +124,10 @@ public: **** Please use memcpy from standard C instead. ****/ - static void memmove(void* aDest, const void* aSrc, PRUint32 aCount) { - NS_ASSERTION((aDest != NULL && aSrc != NULL) || (aCount == 0), "Invalid NULL argument"); - ::memmove(aDest, aSrc, (size_t)aCount); - } + /**** + **** nsCRT::memmove() is no longer supported. + **** Please use memmove from standard C instead. + ****/ /**** **** nsCRT::memset() is no longer supported. diff --git a/mozilla/xpcom/ds/nsUnicharBuffer.cpp b/mozilla/xpcom/ds/nsUnicharBuffer.cpp index 8d32cb21ba0..d3094a28fe2 100644 --- a/mozilla/xpcom/ds/nsUnicharBuffer.cpp +++ b/mozilla/xpcom/ds/nsUnicharBuffer.cpp @@ -138,8 +138,8 @@ UnicharBufferImpl::Fill(nsresult* aErrorCode, if (0 != aKeep) { // Slide over kept data - nsCRT::memmove(mBuffer, mBuffer + (mLength - aKeep), - aKeep * sizeof(PRUnichar)); + memmove(mBuffer, mBuffer + (mLength - aKeep), + aKeep * sizeof(PRUnichar)); } // Read in some new data diff --git a/mozilla/xpcom/ds/nsValueArray.cpp b/mozilla/xpcom/ds/nsValueArray.cpp index efd5ae439d4..ab991c71db2 100644 --- a/mozilla/xpcom/ds/nsValueArray.cpp +++ b/mozilla/xpcom/ds/nsValueArray.cpp @@ -174,7 +174,7 @@ PRBool nsValueArray::InsertValueAt(nsValueArrayValue aValue, nsValueArrayIndex a // All those at and beyond the insertion point need to move. // if (aIndex < count) { - nsCRT::memmove(&mValueArray[(aIndex + 1) * mBytesPerValue], &mValueArray[aIndex * mBytesPerValue], (count - aIndex) * mBytesPerValue); + memmove(&mValueArray[(aIndex + 1) * mBytesPerValue], &mValueArray[aIndex * mBytesPerValue], (count - aIndex) * mBytesPerValue); } // @@ -221,7 +221,7 @@ PRBool nsValueArray::RemoveValueAt(nsValueArrayIndex aIndex) { // Move memory around if appropriate. // if (aIndex != (count - 1)) { - nsCRT::memmove(&mValueArray[aIndex * mBytesPerValue], &mValueArray[(aIndex + 1) * mBytesPerValue], (count - aIndex - 1) * mBytesPerValue); + memmove(&mValueArray[aIndex * mBytesPerValue], &mValueArray[(aIndex + 1) * mBytesPerValue], (count - aIndex - 1) * mBytesPerValue); } // diff --git a/mozilla/xpcom/ds/nsVoidArray.cpp b/mozilla/xpcom/ds/nsVoidArray.cpp index fb93258f5ad..2fa9aeae18a 100644 --- a/mozilla/xpcom/ds/nsVoidArray.cpp +++ b/mozilla/xpcom/ds/nsVoidArray.cpp @@ -414,8 +414,8 @@ PRBool nsVoidArray::InsertElementAt(void* aElement, PRInt32 aIndex) if (0 != slide) { // Slide data over to make room for the insertion - nsCRT::memmove(mImpl->mArray + aIndex + 1, mImpl->mArray + aIndex, - slide * sizeof(mImpl->mArray[0])); + memmove(mImpl->mArray + aIndex + 1, mImpl->mArray + aIndex, + slide * sizeof(mImpl->mArray[0])); } mImpl->mArray[aIndex] = aElement; @@ -459,8 +459,8 @@ PRBool nsVoidArray::InsertElementsAt(const nsVoidArray& other, PRInt32 aIndex) if (0 != slide) { // Slide data over to make room for the insertion - nsCRT::memmove(mImpl->mArray + aIndex + otherCount, mImpl->mArray + aIndex, - slide * sizeof(mImpl->mArray[0])); + memmove(mImpl->mArray + aIndex + otherCount, mImpl->mArray + aIndex, + slide * sizeof(mImpl->mArray[0])); } for (PRInt32 i = 0; i < otherCount; i++) @@ -552,15 +552,15 @@ PRBool nsVoidArray::MoveElement(PRInt32 aFrom, PRInt32 aTo) if (aTo < aFrom) { // Moving one element closer to the head; the elements inbetween move down - nsCRT::memmove(mImpl->mArray + aTo + 1, mImpl->mArray + aTo, - (aFrom-aTo) * sizeof(mImpl->mArray[0])); + memmove(mImpl->mArray + aTo + 1, mImpl->mArray + aTo, + (aFrom-aTo) * sizeof(mImpl->mArray[0])); mImpl->mArray[aTo] = tempElement; } else // already handled aFrom == aTo { // Moving one element closer to the tail; the elements inbetween move up - nsCRT::memmove(mImpl->mArray + aFrom, mImpl->mArray + aFrom + 1, - (aTo-aFrom) * sizeof(mImpl->mArray[0])); + memmove(mImpl->mArray + aFrom, mImpl->mArray + aFrom + 1, + (aTo-aFrom) * sizeof(mImpl->mArray[0])); mImpl->mArray[aTo] = tempElement; } @@ -584,8 +584,8 @@ PRBool nsVoidArray::RemoveElementsAt(PRInt32 aIndex, PRInt32 aCount) // last element in the array if (aIndex < (oldCount - aCount)) { - nsCRT::memmove(mImpl->mArray + aIndex, mImpl->mArray + aIndex + aCount, - (oldCount - (aIndex + aCount)) * sizeof(mImpl->mArray[0])); + memmove(mImpl->mArray + aIndex, mImpl->mArray + aIndex + aCount, + (oldCount - (aIndex + aCount)) * sizeof(mImpl->mArray[0])); } mImpl->mCount -= aCount;