Skip to content

Commit

Permalink
Fix compiler warnings [-Wzero-as-null-pointer-constant]
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Jul 4, 2018
1 parent d1e0a4b commit bdf09f4
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/ccmain/paragraphs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/ccstruct/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
class BLOB_CHOICE_LIST;
class UNICHARSET;

#define NOT_CLASSIFIED static_cast<BLOB_CHOICE_LIST*>(0)
#define NOT_CLASSIFIED static_cast<BLOB_CHOICE_LIST*>(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
Expand Down
6 changes: 3 additions & 3 deletions src/ccutil/genericvector.h
Original file line number Diff line number Diff line change
Expand Up @@ -657,9 +657,9 @@ template <typename T>
void GenericVector<T>::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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/ccutil/unicity_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class UnicityTableEqEq : public UnicityTable<T> {

template <typename T>
UnicityTable<T>::UnicityTable() :
compare_cb_(0) {
compare_cb_(nullptr) {
}


Expand Down
4 changes: 3 additions & 1 deletion src/cutil/oldlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/textord/fpchop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -703,20 +703,20 @@ 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 ();
delete top;
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;
Expand Down
2 changes: 1 addition & 1 deletion src/training/pango_font_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ const std::vector<std::string>& 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) {
Expand Down
8 changes: 4 additions & 4 deletions src/viewer/scrollview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void* ScrollView::MessageReceiver(void* a) {
cur->type);
std::pair<ScrollView*, SVEventType> awaiting_list_any(cur->window,
SVET_ANY);
std::pair<ScrollView*, SVEventType> awaiting_list_any_window((ScrollView*)0,
std::pair<ScrollView*, SVEventType> awaiting_list_any_window((ScrollView*)nullptr,
SVET_ANY);
waiting_for_events_mu->Lock();
if (waiting_for_events.count(awaiting_list) > 0) {
Expand Down Expand Up @@ -444,7 +444,7 @@ SVEvent* ScrollView::AwaitEvent(SVEventType type) {
SVSemaphore* sem = new SVSemaphore();
std::pair<ScrollView*, SVEventType> ea(this, type);
waiting_for_events_mu->Lock();
waiting_for_events[ea] = std::pair<SVSemaphore*, SVEvent*> (sem, (SVEvent*)0);
waiting_for_events[ea] = std::pair<SVSemaphore*, SVEvent*> (sem, (SVEvent*)nullptr);
waiting_for_events_mu->Unlock();
// Wait on it, but first flush.
stream_->Flush();
Expand All @@ -463,9 +463,9 @@ SVEvent* ScrollView::AwaitEvent(SVEventType type) {
SVEvent* ScrollView::AwaitEventAnyWindow() {
// Initialize the waiting semaphore.
SVSemaphore* sem = new SVSemaphore();
std::pair<ScrollView*, SVEventType> ea((ScrollView*)0, SVET_ANY);
std::pair<ScrollView*, SVEventType> ea((ScrollView*)nullptr, SVET_ANY);
waiting_for_events_mu->Lock();
waiting_for_events[ea] = std::pair<SVSemaphore*, SVEvent*> (sem, (SVEvent*)0);
waiting_for_events[ea] = std::pair<SVSemaphore*, SVEvent*> (sem, (SVEvent*)nullptr);
waiting_for_events_mu->Unlock();
// Wait on it.
stream_->Flush();
Expand Down

0 comments on commit bdf09f4

Please sign in to comment.