mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 827824 - Use uint8_t for mTxInlineFrame. r=mcmanus
This commit is contained in:
parent
b98e34aed0
commit
484ed727bd
@ -496,8 +496,8 @@ SpdySession3::ResetDownstreamState()
|
||||
mInputFrameDataStream = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
SpdySession3::EnsureBuffer(nsAutoArrayPtr<char> &buf,
|
||||
template<typename T> void
|
||||
SpdySession3::EnsureBuffer(nsAutoArrayPtr<T> &buf,
|
||||
uint32_t newSize,
|
||||
uint32_t preserve,
|
||||
uint32_t &objSize)
|
||||
@ -510,12 +510,26 @@ SpdySession3::EnsureBuffer(nsAutoArrayPtr<char> &buf,
|
||||
// boundary.
|
||||
|
||||
objSize = (newSize + 2048 + 4095) & ~4095;
|
||||
|
||||
nsAutoArrayPtr<char> tmp(new char[objSize]);
|
||||
|
||||
MOZ_STATIC_ASSERT(sizeof(T) == 1, "sizeof(T) must be 1");
|
||||
nsAutoArrayPtr<T> tmp(new T[objSize]);
|
||||
memcpy(tmp, buf, preserve);
|
||||
buf = tmp;
|
||||
}
|
||||
|
||||
// Instantiate supported templates explicitly.
|
||||
template void
|
||||
SpdySession3::EnsureBuffer(nsAutoArrayPtr<char> &buf,
|
||||
uint32_t newSize,
|
||||
uint32_t preserve,
|
||||
uint32_t &objSize);
|
||||
|
||||
template void
|
||||
SpdySession3::EnsureBuffer(nsAutoArrayPtr<uint8_t> &buf,
|
||||
uint32_t newSize,
|
||||
uint32_t preserve,
|
||||
uint32_t &objSize);
|
||||
|
||||
void
|
||||
SpdySession3::zlibInit()
|
||||
{
|
||||
|
@ -148,7 +148,8 @@ public:
|
||||
static nsresult HandleHeaders(SpdySession3 *);
|
||||
static nsresult HandleWindowUpdate(SpdySession3 *);
|
||||
|
||||
static void EnsureBuffer(nsAutoArrayPtr<char> &,
|
||||
template<typename T>
|
||||
static void EnsureBuffer(nsAutoArrayPtr<T> &,
|
||||
uint32_t, uint32_t, uint32_t &);
|
||||
|
||||
// For writing the SPDY data stream to LOG4
|
||||
|
@ -66,7 +66,7 @@ SpdyStream3::SpdyStream3(nsAHttpTransaction *httpTransaction,
|
||||
LOG3(("SpdyStream3::SpdyStream3 %p", this));
|
||||
|
||||
mRemoteWindow = spdySession->GetServerInitialWindow();
|
||||
mTxInlineFrame = new char[mTxInlineFrameSize];
|
||||
mTxInlineFrame = new uint8_t[mTxInlineFrameSize];
|
||||
mDecompressBuffer = new char[mDecompressBufferSize];
|
||||
}
|
||||
|
||||
@ -556,8 +556,9 @@ SpdyStream3::TransmitFrame(const char *buf,
|
||||
// bytes through to the SpdySession3 and then the HttpConnection which calls
|
||||
// the socket write function. It will accept all of the inline and stream
|
||||
// data because of the above 'commitment' even if it has to buffer
|
||||
|
||||
rv = mSegmentReader->OnReadSegment(mTxInlineFrame, mTxInlineFrameUsed,
|
||||
|
||||
rv = mSegmentReader->OnReadSegment(reinterpret_cast<char*>(mTxInlineFrame.get()),
|
||||
mTxInlineFrameUsed,
|
||||
&transmittedCount);
|
||||
LOG3(("SpdyStream3::TransmitFrame for inline session=%p "
|
||||
"stream=%p result %x len=%d",
|
||||
@ -571,9 +572,10 @@ SpdyStream3::TransmitFrame(const char *buf,
|
||||
|
||||
NS_ABORT_IF_FALSE(transmittedCount == mTxInlineFrameUsed,
|
||||
"inconsistent inline commitment count");
|
||||
|
||||
|
||||
SpdySession3::LogIO(mSession, this, "Writing from Inline Buffer",
|
||||
mTxInlineFrame, transmittedCount);
|
||||
reinterpret_cast<char*>(mTxInlineFrame.get()),
|
||||
transmittedCount);
|
||||
|
||||
if (mTxStreamFrameSize) {
|
||||
if (!buf) {
|
||||
@ -1121,8 +1123,7 @@ SpdyStream3::ExecuteCompress(uint32_t flushMode)
|
||||
avail = mTxInlineFrameSize - mTxInlineFrameUsed;
|
||||
}
|
||||
|
||||
mZlib->next_out = reinterpret_cast<unsigned char *> (mTxInlineFrame.get()) +
|
||||
mTxInlineFrameUsed;
|
||||
mZlib->next_out = mTxInlineFrame + mTxInlineFrameUsed;
|
||||
mZlib->avail_out = avail;
|
||||
deflate(mZlib, flushMode);
|
||||
mTxInlineFrameUsed += avail - mZlib->avail_out;
|
||||
@ -1238,7 +1239,7 @@ SpdyStream3::OnReadSegment(const char *buf,
|
||||
dataLength = std::min(count, mChunkSize);
|
||||
|
||||
if (dataLength > mRemoteWindow)
|
||||
dataLength = mRemoteWindow;
|
||||
dataLength = static_cast<uint32_t>(mRemoteWindow);
|
||||
|
||||
LOG3(("SpdyStream3 this=%p id 0x%X remote window is %d. Chunk is %d\n",
|
||||
this, mStreamID, mRemoteWindow, dataLength));
|
||||
|
@ -175,7 +175,7 @@ private:
|
||||
|
||||
// The InlineFrame and associated data is used for composing control
|
||||
// frames and data frame headers.
|
||||
nsAutoArrayPtr<char> mTxInlineFrame;
|
||||
nsAutoArrayPtr<uint8_t> mTxInlineFrame;
|
||||
uint32_t mTxInlineFrameSize;
|
||||
uint32_t mTxInlineFrameUsed;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user