From 97d7af7a23040ca681657c2e29be48c221d0b671 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 6 Nov 2020 20:16:30 -0600 Subject: [PATCH] Use nullptr --- .../extended/unicode/western_char_set.cpp | 2 +- .../ftdi_eve_lib/extras/poly_ui.h | 4 ++-- Marlin/src/lcd/tft/tft_string.h | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/western_char_set.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/western_char_set.cpp index af0f5cb843..171637f03a 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/western_char_set.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/western_char_set.cpp @@ -435,7 +435,7 @@ base_char = base_special ? NO_DOT_I : std_char; } - // If cmd != NULL, draw the glyph to the screen + // If cmd != nullptr, draw the glyph to the screen if (cmd) { ext_vertex2ii(*cmd, x, y, base_special ? alt_font : std_font, base_char); if (accent_char) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/poly_ui.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/poly_ui.h index a501de20ba..ba41650f2f 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/poly_ui.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/poly_ui.h @@ -90,7 +90,7 @@ class PolyReader { if (start_x != eol) close_loop(); else - p = NULL; + p = nullptr; } else { x = pgm_read_word_far(p++); @@ -106,7 +106,7 @@ class PolyReader { } } - bool has_more() { return p != NULL; } + bool has_more() { return p != nullptr; } bool end_of_loop() { return start_x == eol; } }; diff --git a/Marlin/src/lcd/tft/tft_string.h b/Marlin/src/lcd/tft/tft_string.h index 924d6de430..e800b1ded9 100644 --- a/Marlin/src/lcd/tft/tft_string.h +++ b/Marlin/src/lcd/tft/tft_string.h @@ -80,22 +80,22 @@ class TFT_String { static font_t *font() { return font_header; }; static uint16_t font_height() { return font_header->FontAscent - font_header->FontDescent; } - static glyph_t *glyph(uint8_t character) { return glyphs[character] == NULL ? glyphs[0x3F] : glyphs[character]; } /* Use '?' for unknown glyphs */ + static glyph_t *glyph(uint8_t character) { return glyphs[character] ?: glyphs[0x3F]; } /* Use '?' for unknown glyphs */ static inline glyph_t *glyph(uint8_t *character) { return glyph(*character); } static void set(); static void add(uint8_t character) { add_character(character); eol(); } static void add(uint8_t *string); - static void add(uint8_t *string, int8_t index, uint8_t *itemString = NULL); + static void add(uint8_t *string, int8_t index, uint8_t *itemString=nullptr); static void set(uint8_t *string) { set(); add(string); }; - static void set(uint8_t *string, int8_t index, const char *itemString = NULL) { set(); add(string, index, (uint8_t *)itemString); }; + static void set(uint8_t *string, int8_t index, const char *itemString=nullptr) { set(); add(string, index, (uint8_t *)itemString); }; static inline void set(const char *string) { set((uint8_t *)string); } - static inline void set(const char *string, int8_t index, const char *itemString = NULL) { set((uint8_t *)string, index, itemString); } + static inline void set(const char *string, int8_t index, const char *itemString=nullptr) { set((uint8_t *)string, index, itemString); } static inline void add(const char *string) { add((uint8_t *)string); } - static void trim(uint8_t character = 0x20); - static void rtrim(uint8_t character = 0x20); - static void ltrim(uint8_t character = 0x20); + static void trim(uint8_t character=0x20); + static void rtrim(uint8_t character=0x20); + static void ltrim(uint8_t character=0x20); static uint16_t width() { return span; } static uint8_t *string() { return data; } static uint16_t center(uint16_t width) { return span > width ? 0 : (width - span) / 2; }