mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1178991 - smartptr for http converter r=hurley
This commit is contained in:
parent
ffc6c89d10
commit
d5bb133e67
@ -15,7 +15,6 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
|
||||
// nsISupports implementation
|
||||
NS_IMPL_ISUPPORTS(nsHTTPCompressConv,
|
||||
nsIStreamConverter,
|
||||
@ -24,8 +23,7 @@ NS_IMPL_ISUPPORTS(nsHTTPCompressConv,
|
||||
|
||||
// nsFTPDirListingConv methods
|
||||
nsHTTPCompressConv::nsHTTPCompressConv()
|
||||
: mListener(nullptr)
|
||||
, mMode(HTTP_COMPRESS_IDENTITY)
|
||||
: mMode(HTTP_COMPRESS_IDENTITY)
|
||||
, mOutBuffer(nullptr)
|
||||
, mInpBuffer(nullptr)
|
||||
, mOutBufferLen(0)
|
||||
@ -48,8 +46,6 @@ nsHTTPCompressConv::nsHTTPCompressConv()
|
||||
|
||||
nsHTTPCompressConv::~nsHTTPCompressConv()
|
||||
{
|
||||
NS_IF_RELEASE(mListener);
|
||||
|
||||
if (mInpBuffer)
|
||||
free(mInpBuffer);
|
||||
|
||||
@ -69,19 +65,17 @@ nsHTTPCompressConv::AsyncConvertData(const char *aFromType,
|
||||
nsISupports *aCtxt)
|
||||
{
|
||||
if (!PL_strncasecmp(aFromType, HTTP_COMPRESS_TYPE, sizeof(HTTP_COMPRESS_TYPE)-1) ||
|
||||
!PL_strncasecmp(aFromType, HTTP_X_COMPRESS_TYPE, sizeof(HTTP_X_COMPRESS_TYPE)-1))
|
||||
!PL_strncasecmp(aFromType, HTTP_X_COMPRESS_TYPE, sizeof(HTTP_X_COMPRESS_TYPE)-1)) {
|
||||
mMode = HTTP_COMPRESS_COMPRESS;
|
||||
|
||||
else if (!PL_strncasecmp(aFromType, HTTP_GZIP_TYPE, sizeof(HTTP_GZIP_TYPE)-1) ||
|
||||
!PL_strncasecmp(aFromType, HTTP_X_GZIP_TYPE, sizeof(HTTP_X_GZIP_TYPE)-1))
|
||||
} else if (!PL_strncasecmp(aFromType, HTTP_GZIP_TYPE, sizeof(HTTP_GZIP_TYPE)-1) ||
|
||||
!PL_strncasecmp(aFromType, HTTP_X_GZIP_TYPE, sizeof(HTTP_X_GZIP_TYPE)-1)) {
|
||||
mMode = HTTP_COMPRESS_GZIP;
|
||||
|
||||
else if (!PL_strncasecmp(aFromType, HTTP_DEFLATE_TYPE, sizeof(HTTP_DEFLATE_TYPE)-1))
|
||||
} else if (!PL_strncasecmp(aFromType, HTTP_DEFLATE_TYPE, sizeof(HTTP_DEFLATE_TYPE)-1)) {
|
||||
mMode = HTTP_COMPRESS_DEFLATE;
|
||||
}
|
||||
|
||||
// hook ourself up with the receiving listener.
|
||||
mListener = aListener;
|
||||
NS_ADDREF(mListener);
|
||||
|
||||
mAsyncConvContext = aCtxt;
|
||||
return NS_OK;
|
||||
@ -253,9 +247,9 @@ nsHTTPCompressConv::OnDataAvailable(nsIRequest* request,
|
||||
// reset stream pointers to our original data
|
||||
d_stream.next_in = mInpBuffer;
|
||||
d_stream.avail_in = (uInt)streamLen;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
return NS_ERROR_INVALID_CONTENT_ENCODING;
|
||||
}
|
||||
} /* for */
|
||||
}
|
||||
else
|
||||
|
@ -43,21 +43,20 @@ public:
|
||||
// nsISupports methods
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
|
||||
// nsIStreamConverter methods
|
||||
NS_DECL_NSISTREAMCONVERTER
|
||||
|
||||
|
||||
nsHTTPCompressConv ();
|
||||
|
||||
private:
|
||||
|
||||
virtual ~nsHTTPCompressConv ();
|
||||
|
||||
nsIStreamListener *mListener; // this guy gets the converted data via his OnDataAvailable ()
|
||||
CompressMode mMode;
|
||||
nsCOMPtr<nsIStreamListener> mListener; // this guy gets the converted data via his OnDataAvailable ()
|
||||
CompressMode mMode;
|
||||
|
||||
unsigned char *mOutBuffer;
|
||||
unsigned char *mInpBuffer;
|
||||
|
Loading…
Reference in New Issue
Block a user