зеркало из https://github.com/mozilla/pjs.git
remove memcpy function from nsCRT, eliminate 2 new nsCRT::memcpy callers
and fix up alighment problems from previous patch, bug 118135, sr=brenda r=dp
This commit is contained in:
Родитель
aaec57aa38
Коммит
2431b85ca9
|
@ -1085,8 +1085,8 @@ HTMLAttributesImpl::UnsetAttributeName(nsIAtom* aAttrName, PRBool& aFound)
|
|||
memcpy(mNameBuffer, mAttrNames, index * sizeof(nsIAtom*));
|
||||
}
|
||||
if (index < mAttrCount) {
|
||||
memcpy(&(mNameBuffer[index]), &(mAttrNames[index + 1]),
|
||||
(mAttrCount - index) * sizeof(nsIAtom*));
|
||||
memcpy(&mNameBuffer[index], &mAttrNames[index + 1],
|
||||
(mAttrCount - index) * sizeof(nsIAtom*));
|
||||
}
|
||||
delete [] mAttrNames;
|
||||
mAttrNames = mNameBuffer;
|
||||
|
|
|
@ -112,7 +112,7 @@ nsConverterInputStream::Read(PRUnichar* aBuf,
|
|||
rv = aCount;
|
||||
}
|
||||
memcpy(aBuf + aOffset, mUnicharData->GetBuffer() + mUnicharDataOffset,
|
||||
rv * sizeof(PRUnichar));
|
||||
rv * sizeof(PRUnichar));
|
||||
mUnicharDataOffset += rv;
|
||||
*aReadCount = rv;
|
||||
return NS_OK;
|
||||
|
|
|
@ -85,8 +85,8 @@ nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, PRInt32
|
|||
if (aContent == mArray[index].mContent) { // remove this change
|
||||
mCount--;
|
||||
if (index < mCount) { // move later changes down
|
||||
memcpy(&(mArray[index]), &(mArray[index + 1]),
|
||||
(mCount - index) * sizeof(nsStyleChangeData));
|
||||
memcpy(&mArray[index], &mArray[index + 1],
|
||||
(mCount - index) * sizeof(nsStyleChangeData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,8 +85,8 @@ nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, PRInt32
|
|||
if (aContent == mArray[index].mContent) { // remove this change
|
||||
mCount--;
|
||||
if (index < mCount) { // move later changes down
|
||||
memcpy(&(mArray[index]), &(mArray[index + 1]),
|
||||
(mCount - index) * sizeof(nsStyleChangeData));
|
||||
memcpy(&mArray[index], &mArray[index + 1],
|
||||
(mCount - index) * sizeof(nsStyleChangeData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1635,7 +1635,7 @@ nsTextFrame::PrepareUnicodeText(nsTextTransformer& aTX,
|
|||
n -= contentLen;
|
||||
if (aTextBuffer != nsnull) {
|
||||
memcpy(aTextBuffer->mBuffer + dstOffset, bp,
|
||||
sizeof(PRUnichar)*wordLen);
|
||||
sizeof(PRUnichar)*wordLen);
|
||||
}
|
||||
dstOffset += wordLen;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ nsAutoTextBuffer::GrowTo(PRInt32 aNewSize, PRBool aCopyToHead)
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
memcpy(&newBuffer[aCopyToHead ? 0 : mBufferLen],
|
||||
mBuffer, sizeof(PRUnichar) * mBufferLen);
|
||||
mBuffer, sizeof(PRUnichar) * mBufferLen);
|
||||
if (mBuffer != mAutoBuffer) {
|
||||
delete [] mBuffer;
|
||||
}
|
||||
|
|
|
@ -1635,7 +1635,7 @@ nsTextFrame::PrepareUnicodeText(nsTextTransformer& aTX,
|
|||
n -= contentLen;
|
||||
if (aTextBuffer != nsnull) {
|
||||
memcpy(aTextBuffer->mBuffer + dstOffset, bp,
|
||||
sizeof(PRUnichar)*wordLen);
|
||||
sizeof(PRUnichar)*wordLen);
|
||||
}
|
||||
dstOffset += wordLen;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ nsAutoTextBuffer::GrowTo(PRInt32 aNewSize, PRBool aCopyToHead)
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
memcpy(&newBuffer[aCopyToHead ? 0 : mBufferLen],
|
||||
mBuffer, sizeof(PRUnichar) * mBufferLen);
|
||||
mBuffer, sizeof(PRUnichar) * mBufferLen);
|
||||
if (mBuffer != mAutoBuffer) {
|
||||
delete [] mBuffer;
|
||||
}
|
||||
|
|
|
@ -595,12 +595,12 @@ int ap_decode_file_infor(appledouble_decode_object *p_ap_decode_obj)
|
|||
{
|
||||
reply.sfFile.vRefNum = p_ap_decode_obj->mSpec->vRefNum;
|
||||
reply.sfFile.parID = p_ap_decode_obj->mSpec->parID;
|
||||
memcpy(&reply.sfFile.name, p_ap_decode_obj->mSpec->name , 63 );
|
||||
memcpy(&reply.sfFile.name, p_ap_decode_obj->mSpec->name , 63 );
|
||||
}
|
||||
|
||||
memcpy(p_ap_decode_obj->fname,
|
||||
reply.sfFile.name+1,
|
||||
*(reply.sfFile.name)+1);
|
||||
reply.sfFile.name+1,
|
||||
*(reply.sfFile.name)+1);
|
||||
p_ap_decode_obj->fname[*(reply.sfFile.name)] = '\0';
|
||||
|
||||
p_ap_decode_obj->vRefNum = reply.sfFile.vRefNum;
|
||||
|
|
|
@ -274,8 +274,8 @@ net_AppleDouble_Decode_Write (
|
|||
{
|
||||
size = 1024 - obj->bytes_in_buff;
|
||||
memcpy(obj->in_buff+obj->bytes_in_buff,
|
||||
s,
|
||||
size);
|
||||
s,
|
||||
size);
|
||||
s += size;
|
||||
l -= size;
|
||||
|
||||
|
@ -296,8 +296,8 @@ net_AppleDouble_Decode_Write (
|
|||
{
|
||||
/* and we are sure we will not get overflow with the buff. */
|
||||
memcpy(obj->in_buff+obj->bytes_in_buff,
|
||||
s,
|
||||
l);
|
||||
s,
|
||||
l);
|
||||
obj->bytes_in_buff += l;
|
||||
}
|
||||
return status;
|
||||
|
|
|
@ -65,8 +65,8 @@ int write_stream(
|
|||
if (p_ap_encode_obj->pos_outbuff + len < p_ap_encode_obj->s_outbuff)
|
||||
{
|
||||
memcpy(p_ap_encode_obj->outbuff + p_ap_encode_obj->pos_outbuff,
|
||||
out_string,
|
||||
len);
|
||||
out_string,
|
||||
len);
|
||||
p_ap_encode_obj->pos_outbuff += len;
|
||||
return noErr;
|
||||
}
|
||||
|
@ -78,11 +78,11 @@ int write_stream(
|
|||
int s_len = p_ap_encode_obj->s_outbuff - p_ap_encode_obj->pos_outbuff;
|
||||
|
||||
memcpy(p_ap_encode_obj->outbuff + p_ap_encode_obj->pos_outbuff,
|
||||
out_string,
|
||||
s_len);
|
||||
out_string,
|
||||
s_len);
|
||||
memcpy(p_ap_encode_obj->b_overflow + p_ap_encode_obj->s_overflow,
|
||||
out_string + s_len,
|
||||
p_ap_encode_obj->s_overflow += (len - s_len));
|
||||
out_string + s_len,
|
||||
p_ap_encode_obj->s_overflow += (len - s_len));
|
||||
p_ap_encode_obj->pos_outbuff += s_len;
|
||||
return errEOB;
|
||||
}
|
||||
|
|
|
@ -256,8 +256,8 @@ int binhex_encode_next(
|
|||
if (p_bh_encode_obj->s_overflow)
|
||||
{
|
||||
memcpy(p_bh_encode_obj->overflow,
|
||||
p_bh_encode_obj->outbuff,
|
||||
p_bh_encode_obj->s_overflow);
|
||||
p_bh_encode_obj->outbuff,
|
||||
p_bh_encode_obj->s_overflow);
|
||||
|
||||
p_bh_encode_obj->pos_outbuff = p_bh_encode_obj->s_overflow;
|
||||
p_bh_encode_obj->s_overflow = 0;
|
||||
|
@ -289,14 +289,14 @@ int binhex_encode_next(
|
|||
p_bh_encode_obj->state = BINHEX_STATE_HEADER;
|
||||
|
||||
memcpy(p_bh_encode_obj->name,
|
||||
in_buff,
|
||||
in_size);
|
||||
in_buff,
|
||||
in_size);
|
||||
}
|
||||
else if (p_bh_encode_obj->state == BINHEX_STATE_HEADER)
|
||||
{
|
||||
memcpy(&(p_bh_encode_obj->head),
|
||||
in_buff,
|
||||
sizeof(binhex_header));
|
||||
in_buff,
|
||||
sizeof(binhex_header));
|
||||
|
||||
if (in_size == 20) /* in the platform that alignment is 4-bytes. */
|
||||
in_size = 18;
|
||||
|
@ -366,7 +366,7 @@ int binhex_reencode_head(
|
|||
|
||||
/* make a copy before do the encoding, -- it may modify the head!!!. */
|
||||
memcpy(buff, (char*)&p_bh_encode_obj->head,
|
||||
sizeof(binhex_header));
|
||||
sizeof(binhex_header));
|
||||
if (18 < sizeof(binhex_header))
|
||||
{
|
||||
/* we get an alignment problem here. */
|
||||
|
@ -720,8 +720,8 @@ PRIVATE void binhex_process(
|
|||
}
|
||||
|
||||
memcpy(p_bh_decode_obj->name,
|
||||
reply.sfFile.name,
|
||||
*(reply.sfFile.name)+1); /* save the new file name. */
|
||||
reply.sfFile.name,
|
||||
*(reply.sfFile.name)+1); /* save the new file name. */
|
||||
|
||||
p_bh_decode_obj->vRefNum = reply.sfFile.vRefNum;
|
||||
p_bh_decode_obj->parID = reply.sfFile.parID;
|
||||
|
|
|
@ -2672,7 +2672,7 @@ NS_IMETHODIMP nsImapMailFolder::CopyData(nsIInputStream *aIStream,
|
|||
{
|
||||
m_copyState->m_leftOver -= (start - m_copyState->m_dataBuffer);
|
||||
memcpy(m_copyState->m_dataBuffer, start,
|
||||
m_copyState->m_leftOver+1); // including null
|
||||
m_copyState->m_leftOver+1); // including null
|
||||
maxReadCount = COPY_BUFFER_SIZE - m_copyState->m_leftOver;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ mime_ReBuffer (const char *net_buffer, PRInt32 net_buffer_size,
|
|||
size = net_buffer_size;
|
||||
if (size > 0)
|
||||
{
|
||||
memcpy ((*bufferP) + (*buffer_fpP), net_buffer, size);
|
||||
memcpy ((*bufferP) + (*buffer_fpP), net_buffer, size);
|
||||
(*buffer_fpP) += size;
|
||||
net_buffer += size;
|
||||
net_buffer_size -= size;
|
||||
|
|
|
@ -224,7 +224,7 @@ MimePartBufferWrite (MimePartBufferData *data,
|
|||
data->part_buffer_fp + size < data->part_buffer_size)
|
||||
{
|
||||
memcpy(data->part_buffer + data->part_buffer_fp,
|
||||
buf, size);
|
||||
buf, size);
|
||||
data->part_buffer_fp += size;
|
||||
}
|
||||
|
||||
|
|
|
@ -394,7 +394,7 @@ public:
|
|||
NS_INIT_REFCNT();
|
||||
mData.mLength = aLength;
|
||||
mData.mBytes = new PRUint8[aLength];
|
||||
nsCRT::memcpy(mData.mBytes, aBytes, aLength);
|
||||
memcpy(mData.mBytes, aBytes, aLength);
|
||||
NS_ADDREF(gRDFService);
|
||||
gRDFService->RegisterBlob(this);
|
||||
}
|
||||
|
|
|
@ -118,10 +118,6 @@ public:
|
|||
**** nsCRT::memcpy() is no longer supported.
|
||||
**** Please use memcpy from standard C instead.
|
||||
****/
|
||||
static void memcpy(void* aDest, const void* aSrc, PRUint32 aCount) {
|
||||
NS_ASSERTION((aDest != NULL && aSrc != NULL) || (aCount == 0), "Invalid NULL argument");
|
||||
::memcpy(aDest, aSrc, (size_t)aCount);
|
||||
}
|
||||
|
||||
static PRInt32 memcmp(const void* aDest, const void* aSrc, PRUint32 aCount) {
|
||||
NS_ASSERTION((aDest != NULL && aSrc != NULL) || (aCount == 0), "Invalid NULL argument");
|
||||
|
|
|
@ -120,7 +120,7 @@ nsValueArray& nsValueArray::operator=(const nsValueArray& aOther) {
|
|||
|
||||
NS_ASSERTION(nsnull != mValueArray, "loss of value array assignment and original data.");
|
||||
if (nsnull != mValueArray) {
|
||||
nsCRT::memcpy(mValueArray, aOther.mValueArray, mCount * mBytesPerValue);
|
||||
memcpy(mValueArray, aOther.mValueArray, mCount * mBytesPerValue);
|
||||
}
|
||||
else {
|
||||
mCount = mCapacity = 0;
|
||||
|
|
|
@ -100,8 +100,8 @@ nsSegmentedBuffer::AppendNewSegment()
|
|||
if (mFirstSegmentIndex > mLastSegmentIndex) {
|
||||
// deal with wrap around case
|
||||
memcpy(&mSegmentArray[mSegmentArrayCount],
|
||||
mSegmentArray,
|
||||
mLastSegmentIndex * sizeof(char*));
|
||||
mSegmentArray,
|
||||
mLastSegmentIndex * sizeof(char*));
|
||||
nsCRT::memset(mSegmentArray, 0, mLastSegmentIndex * sizeof(char*));
|
||||
mLastSegmentIndex += mSegmentArrayCount;
|
||||
nsCRT::memset(&mSegmentArray[mLastSegmentIndex], 0,
|
||||
|
|
|
@ -217,7 +217,7 @@ nsresult UTF8InputStream::Read(PRUnichar* aBuf,
|
|||
rv = aCount;
|
||||
}
|
||||
memcpy(aBuf + aOffset, mUnicharData->GetBuffer() + mUnicharDataOffset,
|
||||
rv * sizeof(PRUnichar));
|
||||
rv * sizeof(PRUnichar));
|
||||
mUnicharDataOffset += rv;
|
||||
*aReadCount = rv;
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче