Bug 784739 - Switch from NULL to nullptr in miscellaneous directories; r=ehsan

--HG--
extra : rebase_source : 8ace754e117a12e2599f5a90030f13a3a7064fed
This commit is contained in:
Birunthan Mohanathas 2013-11-25 14:02:47 -05:00
parent 46363842f7
commit 1e8f99fd01
16 changed files with 72 additions and 64 deletions

View File

@ -185,7 +185,7 @@ private:
{
D2D1_RECT_F mBounds;
union {
// If mPath is non-NULL, the mTransform member will be used, otherwise
// If mPath is non-null, the mTransform member will be used, otherwise
// the mIsPixelAligned member is valid.
D2D1_MATRIX_3X2_F mTransform;
bool mIsPixelAligned;

View File

@ -122,7 +122,7 @@ struct TestEntry {
isRTL = true;
}
// empty/NULL fontName means ignore font name
// Empty/nullptr fontName means ignore font name
void Expect (const char *platform,
const char *fontName,
const LiteralArray& glyphs)

View File

@ -343,8 +343,9 @@ NS_GFX_(void) ScaleYCbCrToRGB565(const uint8_t *y_buf,
that would require the mis-alignment to be the same for the U and V
planes.*/
NS_ASSERTION((y_pitch&15) == 0 && (uv_pitch&15) == 0 &&
((y_buf-(uint8_t *)NULL)&15) == 0 &&
((u_buf-(uint8_t *)NULL)&15) == 0 && ((v_buf-(uint8_t *)NULL)&15) == 0,
((y_buf-(uint8_t *)nullptr)&15) == 0 &&
((u_buf-(uint8_t *)nullptr)&15) == 0 &&
((v_buf-(uint8_t *)nullptr)&15) == 0,
"ScaleYCbCrToRGB565 source image unaligned");
/*We take an area-based approach to pixel coverage to avoid shifting by small
amounts (or not so small, when up-scaling or down-scaling by a large

View File

@ -21,7 +21,10 @@ NS_GetComplexLineBreaks(const PRUnichar* aText, uint32_t aLength,
return;
}
CFStringTokenizerRef st = ::CFStringTokenizerCreate(kCFAllocatorDefault, str, ::CFRangeMake(0, aLength), kCFStringTokenizerUnitLineBreak, NULL);
CFStringTokenizerRef st = ::CFStringTokenizerCreate(kCFAllocatorDefault, str,
::CFRangeMake(0, aLength),
kCFStringTokenizerUnitLineBreak,
nullptr);
if (!st) {
::CFRelease(str);
return;

View File

@ -703,7 +703,7 @@ CountHeap(JSContext *cx, unsigned argc, jsval *vp)
RootedValue traceValue(cx);
int32_t traceKind = -1;
void *traceThing = NULL;
void *traceThing = nullptr;
if (args.length() > 1) {
JSString *str = ToString(cx, args[1]);
if (!str)

View File

@ -517,7 +517,7 @@ GlobalObject::warnOnceAboutWatch(JSContext *cx, HandleObject obj)
HeapSlot &v = global->getSlotRef(WARNED_WATCH_DEPRECATED);
if (v.isUndefined()) {
// Warn only once per global object.
if (!JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING, js_GetErrorMessage, NULL,
if (!JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING, js_GetErrorMessage, nullptr,
JSMSG_OBJECT_WATCH_DEPRECATED))
{
return false;

View File

@ -3,6 +3,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stagefright/ColorConverter.h>
#include <stagefright/DataSource.h>
#include <stagefright/MediaExtractor.h>
@ -117,11 +118,11 @@ public:
}
bool HasVideo() {
return mVideoSource != NULL;
return mVideoSource != nullptr;
}
bool HasAudio() {
return mAudioSource != NULL;
return mAudioSource != nullptr;
}
bool ReadVideo(VideoFrame *aFrame, int64_t aSeekTimeUs, BufferCallback *aBufferCallback);
@ -142,9 +143,9 @@ OmxDecoder::OmxDecoder(PluginHost *aPluginHost, Decoder *aDecoder) :
mAudioChannels(-1),
mAudioSampleRate(-1),
mDurationUs(-1),
mVideoBuffer(NULL),
mAudioBuffer(NULL),
mColorConverter(NULL),
mVideoBuffer(nullptr),
mAudioBuffer(nullptr),
mColorConverter(nullptr),
mAudioMetadataRead(false)
{
}
@ -184,9 +185,9 @@ public:
};
#ifdef MOZ_WIDGET_GONK
static sp<IOMX> sOMX = NULL;
static sp<IOMX> sOMX = nullptr;
static sp<IOMX> GetOMX() {
if(sOMX.get() == NULL) {
if(sOMX.get() == nullptr) {
sOMX = reinterpret_cast<IOMX*>(new OMX);
}
return sOMX;
@ -233,9 +234,9 @@ static sp<MediaSource> CreateVideoSource(PluginHost* aPluginHost,
if (flags == DEFAULT_STAGEFRIGHT_FLAGS) {
// Let Stagefright choose hardware or software decoder.
sp<MediaSource> videoSource = OMXCodec::Create(aOmx, aVideoTrack->getFormat(),
false, aVideoTrack, NULL, flags);
if (videoSource == NULL)
return NULL;
false, aVideoTrack, nullptr, flags);
if (videoSource == nullptr)
return nullptr;
// Now that OMXCodec has parsed the video's AVCDecoderConfigurationRecord,
// check whether we know how to decode this video.
@ -281,7 +282,7 @@ static sp<MediaSource> CreateVideoSource(PluginHost* aPluginHost,
MOZ_ASSERT(flags != DEFAULT_STAGEFRIGHT_FLAGS);
return OMXCodec::Create(aOmx, aVideoTrack->getFormat(), false, aVideoTrack,
NULL, flags);
nullptr, flags);
}
bool OmxDecoder::Init() {
@ -295,14 +296,14 @@ bool OmxDecoder::Init() {
}
sp<MediaExtractor> extractor = MediaExtractor::Create(dataSource);
if (extractor == NULL) {
if (extractor == nullptr) {
return false;
}
ssize_t audioTrackIndex = -1;
ssize_t videoTrackIndex = -1;
const char *audioMime = NULL;
const char *videoMime = NULL;
const char *audioMime = nullptr;
const char *videoMime = nullptr;
for (size_t i = 0; i < extractor->countTracks(); ++i) {
sp<MetaData> meta = extractor->getTrackMetaData(i);
@ -341,14 +342,14 @@ bool OmxDecoder::Init() {
sp<MediaSource> videoTrack;
sp<MediaSource> videoSource;
if (videoTrackIndex != -1 && (videoTrack = extractor->getTrack(videoTrackIndex)) != NULL) {
if (videoTrackIndex != -1 && (videoTrack = extractor->getTrack(videoTrackIndex)) != nullptr) {
#if defined(MOZ_ANDROID_FROYO)
// Allow up to 720P video.
sp<MetaData> meta = extractor->getTrackMetaData(videoTrackIndex);
meta->setInt32(kKeyMaxInputSize, (1280 * 720 * 3) / 2);
#endif
videoSource = CreateVideoSource(mPluginHost, omx, videoTrack);
if (videoSource == NULL) {
if (videoSource == nullptr) {
LOG("OMXCodec failed to initialize video decoder for \"%s\"", videoMime);
return false;
}
@ -368,7 +369,7 @@ bool OmxDecoder::Init() {
sp<MediaSource> audioTrack;
sp<MediaSource> audioSource;
if (audioTrackIndex != -1 && (audioTrack = extractor->getTrack(audioTrackIndex)) != NULL)
if (audioTrackIndex != -1 && (audioTrack = extractor->getTrack(audioTrackIndex)) != nullptr)
{
if (!strcasecmp(audioMime, "audio/raw")) {
audioSource = audioTrack;
@ -379,7 +380,7 @@ bool OmxDecoder::Init() {
audioTrack);
}
if (audioSource == NULL) {
if (audioSource == nullptr) {
LOG("OMXCodec failed to initialize audio decoder for \"%s\"", audioMime);
return false;
}
@ -544,14 +545,14 @@ bool OmxDecoder::SetAudioFormat() {
void OmxDecoder::ReleaseVideoBuffer() {
if (mVideoBuffer) {
mVideoBuffer->release();
mVideoBuffer = NULL;
mVideoBuffer = nullptr;
}
}
void OmxDecoder::ReleaseAudioBuffer() {
if (mAudioBuffer) {
mAudioBuffer->release();
mAudioBuffer = NULL;
mAudioBuffer = nullptr;
}
}
@ -899,7 +900,7 @@ static const char* const gCodecs[] = {
"avc1.4D401E", // H.264 Main Profile Level 3.0
"avc1.4D401F", // H.264 Main Profile Level 3.1
"mp4a.40.2", // AAC-LC
NULL
nullptr
};
static bool CanDecode(const char *aMimeChars, size_t aMimeLen, const char* const**aCodecs)

View File

@ -645,7 +645,7 @@ DataChannelConnection::SctpDtlsInput(TransportFlow *flow,
if (PR_LOG_TEST(GetSCTPLog(), PR_LOG_DEBUG)) {
char *buf;
if ((buf = usrsctp_dumppacket((void *)data, len, SCTP_DUMP_INBOUND)) != NULL) {
if ((buf = usrsctp_dumppacket((void *)data, len, SCTP_DUMP_INBOUND)) != nullptr) {
PR_LogPrint("%s", buf);
usrsctp_freedumpbuffer(buf);
}
@ -677,7 +677,7 @@ DataChannelConnection::SctpDtlsOutput(void *addr, void *buffer, size_t length,
if (PR_LOG_TEST(GetSCTPLog(), PR_LOG_DEBUG)) {
char *buf;
if ((buf = usrsctp_dumppacket(buffer, length, SCTP_DUMP_OUTBOUND)) != NULL) {
if ((buf = usrsctp_dumppacket(buffer, length, SCTP_DUMP_OUTBOUND)) != nullptr) {
PR_LogPrint("%s", buf);
usrsctp_freedumpbuffer(buf);
}

View File

@ -111,7 +111,7 @@ int RunGTestFunc()
}
// We use a static var 'RunGTest' defined in nsAppRunner.cpp.
// RunGTest is initialized to NULL but if GTest (this file)
// RunGTest is initialized to nullptr but if GTest (this file)
// is linked in then RunGTest will be set here indicating
// GTest is supported.
class _InitRunGTest {

View File

@ -134,7 +134,7 @@ char* strtok2(char* string, const char* delims, char* *newStr)
}
*newStr = str;
return str == result ? NULL : result;
return str == result ? nullptr : result;
}
@ -218,9 +218,9 @@ string nssconfigdir;
vector<server_info_t> servers;
PRNetAddr remote_addr;
PRNetAddr websocket_server;
PRThreadPool* threads = NULL;
PRLock* shutdown_lock = NULL;
PRCondVar* shutdown_condvar = NULL;
PRThreadPool* threads = nullptr;
PRLock* shutdown_lock = nullptr;
PRCondVar* shutdown_condvar = nullptr;
// Not really used, unless something fails to start
bool shutdown_server = false;
bool do_http_proxy = false;
@ -322,19 +322,19 @@ bool ConfigureSSLServerSocket(PRFileDesc* socket, server_info_t* si, string &cer
const char* certnick = certificate.empty() ?
si->cert_nickname.c_str() : certificate.c_str();
ScopedCERTCertificate cert(PK11_FindCertFromNickname(certnick, NULL));
ScopedCERTCertificate cert(PK11_FindCertFromNickname(certnick, nullptr));
if (!cert) {
LOG_ERROR(("Failed to find cert %s\n", certnick));
return false;
}
ScopedSECKEYPrivateKey privKey(PK11_FindKeyByAnyCert(cert, NULL));
ScopedSECKEYPrivateKey privKey(PK11_FindKeyByAnyCert(cert, nullptr));
if (!privKey) {
LOG_ERROR(("Failed to find private key\n"));
return false;
}
PRFileDesc* ssl_socket = SSL_ImportFD(NULL, socket);
PRFileDesc* ssl_socket = SSL_ImportFD(nullptr, socket);
if (!ssl_socket) {
LOG_ERROR(("Error importing SSL socket\n"));
return false;
@ -934,7 +934,7 @@ void StartServer(void* data)
char* password_func(PK11SlotInfo* slot, PRBool retry, void* arg)
{
if (retry)
return NULL;
return nullptr;
return PL_strdup("");
}
@ -948,7 +948,7 @@ server_info_t* findServerInfo(int portnumber)
return &(*it);
}
return NULL;
return nullptr;
}
int processConfigLine(char* configLine)
@ -1009,7 +1009,7 @@ int processConfigLine(char* configLine)
if (!strcmp(keyword, "listen"))
{
char* hostname = strtok2(_caret, ":", &_caret);
char* hostportstring = NULL;
char* hostportstring = nullptr;
if (strcmp(hostname, "*"))
{
any_host_spec_config = true;
@ -1046,19 +1046,22 @@ int processConfigLine(char* configLine)
server_info_t server;
server.cert_nickname = certnick;
server.listen_port = port;
server.host_cert_table = PL_NewHashTable(0, PL_HashString, PL_CompareStrings, PL_CompareStrings, NULL, NULL);
server.host_cert_table = PL_NewHashTable(0, PL_HashString, PL_CompareStrings,
PL_CompareStrings, nullptr, nullptr);
if (!server.host_cert_table)
{
LOG_ERROR(("Internal, could not create hash table\n"));
return 1;
}
server.host_clientauth_table = PL_NewHashTable(0, PL_HashString, PL_CompareStrings, ClientAuthValueComparator, NULL, NULL);
server.host_clientauth_table = PL_NewHashTable(0, PL_HashString, PL_CompareStrings,
ClientAuthValueComparator, nullptr, nullptr);
if (!server.host_clientauth_table)
{
LOG_ERROR(("Internal, could not create hash table\n"));
return 1;
}
server.host_redir_table = PL_NewHashTable(0, PL_HashString, PL_CompareStrings, PL_CompareStrings, NULL, NULL);
server.host_redir_table = PL_NewHashTable(0, PL_HashString, PL_CompareStrings,
PL_CompareStrings, nullptr, nullptr);
if (!server.host_redir_table)
{
LOG_ERROR(("Internal, could not create hash table\n"));
@ -1345,7 +1348,7 @@ int main(int argc, char** argv)
}
// these values should make NSS use the defaults
if (SSL_ConfigServerSessionIDCache(0, 0, 0, NULL) != SECSuccess) {
if (SSL_ConfigServerSessionIDCache(0, 0, 0, nullptr) != SECSuccess) {
LOG_ERROR(("SSL_ConfigServerSessionIDCache failed\n"));
PR_ShutdownThreadPool(threads);
PR_DestroyCondVar(shutdown_condvar);
@ -1378,9 +1381,9 @@ int main(int argc, char** argv)
for (vector<server_info_t>::iterator it = servers.begin();
it != servers.end(); it++)
{
PL_HashTableEnumerateEntries(it->host_cert_table, freeHostCertHashItems, NULL);
PL_HashTableEnumerateEntries(it->host_clientauth_table, freeClientAuthHashItems, NULL);
PL_HashTableEnumerateEntries(it->host_redir_table, freeHostRedirHashItems, NULL);
PL_HashTableEnumerateEntries(it->host_cert_table, freeHostCertHashItems, nullptr);
PL_HashTableEnumerateEntries(it->host_clientauth_table, freeClientAuthHashItems, nullptr);
PL_HashTableEnumerateEntries(it->host_redir_table, freeHostRedirHashItems, nullptr);
PL_HashTableDestroy(it->host_cert_table);
PL_HashTableDestroy(it->host_clientauth_table);
PL_HashTableDestroy(it->host_redir_table);

View File

@ -77,7 +77,7 @@ int main(int argc, char** argv)
XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(), info);
const char* state;
const char* til_or_since = NULL;
const char* til_or_since = nullptr;
switch (info->state) {
case ScreenSaverOff:
state = "Off";
@ -127,10 +127,10 @@ int main(int argc, char** argv)
#endif
GdkWindow* window = gdk_get_default_root_window();
GdkPixbuf* screenshot = NULL;
GdkPixbuf* screenshot = nullptr;
// TODO GTK3
#if (MOZ_WIDGET_GTK == 2)
screenshot = gdk_pixbuf_get_from_drawable(NULL, window, NULL,
screenshot = gdk_pixbuf_get_from_drawable(nullptr, window, nullptr,
0, 0, 0, 0,
gdk_screen_width(),
gdk_screen_height());
@ -140,12 +140,12 @@ int main(int argc, char** argv)
return 1;
}
GError* error = NULL;
GError* error = nullptr;
if (argc > 1) {
gdk_pixbuf_save(screenshot, argv[1], "png", &error, NULL);
gdk_pixbuf_save(screenshot, argv[1], "png", &error, nullptr);
} else {
gdk_pixbuf_save_to_callback(screenshot, save_to_stdout, NULL,
"png", &error, NULL);
gdk_pixbuf_save_to_callback(screenshot, save_to_stdout, nullptr,
"png", &error, nullptr);
}
if (error) {
fprintf(stderr, "%s: failed to write screenshot as png: %s\n",

View File

@ -46,14 +46,14 @@ static int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
UINT num = 0; // number of image encoders
UINT size = 0; // size of the image encoder array in bytes
ImageCodecInfo* pImageCodecInfo = NULL;
ImageCodecInfo* pImageCodecInfo = nullptr;
GetImageEncodersSize(&num, &size);
if(size == 0)
return -1; // Failure
pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
if(pImageCodecInfo == NULL)
if(pImageCodecInfo == nullptr)
return -1; // Failure
GetImageEncoders(num, size, pImageCodecInfo);
@ -79,7 +79,7 @@ int wmain(int argc, wchar_t** argv)
{
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr);
HWND desktop = GetDesktopWindow();
HDC desktopdc = GetDC(desktop);
@ -92,11 +92,11 @@ int wmain(int argc, wchar_t** argv)
SelectObject(mydc, oldbmp);
const wchar_t* filename = (argc > 1) ? argv[1] : L"screenshot.png";
Bitmap* b = Bitmap::FromHBITMAP(mybmp, NULL);
Bitmap* b = Bitmap::FromHBITMAP(mybmp, nullptr);
CLSID encoderClsid;
Status stat = GenericError;
if (b && GetEncoderClsid(L"image/png", &encoderClsid) != -1) {
stat = b->Save(filename, &encoderClsid, NULL);
stat = b->Save(filename, &encoderClsid, nullptr);
}
if (b)
delete b;

View File

@ -405,7 +405,7 @@ nsGIOService::OrgFreedesktopFileManager1ShowItems(const nsACString& aPath)
}
char *uri = g_filename_to_uri(PromiseFlatCString(aPath).get(), nullptr, nullptr);
if (uri == NULL) {
if (uri == nullptr) {
return NS_ERROR_FAILURE;
}

View File

@ -21,7 +21,7 @@ class nsIRollupListener {
* was just rolled up.
*
* aPoint is the mouse pointer position where the event that triggered the
* rollup occurred, which may be NULL.
* rollup occurred, which may be nullptr.
*
* aCount is the number of popups in a chain to close. If this is
* UINT32_MAX, then all popups are closed.

View File

@ -138,7 +138,7 @@ bool IsValidWrite(int fd, const void *wbuf, size_t count)
}
}
// For writev we pass NULL in wbuf. We should only get here from
// For writev we pass a nullptr wbuf. We should only get here from
// dbm, and it uses write, so assert that we have wbuf.
if (!wbuf) {
return true;

View File

@ -342,7 +342,7 @@ protected:
private:
nsStorageStream* mStorageStream;
uint32_t mReadCursor; // Next memory location to read byte, or NULL
uint32_t mReadCursor; // Next memory location to read byte, or 0
uint32_t mSegmentEnd; // One byte past end of current buffer segment
uint32_t mSegmentNum; // Segment number containing read cursor
uint32_t mSegmentSize; // All segments, except the last, are of this size