From bd7fb64baec7879931d15090ac4d0c10d853702e Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Thu, 11 May 2017 11:57:57 +0300 Subject: [tidy] modernize-use-nullptr --- platform/default/bidi.cpp | 6 +++--- platform/glfw/main.cpp | 22 +++++++++++----------- test/src/mbgl/test/getrss.cpp | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/platform/default/bidi.cpp b/platform/default/bidi.cpp index a76c4bcaac..d475c387b3 100644 --- a/platform/default/bidi.cpp +++ b/platform/default/bidi.cpp @@ -30,7 +30,7 @@ std::u16string applyArabicShaping(const std::u16string& input) { UErrorCode errorCode = U_ZERO_ERROR; const int32_t outputLength = - u_shapeArabic(mbgl::utf16char_cast(input.c_str()), static_cast(input.size()), NULL, 0, + u_shapeArabic(mbgl::utf16char_cast(input.c_str()), static_cast(input.size()), nullptr, 0, (U_SHAPE_LETTERS_SHAPE & U_SHAPE_LETTERS_MASK) | (U_SHAPE_TEXT_DIRECTION_LOGICAL & U_SHAPE_TEXT_DIRECTION_MASK), &errorCode); @@ -57,7 +57,7 @@ void BiDi::mergeParagraphLineBreaks(std::set& lineBreakPoints) { for (int32_t i = 0; i < paragraphCount; i++) { UErrorCode errorCode = U_ZERO_ERROR; int32_t paragraphEndIndex; - ubidi_getParagraphByIndex(impl->bidiText, i, NULL, ¶graphEndIndex, NULL, &errorCode); + ubidi_getParagraphByIndex(impl->bidiText, i, nullptr, ¶graphEndIndex, nullptr, &errorCode); if (U_FAILURE(errorCode)) { throw std::runtime_error(std::string("ProcessedBiDiText::mergeParagraphLineBreaks: ") + @@ -92,7 +92,7 @@ std::vector BiDi::processText(const std::u16string& input, UErrorCode errorCode = U_ZERO_ERROR; ubidi_setPara(impl->bidiText, mbgl::utf16char_cast(input.c_str()), static_cast(input.size()), - UBIDI_DEFAULT_LTR, NULL, &errorCode); + UBIDI_DEFAULT_LTR, nullptr, &errorCode); if (U_FAILURE(errorCode)) { throw std::runtime_error(std::string("BiDi::processText: ") + u_errorName(errorCode)); diff --git a/platform/glfw/main.cpp b/platform/glfw/main.cpp index 83cafe50b9..e95a15a55b 100644 --- a/platform/glfw/main.cpp +++ b/platform/glfw/main.cpp @@ -39,15 +39,15 @@ int main(int argc, char *argv[]) { bool skipConfig = false; const struct option long_options[] = { - {"fullscreen", no_argument, 0, 'f'}, - {"benchmark", no_argument, 0, 'b'}, - {"style", required_argument, 0, 's'}, - {"lon", required_argument, 0, 'x'}, - {"lat", required_argument, 0, 'y'}, - {"zoom", required_argument, 0, 'z'}, - {"bearing", required_argument, 0, 'r'}, - {"pitch", required_argument, 0, 'p'}, - {0, 0, 0, 0} + {"fullscreen", no_argument, nullptr, 'f'}, + {"benchmark", no_argument, nullptr, 'b'}, + {"style", required_argument, nullptr, 's'}, + {"lon", required_argument, nullptr, 'x'}, + {"lat", required_argument, nullptr, 'y'}, + {"zoom", required_argument, nullptr, 'z'}, + {"bearing", required_argument, nullptr, 'r'}, + {"pitch", required_argument, nullptr, 'p'}, + {nullptr, 0, nullptr, 0} }; while (true) { @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) { switch (opt) { case 0: - if (long_options[option_index].flag != 0) + if (long_options[option_index].flag != nullptr) break; case 'f': fullscreen = true; @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) { sigIntHandler.sa_handler = quit_handler; sigemptyset(&sigIntHandler.sa_mask); sigIntHandler.sa_flags = 0; - sigaction(SIGINT, &sigIntHandler, NULL); + sigaction(SIGINT, &sigIntHandler, nullptr); if (benchmark) { mbgl::Log::Info(mbgl::Event::General, "BENCHMARK MODE: Some optimizations are disabled."); diff --git a/test/src/mbgl/test/getrss.cpp b/test/src/mbgl/test/getrss.cpp index 9f57ad8e7b..c21b653eaa 100644 --- a/test/src/mbgl/test/getrss.cpp +++ b/test/src/mbgl/test/getrss.cpp @@ -80,8 +80,8 @@ size_t getCurrentRSS( ) #elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__) /* Linux ---------------------------------------------------- */ long rss = 0L; - FILE* fp = NULL; - if ( (fp = fopen( "/proc/self/statm", "r" )) == NULL ) + FILE* fp = nullptr; + if ( (fp = fopen( "/proc/self/statm", "r" )) == nullptr ) return (size_t)0L; /* Can't open? */ if ( fscanf( fp, "%*s%ld", &rss ) != 1 ) { -- cgit v1.2.1