diff --git a/src/ccmain/paragraphs.cpp b/src/ccmain/paragraphs.cpp index a204c6c8cd..43d3f9a3e8 100644 --- a/src/ccmain/paragraphs.cpp +++ b/src/ccmain/paragraphs.cpp @@ -324,7 +324,7 @@ int UnicodeSpanSkipper::SkipRomans(int pos) { const char *kRomans = "ivxlmdIVXLMD"; while (pos < wordlen_) { int ch = UnicodeFor(u_, word_, pos); - if (ch >= 0xF0 || strchr(kRomans, ch) == 0) break; + if (ch >= 0xF0 || strchr(kRomans, ch) == nullptr) break; pos++; } return pos; diff --git a/src/ccstruct/matrix.h b/src/ccstruct/matrix.h index 209589d67a..9efde3c300 100644 --- a/src/ccstruct/matrix.h +++ b/src/ccstruct/matrix.h @@ -44,7 +44,7 @@ class BLOB_CHOICE_LIST; class UNICHARSET; -#define NOT_CLASSIFIED static_cast(0) +#define NOT_CLASSIFIED static_cast(nullptr) // A generic class to hold a 2-D matrix with entries of type T, but can also // act as a base class for other implementations, such as a triangular or diff --git a/src/ccutil/genericvector.h b/src/ccutil/genericvector.h index d15add451a..64c5c9e481 100644 --- a/src/ccutil/genericvector.h +++ b/src/ccutil/genericvector.h @@ -657,9 +657,9 @@ template void GenericVector::init(int size) { size_used_ = 0; size_reserved_ = 0; - data_ = 0; - clear_cb_ = 0; - compare_cb_ = 0; + data_ = nullptr; + clear_cb_ = nullptr; + compare_cb_ = nullptr; reserve(size); } diff --git a/src/ccutil/unicity_table.h b/src/ccutil/unicity_table.h index 0c0c5d11e0..3aef73fcf0 100644 --- a/src/ccutil/unicity_table.h +++ b/src/ccutil/unicity_table.h @@ -106,7 +106,7 @@ class UnicityTableEqEq : public UnicityTable { template UnicityTable::UnicityTable() : - compare_cb_(0) { + compare_cb_(nullptr) { } diff --git a/src/cutil/oldlist.h b/src/cutil/oldlist.h index e57f7c0fc4..13f188445b 100644 --- a/src/cutil/oldlist.h +++ b/src/cutil/oldlist.h @@ -123,7 +123,9 @@ /*---------------------------------------------------------------------- T y p e s ----------------------------------------------------------------------*/ -#define NIL_LIST (LIST) 0 + +#define NIL_LIST ((LIST)nullptr) + struct list_rec { struct list_rec *node; diff --git a/src/textord/fpchop.cpp b/src/textord/fpchop.cpp index ac9c7c2544..eeb664bcc2 100644 --- a/src/textord/fpchop.cpp +++ b/src/textord/fpchop.cpp @@ -656,8 +656,8 @@ void close_chopped_cfragments( //chop the outline bottom_frag = frag_it.extract(); frag_it.forward(); top_frag = frag_it.data(); // look at next - if ((bottom_frag->steps == 0 && top_frag->steps == 0) - || (bottom_frag->steps != 0 && top_frag->steps != 0)) { + if ((bottom_frag->steps == nullptr && top_frag->steps == nullptr) + || (bottom_frag->steps != nullptr && top_frag->steps != nullptr)) { if (frag_it.data_relative(1)->ycoord == top_frag->ycoord) frag_it.forward(); } @@ -703,7 +703,7 @@ C_OUTLINE *join_chopped_fragments( //join pieces C_OUTLINE *outline; //closed loop if (bottom->other_end == top) { - if (bottom->steps == 0) + if (bottom->steps == nullptr) outline = top->close (); //turn to outline else outline = bottom->close (); @@ -711,12 +711,12 @@ C_OUTLINE *join_chopped_fragments( //join pieces delete bottom; return outline; } - if (bottom->steps == 0) { - ASSERT_HOST (top->steps != 0); + if (bottom->steps == nullptr) { + ASSERT_HOST (top->steps != nullptr); join_segments (bottom->other_end, top); } else { - ASSERT_HOST (top->steps == 0); + ASSERT_HOST (top->steps == nullptr); join_segments (top->other_end, bottom); } top->other_end->other_end = bottom->other_end; diff --git a/src/training/pango_font_info.cpp b/src/training/pango_font_info.cpp index 20a361a392..7725dcc48a 100644 --- a/src/training/pango_font_info.cpp +++ b/src/training/pango_font_info.cpp @@ -554,7 +554,7 @@ const std::vector& FontUtils::ListAvailableFonts() { } #endif - PangoFontFamily** families = 0; + PangoFontFamily** families = nullptr; int n_families = 0; ListFontFamilies(&families, &n_families); for (int i = 0; i < n_families; ++i) { diff --git a/src/viewer/scrollview.cpp b/src/viewer/scrollview.cpp index 64f0aa8653..b0c0e67346 100644 --- a/src/viewer/scrollview.cpp +++ b/src/viewer/scrollview.cpp @@ -144,7 +144,7 @@ void* ScrollView::MessageReceiver(void* a) { cur->type); std::pair awaiting_list_any(cur->window, SVET_ANY); - std::pair awaiting_list_any_window((ScrollView*)0, + std::pair awaiting_list_any_window((ScrollView*)nullptr, SVET_ANY); waiting_for_events_mu->Lock(); if (waiting_for_events.count(awaiting_list) > 0) { @@ -444,7 +444,7 @@ SVEvent* ScrollView::AwaitEvent(SVEventType type) { SVSemaphore* sem = new SVSemaphore(); std::pair ea(this, type); waiting_for_events_mu->Lock(); - waiting_for_events[ea] = std::pair (sem, (SVEvent*)0); + waiting_for_events[ea] = std::pair (sem, (SVEvent*)nullptr); waiting_for_events_mu->Unlock(); // Wait on it, but first flush. stream_->Flush(); @@ -463,9 +463,9 @@ SVEvent* ScrollView::AwaitEvent(SVEventType type) { SVEvent* ScrollView::AwaitEventAnyWindow() { // Initialize the waiting semaphore. SVSemaphore* sem = new SVSemaphore(); - std::pair ea((ScrollView*)0, SVET_ANY); + std::pair ea((ScrollView*)nullptr, SVET_ANY); waiting_for_events_mu->Lock(); - waiting_for_events[ea] = std::pair (sem, (SVEvent*)0); + waiting_for_events[ea] = std::pair (sem, (SVEvent*)nullptr); waiting_for_events_mu->Unlock(); // Wait on it. stream_->Flush();