diff options
| author | Tillmann Karras <tilkax@gmail.com> | 2014-03-09 21:14:26 +0100 |
|---|---|---|
| committer | Tillmann Karras <tilkax@gmail.com> | 2014-03-09 21:14:26 +0100 |
| commit | d802d392811be44d34ae9cd23f616db93e54c50f (patch) | |
| tree | f9aa8831a0731ea246bd921d979f4bffa7f07bd0 /Source/Core/VideoCommon | |
| parent | f28116b7da6aac6069084596dc4dbf866bdebfd8 (diff) | |
clang-modernize -use-nullptr
and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine
Diffstat (limited to 'Source/Core/VideoCommon')
23 files changed, 101 insertions, 101 deletions
diff --git a/Source/Core/VideoCommon/AVIDump.cpp b/Source/Core/VideoCommon/AVIDump.cpp index e2c2417837..3089aa85f2 100644 --- a/Source/Core/VideoCommon/AVIDump.cpp +++ b/Source/Core/VideoCommon/AVIDump.cpp @@ -68,7 +68,7 @@ bool AVIDump::CreateFile() AVIFileInit(); NOTICE_LOG(VIDEO, "Opening AVI file (%s) for dumping", movie_file_name); // TODO: Make this work with AVIFileOpenW without it throwing REGDB_E_CLASSNOTREG - HRESULT hr = AVIFileOpenA(&m_file, movie_file_name, OF_WRITE | OF_CREATE, NULL); + HRESULT hr = AVIFileOpenA(&m_file, movie_file_name, OF_WRITE | OF_CREATE, nullptr); if (FAILED(hr)) { if (hr == AVIERR_BADFORMAT) NOTICE_LOG(VIDEO, "The file couldn't be read, indicating a corrupt file or an unrecognized format."); @@ -99,7 +99,7 @@ bool AVIDump::CreateFile() } } - if (FAILED(AVIMakeCompressedStream(&m_streamCompressed, m_stream, &m_options, NULL))) + if (FAILED(AVIMakeCompressedStream(&m_streamCompressed, m_stream, &m_options, nullptr))) { NOTICE_LOG(VIDEO, "AVIMakeCompressedStream failed"); Stop(); @@ -121,19 +121,19 @@ void AVIDump::CloseFile() if (m_streamCompressed) { AVIStreamClose(m_streamCompressed); - m_streamCompressed = NULL; + m_streamCompressed = nullptr; } if (m_stream) { AVIStreamClose(m_stream); - m_stream = NULL; + m_stream = nullptr; } if (m_file) { AVIFileRelease(m_file); - m_file = NULL; + m_file = nullptr; } AVIFileExit(); @@ -160,7 +160,7 @@ void AVIDump::AddFrame(const u8* data, int w, int h) m_bitmap.biHeight = h; } - AVIStreamWrite(m_streamCompressed, ++m_frameCount, 1, const_cast<u8*>(data), m_bitmap.biSizeImage, AVIIF_KEYFRAME, NULL, &m_byteBuffer); + AVIStreamWrite(m_streamCompressed, ++m_frameCount, 1, const_cast<u8*>(data), m_bitmap.biSizeImage, AVIIF_KEYFRAME, nullptr, &m_byteBuffer); m_totalBytes += m_byteBuffer; // Close the recording if the file is more than 2gb // VfW can't properly save files over 2gb in size, but can keep writing to them up to 4gb. @@ -215,11 +215,11 @@ extern "C" { #include <libavutil/mathematics.h> } -AVFormatContext *s_FormatContext = NULL; -AVStream *s_Stream = NULL; -AVFrame *s_BGRFrame = NULL, *s_YUVFrame = NULL; -uint8_t *s_YUVBuffer = NULL; -uint8_t *s_OutBuffer = NULL; +AVFormatContext *s_FormatContext = nullptr; +AVStream *s_Stream = nullptr; +AVFrame *s_BGRFrame = nullptr, *s_YUVFrame = nullptr; +uint8_t *s_YUVBuffer = nullptr; +uint8_t *s_OutBuffer = nullptr; int s_width; int s_height; int s_size; @@ -245,14 +245,14 @@ bool AVIDump::Start(int w, int h) bool AVIDump::CreateFile() { - AVCodec *codec = NULL; + AVCodec *codec = nullptr; s_FormatContext = avformat_alloc_context(); snprintf(s_FormatContext->filename, sizeof(s_FormatContext->filename), "%s", (File::GetUserPath(D_DUMPFRAMES_IDX) + "framedump0.avi").c_str()); File::CreateFullPath(s_FormatContext->filename); - if (!(s_FormatContext->oformat = av_guess_format("avi", NULL, NULL)) || + if (!(s_FormatContext->oformat = av_guess_format("avi", nullptr, nullptr)) || !(s_Stream = avformat_new_stream(s_FormatContext, codec))) { CloseFile(); @@ -270,7 +270,7 @@ bool AVIDump::CreateFile() s_Stream->codec->pix_fmt = g_Config.bUseFFV1 ? PIX_FMT_BGRA : PIX_FMT_YUV420P; if (!(codec = avcodec_find_encoder(s_Stream->codec->codec_id)) || - (avcodec_open2(s_Stream->codec, codec, NULL) < 0)) + (avcodec_open2(s_Stream->codec, codec, nullptr) < 0)) { CloseFile(); return false; @@ -294,7 +294,7 @@ bool AVIDump::CreateFile() return false; } - avformat_write_header(s_FormatContext, NULL); + avformat_write_header(s_FormatContext, nullptr); return true; } @@ -307,7 +307,7 @@ void AVIDump::AddFrame(const u8* data, int width, int height) // width and height struct SwsContext *s_SwsContext; if ((s_SwsContext = sws_getContext(width, height, PIX_FMT_BGR24, s_width, s_height, - s_Stream->codec->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL))) + s_Stream->codec->pix_fmt, SWS_BICUBIC, nullptr, nullptr, nullptr))) { sws_scale(s_SwsContext, s_BGRFrame->data, s_BGRFrame->linesize, 0, height, s_YUVFrame->data, s_YUVFrame->linesize); @@ -334,7 +334,7 @@ void AVIDump::AddFrame(const u8* data, int width, int height) av_interleaved_write_frame(s_FormatContext, &pkt); // Encode delayed frames - outsize = avcodec_encode_video(s_Stream->codec, s_OutBuffer, s_size, NULL); + outsize = avcodec_encode_video(s_Stream->codec, s_OutBuffer, s_size, nullptr); } } @@ -352,31 +352,31 @@ void AVIDump::CloseFile() if (s_Stream->codec) avcodec_close(s_Stream->codec); av_free(s_Stream); - s_Stream = NULL; + s_Stream = nullptr; } if (s_YUVBuffer) delete[] s_YUVBuffer; - s_YUVBuffer = NULL; + s_YUVBuffer = nullptr; if (s_OutBuffer) delete[] s_OutBuffer; - s_OutBuffer = NULL; + s_OutBuffer = nullptr; if (s_BGRFrame) av_free(s_BGRFrame); - s_BGRFrame = NULL; + s_BGRFrame = nullptr; if (s_YUVFrame) av_free(s_YUVFrame); - s_YUVFrame = NULL; + s_YUVFrame = nullptr; if (s_FormatContext) { if (s_FormatContext->pb) avio_close(s_FormatContext->pb); av_free(s_FormatContext); - s_FormatContext = NULL; + s_FormatContext = nullptr; } } diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index c417e0d26b..19df3ba008 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -268,7 +268,7 @@ void BPWritten(const BPCmd& bp) u32 tlutTMemAddr = (bp.newvalue & 0x3FF) << 9; u32 tlutXferCount = (bp.newvalue & 0x1FFC00) >> 5; - u8 *ptr = 0; + u8 *ptr = nullptr; // TODO - figure out a cleaner way. if (GetConfig(CONFIG_ISWII)) diff --git a/Source/Core/VideoCommon/Debugger.cpp b/Source/Core/VideoCommon/Debugger.cpp index affeb9183a..bd711439a9 100644 --- a/Source/Core/VideoCommon/Debugger.cpp +++ b/Source/Core/VideoCommon/Debugger.cpp @@ -15,7 +15,7 @@ //void UpdateFPSDisplay(const char *text); extern NativeVertexFormat *g_nativeVertexFmt; -GFXDebuggerBase *g_pdebugger = NULL; +GFXDebuggerBase *g_pdebugger = nullptr; volatile bool GFXDebuggerPauseFlag = false; // if true, the GFX thread will be spin locked until it's false again volatile PauseEvent GFXDebuggerToPauseAtNext = NOT_PAUSE; // Event which will trigger spin locking the GFX thread volatile int GFXDebuggerEventToPauseCount = 0; // Number of events to wait for until GFX thread will be paused @@ -27,14 +27,14 @@ void GFXDebuggerUpdateScreen() if (D3D::bFrameInProgress) { D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface()); - D3D::dev->SetDepthStencilSurface(NULL); + D3D::dev->SetDepthStencilSurface(nullptr); - D3D::dev->StretchRect(FramebufferManager::GetEFBColorRTSurface(), NULL, - D3D::GetBackBufferSurface(), NULL, + D3D::dev->StretchRect(FramebufferManager::GetEFBColorRTSurface(), nullptr, + D3D::GetBackBufferSurface(), nullptr, D3DTEXF_LINEAR); D3D::dev->EndScene(); - D3D::dev->Present(NULL, NULL, NULL, NULL); + D3D::dev->Present(nullptr, nullptr, nullptr, nullptr); D3D::dev->SetRenderTarget(0, FramebufferManager::GetEFBColorRTSurface()); D3D::dev->SetDepthStencilSurface(FramebufferManager::GetEFBDepthRTSurface()); @@ -43,7 +43,7 @@ void GFXDebuggerUpdateScreen() else { D3D::dev->EndScene(); - D3D::dev->Present(NULL, NULL, NULL, NULL); + D3D::dev->Present(nullptr, nullptr, nullptr, nullptr); D3D::dev->BeginScene(); }*/ } diff --git a/Source/Core/VideoCommon/EmuWindow.cpp b/Source/Core/VideoCommon/EmuWindow.cpp index b5570a9a0f..46c2b4ffa0 100644 --- a/Source/Core/VideoCommon/EmuWindow.cpp +++ b/Source/Core/VideoCommon/EmuWindow.cpp @@ -15,9 +15,9 @@ namespace EmuWindow { -HWND m_hWnd = NULL; -HWND m_hParent = NULL; -HINSTANCE m_hInstance = NULL; +HWND m_hWnd = nullptr; +HWND m_hParent = nullptr; +HINSTANCE m_hInstance = nullptr; WNDCLASSEX wndClass; const TCHAR m_szClassName[] = _T("DolphinEmuWnd"); int g_winstyle; @@ -81,7 +81,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) case WM_CLOSE: // When the user closes the window, we post an event to the main window to call Stop() // Which then handles all the necessary steps to Shutdown the core - if (m_hParent == NULL) + if (m_hParent == nullptr) { // Stop the game //PostMessage(m_hParent, WM_USER, WM_USER_STOP, 0); @@ -126,12 +126,12 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T wndClass.cbClsExtra = 0; wndClass.cbWndExtra = 0; wndClass.hInstance = hInstance; - wndClass.hIcon = LoadIcon( NULL, IDI_APPLICATION ); - wndClass.hCursor = NULL; + wndClass.hIcon = LoadIcon( nullptr, IDI_APPLICATION ); + wndClass.hCursor = nullptr; wndClass.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH ); - wndClass.lpszMenuName = NULL; + wndClass.lpszMenuName = nullptr; wndClass.lpszClassName = m_szClassName; - wndClass.hIconSm = LoadIcon( NULL, IDI_APPLICATION ); + wndClass.hIconSm = LoadIcon( nullptr, IDI_APPLICATION ); m_hInstance = hInstance; RegisterClassEx( &wndClass ); @@ -139,7 +139,7 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T m_hParent = parent; m_hWnd = CreateWindow(m_szClassName, title, (g_ActiveConfig.backend_info.bSupports3DVision && g_ActiveConfig.b3DVision) ? WS_EX_TOPMOST | WS_POPUP : WS_CHILD, - 0, 0, width, height, m_hParent, NULL, hInstance, NULL); + 0, 0, width, height, m_hParent, nullptr, hInstance, nullptr); return m_hWnd; } diff --git a/Source/Core/VideoCommon/Fifo.cpp b/Source/Core/VideoCommon/Fifo.cpp index 233f1e8109..02e80ceccf 100644 --- a/Source/Core/VideoCommon/Fifo.cpp +++ b/Source/Core/VideoCommon/Fifo.cpp @@ -70,7 +70,7 @@ void Fifo_Shutdown() { if (GpuRunningState) PanicAlert("Fifo shutting down while active"); FreeMemoryPages(videoBuffer, FIFO_SIZE); - videoBuffer = NULL; + videoBuffer = nullptr; } u8* GetVideoBufferStartPtr() diff --git a/Source/Core/VideoCommon/FramebufferManagerBase.cpp b/Source/Core/VideoCommon/FramebufferManagerBase.cpp index 0cd1eb4a83..f23af5e36c 100644 --- a/Source/Core/VideoCommon/FramebufferManagerBase.cpp +++ b/Source/Core/VideoCommon/FramebufferManagerBase.cpp @@ -14,7 +14,7 @@ unsigned int FramebufferManagerBase::s_last_xfb_height = 1; FramebufferManagerBase::FramebufferManagerBase() { - m_realXFBSource = NULL; + m_realXFBSource = nullptr; // can't hurt memset(m_overlappingXFBArray, 0, sizeof(m_overlappingXFBArray)); @@ -34,7 +34,7 @@ FramebufferManagerBase::~FramebufferManagerBase() const XFBSourceBase* const* FramebufferManagerBase::GetXFBSource(u32 xfbAddr, u32 fbWidth, u32 fbHeight, u32 &xfbCount) { if (!g_ActiveConfig.bUseXFB) - return NULL; + return nullptr; if (g_ActiveConfig.bUseRealXFB) return GetRealXFBSource(xfbAddr, fbWidth, fbHeight, xfbCount); @@ -77,7 +77,7 @@ const XFBSourceBase* const* FramebufferManagerBase::GetVirtualXFBSource(u32 xfbA xfbCount = 0; if (m_virtualXFBList.empty()) // no Virtual XFBs available - return NULL; + return nullptr; u32 srcLower = xfbAddr; u32 srcUpper = xfbAddr + 2 * fbWidth * fbHeight; @@ -143,7 +143,7 @@ void FramebufferManagerBase::CopyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHe if (vxfb->xfbSource && (vxfb->xfbSource->texWidth != target_width || vxfb->xfbSource->texHeight != target_height)) { //delete vxfb->xfbSource; - //vxfb->xfbSource = NULL; + //vxfb->xfbSource = nullptr; } if (!vxfb->xfbSource) diff --git a/Source/Core/VideoCommon/FramebufferManagerBase.h b/Source/Core/VideoCommon/FramebufferManagerBase.h index 6f0b73f570..4cfbbcacba 100644 --- a/Source/Core/VideoCommon/FramebufferManagerBase.h +++ b/Source/Core/VideoCommon/FramebufferManagerBase.h @@ -58,7 +58,7 @@ public: protected: struct VirtualXFB { - VirtualXFB() : xfbSource(NULL) {} + VirtualXFB() : xfbSource(nullptr) {} // Address and size in GameCube RAM u32 xfbAddr; diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp index 286e3e28d5..151173f637 100644 --- a/Source/Core/VideoCommon/HiresTextures.cpp +++ b/Source/Core/VideoCommon/HiresTextures.cpp @@ -70,7 +70,7 @@ void Init(const char *gameCode) for (auto& rFilename : rFilenames) { std::string FileName; - SplitPath(rFilename, NULL, &FileName, NULL); + SplitPath(rFilename, nullptr, &FileName, nullptr); if (FileName.substr(0, strlen(code)).compare(code) == 0 && textureMap.find(FileName) == textureMap.end()) textureMap.insert(std::map<std::string, std::string>::value_type(FileName, rFilename)); @@ -95,7 +95,7 @@ PC_TexFormat GetHiresTex(const char *fileName, unsigned int *pWidth, unsigned in int channels; u8 *temp = SOIL_load_image(textureMap[key].c_str(), &width, &height, &channels, SOIL_LOAD_RGBA); - if (temp == NULL) + if (temp == nullptr) { ERROR_LOG(VIDEO, "Custom texture %s failed to load", textureMap[key].c_str()); return PC_TEX_FMT_NONE; diff --git a/Source/Core/VideoCommon/ImageWrite.cpp b/Source/Core/VideoCommon/ImageWrite.cpp index a3c9dec86a..d16164887c 100644 --- a/Source/Core/VideoCommon/ImageWrite.cpp +++ b/Source/Core/VideoCommon/ImageWrite.cpp @@ -35,8 +35,8 @@ bool TextureToPng(u8* data, int row_stride, const std::string& filename, int wid char title[] = "Dolphin Screenshot"; char title_key[] = "Title"; - png_structp png_ptr = NULL; - png_infop info_ptr = NULL; + png_structp png_ptr = nullptr; + png_infop info_ptr = nullptr; // Open file for writing (binary mode) File::IOFile fp(filename, "wb"); @@ -46,8 +46,8 @@ bool TextureToPng(u8* data, int row_stride, const std::string& filename, int wid } // Initialize write structure - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (png_ptr == NULL) { + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); + if (png_ptr == nullptr) { PanicAlert("Screenshot failed: Could not allocate write struct\n"); goto finalise; @@ -55,7 +55,7 @@ bool TextureToPng(u8* data, int row_stride, const std::string& filename, int wid // Initialize info structure info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == NULL) { + if (info_ptr == nullptr) { PanicAlert("Screenshot failed: Could not allocate info struct\n"); goto finalise; } @@ -96,13 +96,13 @@ bool TextureToPng(u8* data, int row_stride, const std::string& filename, int wid } // End write - png_write_end(png_ptr, NULL); + png_write_end(png_ptr, nullptr); success = true; finalise: - if (info_ptr != NULL) png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); - if (png_ptr != NULL) png_destroy_write_struct(&png_ptr, (png_infopp)NULL); + if (info_ptr != nullptr) png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); + if (png_ptr != nullptr) png_destroy_write_struct(&png_ptr, (png_infopp)nullptr); return success; } diff --git a/Source/Core/VideoCommon/IndexGenerator.cpp b/Source/Core/VideoCommon/IndexGenerator.cpp index 809a2be2e2..0989b65283 100644 --- a/Source/Core/VideoCommon/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/IndexGenerator.cpp @@ -33,7 +33,7 @@ void IndexGenerator::Init() primitive_table[3] = IndexGenerator::AddStrip<false>; primitive_table[4] = IndexGenerator::AddFan<false>; } - primitive_table[1] = NULL; + primitive_table[1] = nullptr; primitive_table[5] = &IndexGenerator::AddLineList; primitive_table[6] = &IndexGenerator::AddLineStrip; primitive_table[7] = &IndexGenerator::AddPoints; diff --git a/Source/Core/VideoCommon/OpcodeDecoding.cpp b/Source/Core/VideoCommon/OpcodeDecoding.cpp index 8c680a04c5..703f691e7e 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.cpp +++ b/Source/Core/VideoCommon/OpcodeDecoding.cpp @@ -31,7 +31,7 @@ #include "VideoCommon/XFMemory.h" -u8* g_pVideoData = 0; +u8* g_pVideoData = nullptr; bool g_bRecordFifoData = false; #if _M_SSE >= 0x301 @@ -85,7 +85,7 @@ void InterpretDisplayList(u32 address, u32 size) u8* startAddress = Memory::GetPointer(address); // Avoid the crash if Memory::GetPointer failed .. - if (startAddress != 0) + if (startAddress != nullptr) { g_pVideoData = startAddress; diff --git a/Source/Core/VideoCommon/PerfQueryBase.cpp b/Source/Core/VideoCommon/PerfQueryBase.cpp index cf59b3101c..3950d7f297 100644 --- a/Source/Core/VideoCommon/PerfQueryBase.cpp +++ b/Source/Core/VideoCommon/PerfQueryBase.cpp @@ -1,7 +1,7 @@ #include "VideoCommon/PerfQueryBase.h" #include "VideoCommon/VideoConfig.h" -PerfQueryBase* g_perf_query = 0; +PerfQueryBase* g_perf_query = nullptr; bool PerfQueryBase::ShouldEmulate() { diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index e51294e55c..1b8bae7935 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -224,17 +224,17 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T { // Non-uid template parameters will write to the dummy data (=> gets optimized out) pixel_shader_uid_data dummy_data; - pixel_shader_uid_data& uid_data = (&out.template GetUidData<pixel_shader_uid_data>() != NULL) + pixel_shader_uid_data& uid_data = (&out.template GetUidData<pixel_shader_uid_data>() != nullptr) ? out.template GetUidData<pixel_shader_uid_data>() : dummy_data; out.SetBuffer(text); - const bool is_writing_shadercode = (out.GetBuffer() != NULL); + const bool is_writing_shadercode = (out.GetBuffer() != nullptr); #ifndef ANDROID locale_t locale; locale_t old_locale; if (is_writing_shadercode) { - locale = newlocale(LC_NUMERIC_MASK, "C", NULL); // New locale for compilation + locale = newlocale(LC_NUMERIC_MASK, "C", nullptr); // New locale for compilation old_locale = uselocale(locale); // Apply the locale for this thread } #endif @@ -1177,7 +1177,7 @@ static inline void WriteFog(T& out, pixel_shader_uid_data& uid_data) } else { - if (bpmem.fog.c_proj_fsel.fsel != 2 && out.GetBuffer() != NULL) + if (bpmem.fog.c_proj_fsel.fsel != 2 && out.GetBuffer() != nullptr) WARN_LOG(VIDEO, "Unknown Fog Type! %08x", bpmem.fog.c_proj_fsel.fsel); } diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index e275238ab0..52668c4511 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -42,7 +42,7 @@ int frameCount; int OSDChoice, OSDTime; -Renderer *g_renderer = NULL; +Renderer *g_renderer = nullptr; std::mutex Renderer::s_criticalScreenshot; std::string Renderer::s_sScreenshotName; diff --git a/Source/Core/VideoCommon/ShaderGenCommon.h b/Source/Core/VideoCommon/ShaderGenCommon.h index 97dab6acf4..ca3650855c 100644 --- a/Source/Core/VideoCommon/ShaderGenCommon.h +++ b/Source/Core/VideoCommon/ShaderGenCommon.h @@ -36,7 +36,7 @@ public: * @note When implementing this method in a child class, you likely want to return the argument of the last SetBuffer call here * @note SetBuffer() should be called before using GetBuffer(). */ - const char* GetBuffer() { return NULL; } + const char* GetBuffer() { return nullptr; } /* * Can be used to give the object a place to write to. This should be called before using Write(). @@ -51,10 +51,10 @@ public: /* * Returns a pointer to an internally stored object of the uid_data type. - * @warning since most child classes use the default implementation you shouldn't access this directly without adding precautions against NULL access (e.g. via adding a dummy structure, cf. the vertex/pixel shader generators) + * @warning since most child classes use the default implementation you shouldn't access this directly without adding precautions against nullptr access (e.g. via adding a dummy structure, cf. the vertex/pixel shader generators) */ template<class uid_data> - uid_data& GetUidData() { return *(uid_data*)NULL; } + uid_data& GetUidData() { return *(uid_data*)nullptr; } }; /** @@ -106,7 +106,7 @@ private: class ShaderCode : public ShaderGeneratorInterface { public: - ShaderCode() : buf(NULL), write_ptr(NULL) + ShaderCode() : buf(nullptr), write_ptr(nullptr) { } diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 1c9bb0ba2a..c5f4f127f2 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -25,7 +25,7 @@ enum TextureCache *g_texture_cache; -GC_ALIGNED16(u8 *TextureCache::temp) = NULL; +GC_ALIGNED16(u8 *TextureCache::temp) = nullptr; unsigned int TextureCache::temp_size; TextureCache::TexCache TextureCache::textures; @@ -72,7 +72,7 @@ TextureCache::~TextureCache() { Invalidate(); FreeAlignedMemory(temp); - temp = NULL; + temp = nullptr; } void TextureCache::OnConfigChanged(VideoConfig& config) @@ -334,7 +334,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, unsigned int const tlutaddr, int const tlutfmt, bool const use_mipmaps, unsigned int maxlevel, bool const from_tmem) { if (0 == address) - return NULL; + return nullptr; // TexelSizeInNibbles(format) * width * height / 16; const unsigned int bsw = TexDecoder_GetBlockWidthInTexels(texformat) - 1; @@ -431,7 +431,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, { // delete the texture and make a new one delete entry; - entry = NULL; + entry = nullptr; } } @@ -452,7 +452,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, if(entry) { delete entry; - entry = NULL; + entry = nullptr; } } using_custom_texture = true; @@ -480,7 +480,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, texLevels = (use_native_mips || using_custom_lods) ? texLevels : 1; // TODO: Should be forced to 1 for non-pow2 textures (e.g. efb copies with automatically adjusted IR) // create the entry/texture - if (NULL == entry) + if (nullptr == entry) { textures[texID] = entry = g_texture_cache->CreateTexture(width, height, expandedWidth, texLevels, pcfmt); @@ -522,8 +522,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, { src_data += texture_size; - const u8* ptr_even = NULL; - const u8* ptr_odd = NULL; + const u8* ptr_even = nullptr; + const u8* ptr_odd = nullptr; if (from_tmem) { ptr_even = &texMem[bpmem.tex[stage/4].texImage1[stage%4].tmem_even * TMEM_LINE_SIZE + texture_size]; @@ -862,11 +862,11 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat { // remove it and recreate it as a render target delete entry; - entry = NULL; + entry = nullptr; } } - if (NULL == entry) + if (nullptr == entry) { // create the texture textures[dstAddr] = entry = g_texture_cache->CreateRenderTargetTexture(scaled_tex_w, scaled_tex_h); diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp index 44bc3726e2..f7fd921c27 100644 --- a/Source/Core/VideoCommon/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/TextureConversionShader.cpp @@ -604,7 +604,7 @@ void WriteZ24Encoder(char*& p, API_TYPE ApiType) const char *GenerateEncodingShader(u32 format,API_TYPE ApiType) { #ifndef ANDROID - locale_t locale = newlocale(LC_NUMERIC_MASK, "C", NULL); // New locale for compilation + locale_t locale = newlocale(LC_NUMERIC_MASK, "C", nullptr); // New locale for compilation locale_t old_locale = uselocale(locale); // Apply the locale for this thread #endif text[sizeof(text) - 1] = 0x7C; // canary diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp index dac42c0b4d..c943b3c04d 100644 --- a/Source/Core/VideoCommon/VertexLoader.cpp +++ b/Source/Core/VideoCommon/VertexLoader.cpp @@ -464,10 +464,10 @@ void LOADERDECL TexMtx_Write_Float4() VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr) { - m_compiledCode = NULL; + m_compiledCode = nullptr; m_numLoadedVertices = 0; m_VertexSize = 0; - m_NativeFmt = 0; + m_NativeFmt = nullptr; loop_counter = 0; VertexLoader_Normal::Init(); VertexLoader_Position::Init(); @@ -594,7 +594,7 @@ void VertexLoader::CompileVertexTranslator() TPipelineFunction pFunc = VertexLoader_Normal::GetFunction(m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3); - if (pFunc == 0) + if (pFunc == nullptr) { Host_SysMessage( StringFromFormat("VertexLoader_Normal::GetFunction(%i %i %i %i) returned zero!", @@ -829,7 +829,7 @@ void VertexLoader::SetupRunVertices(int vtx_attr_group, int primitive, int const m_numLoadedVertices += count; // Flush if our vertex format is different from the currently set. - if (g_nativeVertexFmt != NULL && g_nativeVertexFmt != m_NativeFmt) + if (g_nativeVertexFmt != nullptr && g_nativeVertexFmt != m_NativeFmt) { // We really must flush here. It's possible that the native representations // of the two vtx formats are the same, but we have no way to easily check that diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index b7ad98e67d..5757dc6f45 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -44,7 +44,7 @@ void Init() { MarkAllDirty(); for (VertexLoader*& vertexLoader : g_VertexLoaders) - vertexLoader = NULL; + vertexLoader = nullptr; RecomputeCachedArraybases(); } diff --git a/Source/Core/VideoCommon/VertexLoader_Position.cpp b/Source/Core/VideoCommon/VertexLoader_Position.cpp index 5ca07e7792..f95ef665bf 100644 --- a/Source/Core/VideoCommon/VertexLoader_Position.cpp +++ b/Source/Core/VideoCommon/VertexLoader_Position.cpp @@ -123,11 +123,11 @@ void LOADERDECL Pos_ReadIndex_Float_SSSE3() static TPipelineFunction tableReadPosition[4][8][2] = { { - {NULL, NULL,}, - {NULL, NULL,}, - {NULL, NULL,}, - {NULL, NULL,}, - {NULL, NULL,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, }, { {Pos_ReadDirect<u8, 2>, Pos_ReadDirect<u8, 3>,}, diff --git a/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp b/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp index d8fcf9bbaa..b7a6a3ec7b 100644 --- a/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp +++ b/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp @@ -132,11 +132,11 @@ void LOADERDECL TexCoord_ReadIndex_Float2_SSSE3() static TPipelineFunction tableReadTexCoord[4][8][2] = { { - {NULL, NULL,}, - {NULL, NULL,}, - {NULL, NULL,}, - {NULL, NULL,}, - {NULL, NULL,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, }, { {TexCoord_ReadDirect<u8, 1>, TexCoord_ReadDirect<u8, 2>,}, diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index 3e2e02eecd..67c18286aa 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -60,17 +60,17 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ { // Non-uid template parameters will write to the dummy data (=> gets optimized out) vertex_shader_uid_data dummy_data; - vertex_shader_uid_data& uid_data = (&out.template GetUidData<vertex_shader_uid_data>() != NULL) + vertex_shader_uid_data& uid_data = (&out.template GetUidData<vertex_shader_uid_data>() != nullptr) ? out.template GetUidData<vertex_shader_uid_data>() : dummy_data; out.SetBuffer(text); - const bool is_writing_shadercode = (out.GetBuffer() != NULL); + const bool is_writing_shadercode = (out.GetBuffer() != nullptr); #ifndef ANDROID locale_t locale; locale_t old_locale; if (is_writing_shadercode) { - locale = newlocale(LC_NUMERIC_MASK, "C", NULL); // New locale for compilation + locale = newlocale(LC_NUMERIC_MASK, "C", nullptr); // New locale for compilation old_locale = uselocale(locale); // Apply the locale for this thread } #endif diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index 36e52b6654..a2d6d19845 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.cpp +++ b/Source/Core/VideoCommon/VideoBackendBase.cpp @@ -12,8 +12,8 @@ #include "VideoCommon/VideoBackendBase.h" std::vector<VideoBackend*> g_available_video_backends; -VideoBackend* g_video_backend = NULL; -static VideoBackend* s_default_backend = NULL; +VideoBackend* g_video_backend = nullptr; +static VideoBackend* s_default_backend = nullptr; #ifdef _WIN32 #include <windows.h> @@ -36,7 +36,7 @@ static bool IsGteVista() void VideoBackend::PopulateList() { - VideoBackend* backends[4] = { NULL }; + VideoBackend* backends[4] = { nullptr }; // OGL > D3D11 > SW #if !defined(USE_GLES) || USE_GLES3 @@ -69,7 +69,7 @@ void VideoBackend::ClearList() void VideoBackend::ActivateBackend(const std::string& name) { - if (name.length() == 0) // If NULL, set it to the default backend (expected behavior) + if (name.length() == 0) // If nullptr, set it to the default backend (expected behavior) g_video_backend = s_default_backend; for (VideoBackend* backend : g_available_video_backends) |
