[tidy] modernize-use-nullptr

This commit is contained in:
Bruno de Oliveira Abinader
2017-05-11 11:57:57 +03:00
parent 12dba86fac
commit bd7fb64bae
3 changed files with 16 additions and 16 deletions

View File

@@ -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<const UChar*>(input.c_str()), static_cast<int32_t>(input.size()), NULL, 0,
u_shapeArabic(mbgl::utf16char_cast<const UChar*>(input.c_str()), static_cast<int32_t>(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<size_t>& lineBreakPoints) {
for (int32_t i = 0; i < paragraphCount; i++) {
UErrorCode errorCode = U_ZERO_ERROR;
int32_t paragraphEndIndex;
ubidi_getParagraphByIndex(impl->bidiText, i, NULL, &paragraphEndIndex, NULL, &errorCode);
ubidi_getParagraphByIndex(impl->bidiText, i, nullptr, &paragraphEndIndex, nullptr, &errorCode);
if (U_FAILURE(errorCode)) {
throw std::runtime_error(std::string("ProcessedBiDiText::mergeParagraphLineBreaks: ") +
@@ -92,7 +92,7 @@ std::vector<std::u16string> BiDi::processText(const std::u16string& input,
UErrorCode errorCode = U_ZERO_ERROR;
ubidi_setPara(impl->bidiText, mbgl::utf16char_cast<const UChar*>(input.c_str()), static_cast<int32_t>(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));

View File

@@ -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.");

View File

@@ -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 )
{