mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 784739 - Switch from NULL to nullptr in image/. r=ehsan
This commit is contained in:
parent
c8e81dd315
commit
1f08b5ef4b
@ -39,14 +39,14 @@ NS_DEFINE_NAMED_CID(NS_PNGENCODER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_BMPENCODER_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kImageCIDs[] = {
|
||||
{ &kNS_IMGLOADER_CID, false, NULL, imgLoaderConstructor, },
|
||||
{ &kNS_IMGREQUESTPROXY_CID, false, NULL, imgRequestProxyConstructor, },
|
||||
{ &kNS_IMGTOOLS_CID, false, NULL, imgToolsConstructor, },
|
||||
{ &kNS_ICOENCODER_CID, false, NULL, nsICOEncoderConstructor, },
|
||||
{ &kNS_JPEGENCODER_CID, false, NULL, nsJPEGEncoderConstructor, },
|
||||
{ &kNS_PNGENCODER_CID, false, NULL, nsPNGEncoderConstructor, },
|
||||
{ &kNS_BMPENCODER_CID, false, NULL, nsBMPEncoderConstructor, },
|
||||
{ NULL }
|
||||
{ &kNS_IMGLOADER_CID, false, nullptr, imgLoaderConstructor, },
|
||||
{ &kNS_IMGREQUESTPROXY_CID, false, nullptr, imgRequestProxyConstructor, },
|
||||
{ &kNS_IMGTOOLS_CID, false, nullptr, imgToolsConstructor, },
|
||||
{ &kNS_ICOENCODER_CID, false, nullptr, nsICOEncoderConstructor, },
|
||||
{ &kNS_JPEGENCODER_CID, false, nullptr, nsJPEGEncoderConstructor, },
|
||||
{ &kNS_PNGENCODER_CID, false, nullptr, nsPNGEncoderConstructor, },
|
||||
{ &kNS_BMPENCODER_CID, false, nullptr, nsBMPEncoderConstructor, },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kImageContracts[] = {
|
||||
@ -58,7 +58,7 @@ static const mozilla::Module::ContractIDEntry kImageContracts[] = {
|
||||
{ "@mozilla.org/image/encoder;2?type=" IMAGE_JPEG, &kNS_JPEGENCODER_CID },
|
||||
{ "@mozilla.org/image/encoder;2?type=" IMAGE_PNG, &kNS_PNGENCODER_CID },
|
||||
{ "@mozilla.org/image/encoder;2?type=" IMAGE_BMP, &kNS_BMPENCODER_CID },
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::CategoryEntry kImageCategories[] = {
|
||||
@ -74,7 +74,7 @@ static const mozilla::Module::CategoryEntry kImageCategories[] = {
|
||||
{ "Gecko-Content-Viewers", IMAGE_PNG, "@mozilla.org/content/document-loader-factory;1" },
|
||||
{ "Gecko-Content-Viewers", IMAGE_X_PNG, "@mozilla.org/content/document-loader-factory;1" },
|
||||
{ "content-sniffing-services", "@mozilla.org/image/loader;1", "@mozilla.org/image/loader;1" },
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static nsresult
|
||||
@ -98,7 +98,7 @@ static const mozilla::Module kImageModule = {
|
||||
kImageCIDs,
|
||||
kImageContracts,
|
||||
kImageCategories,
|
||||
NULL,
|
||||
nullptr,
|
||||
imglib_Initialize,
|
||||
imglib_Shutdown
|
||||
};
|
||||
|
@ -268,7 +268,7 @@ GetIconSize(nsIMozIconURI *aIconURI)
|
||||
int size;
|
||||
|
||||
GtkIconSize icon_size = moz_gtk_icon_size(iconSizeString.get());
|
||||
gtk_icon_size_lookup(icon_size, &size, NULL);
|
||||
gtk_icon_size_lookup(icon_size, &size, nullptr);
|
||||
return size;
|
||||
}
|
||||
}
|
||||
@ -328,7 +328,8 @@ nsIconChannel::InitWithGnome(nsIMozIconURI *aIconURI)
|
||||
}
|
||||
|
||||
char* empty[] = { "" };
|
||||
_gnome_init(NS_ConvertUTF16toUTF8(appName).get(), "1.0", 1, empty, NULL, 0, NULL);
|
||||
_gnome_init(NS_ConvertUTF16toUTF8(appName).get(),
|
||||
"1.0", 1, empty, nullptr, 0, nullptr);
|
||||
}
|
||||
|
||||
uint32_t iconSize = GetIconSize(aIconURI);
|
||||
@ -386,9 +387,9 @@ nsIconChannel::InitWithGnome(nsIMozIconURI *aIconURI)
|
||||
}
|
||||
}
|
||||
|
||||
char* name = _gnome_icon_lookup(gIconTheme, NULL, spec.get(), NULL, &fileInfo,
|
||||
type.get(), GNOME_ICON_LOOKUP_FLAGS_NONE,
|
||||
NULL);
|
||||
char* name = _gnome_icon_lookup(gIconTheme, nullptr, spec.get(), nullptr,
|
||||
&fileInfo, type.get(),
|
||||
GNOME_ICON_LOOKUP_FLAGS_NONE, nullptr);
|
||||
|
||||
_gnome_vfs_file_info_clear(&fileInfo);
|
||||
if (!name)
|
||||
@ -426,7 +427,7 @@ nsIconChannel::InitWithGnome(nsIMozIconURI *aIconURI)
|
||||
nsresult
|
||||
nsIconChannel::InitWithGIO(nsIMozIconURI *aIconURI)
|
||||
{
|
||||
GIcon *icon = NULL;
|
||||
GIcon *icon = nullptr;
|
||||
nsCOMPtr<nsIURL> fileURI;
|
||||
|
||||
// Read icon content
|
||||
@ -441,7 +442,8 @@ nsIconChannel::InitWithGIO(nsIMozIconURI *aIconURI)
|
||||
GFile *file = g_file_new_for_uri(spec.get());
|
||||
GFileInfo *fileInfo = g_file_query_info(file,
|
||||
G_FILE_ATTRIBUTE_STANDARD_ICON,
|
||||
G_FILE_QUERY_INFO_NONE, NULL, NULL);
|
||||
G_FILE_QUERY_INFO_NONE,
|
||||
nullptr, nullptr);
|
||||
g_object_unref(file);
|
||||
if (fileInfo) {
|
||||
// icon from g_content_type_get_icon doesn't need unref
|
||||
@ -466,7 +468,7 @@ nsIconChannel::InitWithGIO(nsIMozIconURI *aIconURI)
|
||||
ms->GetTypeFromExtension(fileExt, type);
|
||||
}
|
||||
}
|
||||
char *ctype = NULL; // character representation of content type
|
||||
char *ctype = nullptr; // character representation of content type
|
||||
if (!type.IsEmpty()) {
|
||||
ctype = g_content_type_from_mime_type(type.get());
|
||||
}
|
||||
@ -478,7 +480,7 @@ nsIconChannel::InitWithGIO(nsIMozIconURI *aIconURI)
|
||||
|
||||
// Get default icon theme
|
||||
GtkIconTheme *iconTheme = gtk_icon_theme_get_default();
|
||||
GtkIconInfo *iconInfo = NULL;
|
||||
GtkIconInfo *iconInfo = nullptr;
|
||||
// Get icon size
|
||||
int32_t iconSize = GetIconSize(aIconURI);
|
||||
|
||||
@ -501,7 +503,7 @@ nsIconChannel::InitWithGIO(nsIMozIconURI *aIconURI)
|
||||
}
|
||||
|
||||
// Create a GdkPixbuf buffer containing icon and scale it
|
||||
GdkPixbuf* buf = gtk_icon_info_load_icon(iconInfo, NULL);
|
||||
GdkPixbuf* buf = gtk_icon_info_load_icon(iconInfo, nullptr);
|
||||
gtk_icon_info_free(iconInfo);
|
||||
if (!buf) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
@ -593,7 +595,7 @@ nsIconChannel::Init(nsIURI* aURI)
|
||||
|
||||
ensure_stock_image_widget();
|
||||
GtkStyle *style = gtk_widget_get_style(gStockImageWidget);
|
||||
GtkIconSet *icon_set = NULL;
|
||||
GtkIconSet *icon_set = nullptr;
|
||||
if (!useIconName) {
|
||||
icon_set = gtk_style_lookup_icon_set(style, stockID.get());
|
||||
}
|
||||
@ -614,15 +616,15 @@ nsIconChannel::Init(nsIURI* aURI)
|
||||
}
|
||||
|
||||
GdkPixbuf *icon =
|
||||
gtk_icon_set_render_icon (icon_set, style, direction, state,
|
||||
icon_size, gStockImageWidget, NULL);
|
||||
gtk_icon_set_render_icon(icon_set, style, direction, state,
|
||||
icon_size, gStockImageWidget, nullptr);
|
||||
if (useIconName) {
|
||||
gtk_icon_set_unref(icon_set);
|
||||
}
|
||||
|
||||
// According to documentation, gtk_icon_set_render_icon() never returns
|
||||
// NULL, but it does return NULL when we have the problem reported here:
|
||||
// https://bugzilla.gnome.org/show_bug.cgi?id=629878#c13
|
||||
// nullptr, but it does return nullptr when we have the problem reported
|
||||
// here: https://bugzilla.gnome.org/show_bug.cgi?id=629878#c13
|
||||
if (!icon)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
|
@ -22,17 +22,17 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsIconProtocolHandler)
|
||||
NS_DEFINE_NAMED_CID(NS_ICONPROTOCOL_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kIconCIDs[] = {
|
||||
{ &kNS_ICONPROTOCOL_CID, false, NULL, nsIconProtocolHandlerConstructor },
|
||||
{ NULL }
|
||||
{ &kNS_ICONPROTOCOL_CID, false, nullptr, nsIconProtocolHandlerConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kIconContracts[] = {
|
||||
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-icon", &kNS_ICONPROTOCOL_CID },
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::CategoryEntry kIconCategories[] = {
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static void
|
||||
@ -48,8 +48,8 @@ static const mozilla::Module kIconModule = {
|
||||
kIconCIDs,
|
||||
kIconContracts,
|
||||
kIconCategories,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
IconDecoderModuleDtor
|
||||
};
|
||||
|
||||
|
@ -236,7 +236,7 @@ static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFOW* aSFI
|
||||
::GetShortPathNameW(fileNativePathStr.get(), fileNativePath, ArrayLength(fileNativePath));
|
||||
|
||||
LPITEMIDLIST idList;
|
||||
HRESULT hr = ::SHGetSpecialFolderLocation(NULL, aFolder, &idList);
|
||||
HRESULT hr = ::SHGetSpecialFolderLocation(nullptr, aFolder, &idList);
|
||||
if (SUCCEEDED(hr)) {
|
||||
PRUnichar specialNativePath[MAX_PATH];
|
||||
::SHGetPathFromIDListW(idList, specialNativePath);
|
||||
@ -456,7 +456,7 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, bool nonBlocki
|
||||
nsresult rv = NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
// GetDIBits does not exist on windows mobile.
|
||||
HICON hIcon = NULL;
|
||||
HICON hIcon = nullptr;
|
||||
|
||||
nsCOMPtr<nsIMozIconURI> iconURI(do_QueryInterface(mUrl, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -477,12 +477,12 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, bool nonBlocki
|
||||
if (GetIconInfo(hIcon, &iconInfo))
|
||||
{
|
||||
// we got the bitmaps, first find out their size
|
||||
HDC hDC = CreateCompatibleDC(NULL); // get a device context for the screen.
|
||||
HDC hDC = CreateCompatibleDC(nullptr); // get a device context for the screen.
|
||||
BITMAPINFOHEADER maskHeader = {sizeof(BITMAPINFOHEADER)};
|
||||
BITMAPINFOHEADER colorHeader = {sizeof(BITMAPINFOHEADER)};
|
||||
int colorTableSize, maskTableSize;
|
||||
if (GetDIBits(hDC, iconInfo.hbmMask, 0, 0, NULL, (BITMAPINFO*)&maskHeader, DIB_RGB_COLORS) &&
|
||||
GetDIBits(hDC, iconInfo.hbmColor, 0, 0, NULL, (BITMAPINFO*)&colorHeader, DIB_RGB_COLORS) &&
|
||||
if (GetDIBits(hDC, iconInfo.hbmMask, 0, 0, nullptr, (BITMAPINFO*)&maskHeader, DIB_RGB_COLORS) &&
|
||||
GetDIBits(hDC, iconInfo.hbmColor, 0, 0, nullptr, (BITMAPINFO*)&colorHeader, DIB_RGB_COLORS) &&
|
||||
maskHeader.biHeight == colorHeader.biHeight &&
|
||||
maskHeader.biWidth == colorHeader.biWidth &&
|
||||
colorHeader.biBitCount > 8 &&
|
||||
|
@ -121,7 +121,7 @@ nsPNGDecoder::nsPNGDecoder(RasterImage &aImage)
|
||||
nsPNGDecoder::~nsPNGDecoder()
|
||||
{
|
||||
if (mPNG)
|
||||
png_destroy_read_struct(&mPNG, mInfo ? &mInfo : NULL, NULL);
|
||||
png_destroy_read_struct(&mPNG, mInfo ? &mInfo : nullptr, nullptr);
|
||||
if (mCMSLine)
|
||||
nsMemory::Free(mCMSLine);
|
||||
if (interlacebuf)
|
||||
@ -237,7 +237,7 @@ nsPNGDecoder::InitInternal()
|
||||
/* Always decode to 24 bit pixdepth */
|
||||
|
||||
mPNG = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||
NULL, nsPNGDecoder::error_callback,
|
||||
nullptr, nsPNGDecoder::error_callback,
|
||||
nsPNGDecoder::warning_callback);
|
||||
if (!mPNG) {
|
||||
PostDecoderError(NS_ERROR_OUT_OF_MEMORY);
|
||||
@ -247,7 +247,7 @@ nsPNGDecoder::InitInternal()
|
||||
mInfo = png_create_info_struct(mPNG);
|
||||
if (!mInfo) {
|
||||
PostDecoderError(NS_ERROR_OUT_OF_MEMORY);
|
||||
png_destroy_read_struct(&mPNG, NULL, NULL);
|
||||
png_destroy_read_struct(&mPNG, nullptr, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -348,7 +348,7 @@ nsPNGDecoder::WriteInternal(const char *aBuffer, uint32_t aCount)
|
||||
if (!HasError())
|
||||
PostDataError();
|
||||
|
||||
png_destroy_read_struct(&mPNG, &mInfo, NULL);
|
||||
png_destroy_read_struct(&mPNG, &mInfo, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr)
|
||||
int bit_depth, color_type, interlace_type, compression_type, filter_type;
|
||||
unsigned int channels;
|
||||
|
||||
png_bytep trans = NULL;
|
||||
png_bytep trans = nullptr;
|
||||
int num_trans = 0;
|
||||
|
||||
nsPNGDecoder *decoder =
|
||||
@ -633,7 +633,8 @@ nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr)
|
||||
|
||||
#ifdef PNG_APNG_SUPPORTED
|
||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_acTL))
|
||||
png_set_progressive_frame_fn(png_ptr, nsPNGDecoder::frame_info_callback, NULL);
|
||||
png_set_progressive_frame_fn(png_ptr, nsPNGDecoder::frame_info_callback,
|
||||
nullptr);
|
||||
|
||||
if (png_get_first_frame_is_hidden(png_ptr, info_ptr)) {
|
||||
decoder->mFrameIsHidden = true;
|
||||
@ -680,14 +681,14 @@ nsPNGDecoder::row_callback(png_structp png_ptr, png_bytep new_row,
|
||||
* image is interlacing, and you turned on the interlace handler,
|
||||
* this function will be called for every row in every pass.
|
||||
* Some of these rows will not be changed from the previous pass.
|
||||
* When the row is not changed, the new_row variable will be NULL.
|
||||
* The rows and passes are called in order, so you don't really
|
||||
* need the row_num and pass, but I'm supplying them because it
|
||||
* may make your life easier.
|
||||
* When the row is not changed, the new_row variable will be
|
||||
* nullptr. The rows and passes are called in order, so you don't
|
||||
* really need the row_num and pass, but I'm supplying them
|
||||
* because it may make your life easier.
|
||||
*
|
||||
* For the non-NULL rows of interlaced images, you must call
|
||||
* For the non-nullptr rows of interlaced images, you must call
|
||||
* png_progressive_combine_row() passing in the row and the
|
||||
* old row. You can call this function for NULL rows (it will
|
||||
* old row. You can call this function for nullptr rows (it will
|
||||
* just return) and for non-interlaced images (it just does the
|
||||
* memcpy for you) if it will make the code easier. Thus, you
|
||||
* can just do this for all cases:
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
png_color_type;
|
||||
|
||||
if (png_get_IHDR(mPNG, mInfo, &png_width, &png_height, &png_bit_depth,
|
||||
&png_color_type, NULL, NULL, NULL)) {
|
||||
&png_color_type, nullptr, nullptr, nullptr)) {
|
||||
|
||||
return ((png_color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
|
||||
png_color_type == PNG_COLOR_TYPE_RGB) &&
|
||||
|
@ -22,7 +22,7 @@ static const char* sDiscardTimeoutPref = "image.mem.min_discard_timeout_ms";
|
||||
/* static */ int64_t DiscardTracker::sCurrentDecodedImageBytes = 0;
|
||||
/* static */ uint32_t DiscardTracker::sMinDiscardTimeoutMs = 10000;
|
||||
/* static */ uint32_t DiscardTracker::sMaxDecodedImageKB = 42 * 1024;
|
||||
/* static */ PRLock * DiscardTracker::sAllocationLock = NULL;
|
||||
/* static */ PRLock * DiscardTracker::sAllocationLock = nullptr;
|
||||
|
||||
/*
|
||||
* When we notice we're using too much memory for decoded images, we enqueue a
|
||||
@ -100,7 +100,7 @@ DiscardTracker::Shutdown()
|
||||
|
||||
if (sTimer) {
|
||||
sTimer->Cancel();
|
||||
sTimer = NULL;
|
||||
sTimer = nullptr;
|
||||
}
|
||||
|
||||
// Clear the sDiscardableImages linked list so that its destructor
|
||||
|
@ -1052,14 +1052,14 @@ size_t
|
||||
RasterImage::NonHeapSizeOfDecoded() const
|
||||
{
|
||||
return SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MEMORY_IN_PROCESS_NONHEAP,
|
||||
NULL);
|
||||
nullptr);
|
||||
}
|
||||
|
||||
size_t
|
||||
RasterImage::OutOfProcessSizeOfDecoded() const
|
||||
{
|
||||
return SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MEMORY_OUT_OF_PROCESS,
|
||||
NULL);
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -840,7 +840,7 @@ size_t
|
||||
imgFrame::SizeOfExcludingThisWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation, mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
// aMallocSizeOf is only used if aLocation==MEMORY_IN_PROCESS_HEAP. It
|
||||
// should be NULL otherwise.
|
||||
// should be nullptr otherwise.
|
||||
NS_ABORT_IF_FALSE(
|
||||
(aLocation == gfxASurface::MEMORY_IN_PROCESS_HEAP && aMallocSizeOf) ||
|
||||
(aLocation != gfxASurface::MEMORY_IN_PROCESS_HEAP && !aMallocSizeOf),
|
||||
|
@ -449,9 +449,9 @@ static nsresult NewImageChannel(nsIChannel **aResult,
|
||||
aLoadGroup->GetNotificationCallbacks(getter_AddRefs(callbacks));
|
||||
}
|
||||
|
||||
// Pass in a NULL loadgroup because this is the underlying network request.
|
||||
// This request may be referenced by several proxy image requests (psossibly
|
||||
// in different documents).
|
||||
// Pass in a nullptr loadgroup because this is the underlying network
|
||||
// request. This request may be referenced by several proxy image requests
|
||||
// (possibly in different documents).
|
||||
// If all of the proxy requests are canceled then this request should be
|
||||
// canceled too.
|
||||
//
|
||||
@ -1638,7 +1638,7 @@ nsresult imgLoader::LoadImage(nsIURI *aURI,
|
||||
entry->Touch();
|
||||
|
||||
#ifdef DEBUG_joe
|
||||
printf("CACHEGET: %d %s %d\n", time(NULL), spec.get(), entry->SizeOfData());
|
||||
printf("CACHEGET: %d %s %d\n", time(nullptr), spec.get(), entry->SizeOfData());
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
@ -1991,7 +1991,7 @@ nsresult imgLoader::GetMimeTypeFromContent(const char* aContents, uint32_t aLeng
|
||||
|
||||
/* or how about ART? */
|
||||
/* ART begins with JG (4A 47). Major version offset 2.
|
||||
* Minor version offset 3. Offset 4 must be NULL.
|
||||
* Minor version offset 3. Offset 4 must be nullptr.
|
||||
*/
|
||||
else if (aLength >= 5 &&
|
||||
((unsigned char) aContents[0])==0x4a &&
|
||||
|
Loading…
Reference in New Issue
Block a user