diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-24 01:13:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-24 01:13:26 +0300 |
commit | 1498a699f89f7b5aebdc4629c645c3702ee04f92 (patch) | |
tree | 24d74cc7efc31ba2447c76ad301e3192e38b4cf4 /src | |
parent | c551f8981eba838d07245d1597e9deaa00427cee (diff) | |
download | manaverse-1498a699f89f7b5aebdc4629c645c3702ee04f92.tar.gz manaverse-1498a699f89f7b5aebdc4629c645c3702ee04f92.tar.bz2 manaverse-1498a699f89f7b5aebdc4629c645c3702ee04f92.tar.xz manaverse-1498a699f89f7b5aebdc4629c645c3702ee04f92.zip |
Add A_NONNULL attribute to all parameters with class Graphics.
Diffstat (limited to 'src')
67 files changed, 198 insertions, 156 deletions
diff --git a/src/animatedsprite.h b/src/animatedsprite.h index d2a43fff4..5e0f58c76 100644 --- a/src/animatedsprite.h +++ b/src/animatedsprite.h @@ -68,7 +68,8 @@ class AnimatedSprite final : public Sprite bool update(const int time) override final; void draw(Graphics *const graphics, - const int posX, const int posY) const override final; + const int posX, const int posY) + const override final A_NONNULL(2); int getWidth() const override final A_WARN_UNUSED; diff --git a/src/being/actor.h b/src/being/actor.h index a36c3560e..f76f7ba09 100644 --- a/src/being/actor.h +++ b/src/being/actor.h @@ -50,7 +50,8 @@ class Actor notfinal * partly with the clipping rectangle support. */ virtual void draw(Graphics *const graphics, - const int offsetX, const int offsetY) const = 0; + const int offsetX, + const int offsetY) const A_NONNULL(2) = 0; /** * Returns the horizontal size of the actors graphical representation diff --git a/src/being/being.h b/src/being/being.h index e957228c2..bf389c324 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -355,8 +355,9 @@ class Being notfinal : public ActorSprite, /** * Draws the emotion picture above the being. */ - void drawEmotion(Graphics *const graphics, const int offsetX, - const int offsetY) const; + void drawEmotion(Graphics *const graphics, + const int offsetX, + const int offsetY) const A_NONNULL(2); BeingTypeId getSubType() const { return mSubType; } @@ -530,10 +531,13 @@ class Being notfinal : public ActorSprite, void setState(const uint8_t state); virtual void drawSprites(Graphics *const graphics, - int posX, int posY) const override final; + int posX, + int posY) const override final A_NONNULL(2); virtual void drawSpritesSDL(Graphics *const graphics, - int posX, int posY) const override final; + int posX, + int posY) const override final + A_NONNULL(2); void drawHpBar(Graphics *const graphics, const int maxHP, @@ -544,7 +548,7 @@ class Being notfinal : public ActorSprite, const int x, const int y, const int width, - const int height) const; + const int height) const A_NONNULL(2); static void load(); @@ -622,10 +626,11 @@ class Being notfinal : public ActorSprite, void talkTo() const; void draw(Graphics *const graphics, - const int offsetX, const int offsetY) const override final; + const int offsetX, + const int offsetY) const override final A_NONNULL(2); void drawSpriteAt(Graphics *const graphics, - const int x, const int y) const; + const int x, const int y) const A_NONNULL(2); void setMoveTime() { mMoveTime = cur_time; } diff --git a/src/being/compoundsprite.h b/src/being/compoundsprite.h index 3e48ffdf7..25dee6b65 100644 --- a/src/being/compoundsprite.h +++ b/src/being/compoundsprite.h @@ -52,7 +52,7 @@ class CompoundSprite notfinal : public Sprite void draw(Graphics *const graphics, const int posX, - const int posY) const override; + const int posY) const override A_NONNULL(2); /** * Gets the width in pixels of the first sprite in the list. diff --git a/src/flooritem.h b/src/flooritem.h index 9e9b95050..33c95c062 100644 --- a/src/flooritem.h +++ b/src/flooritem.h @@ -59,7 +59,8 @@ class FloorItem final : public ActorSprite { return ActorType::FloorItem; } void draw(Graphics *const graphics, - const int offsetX, const int offsetY) const override final; + const int offsetX, const int offsetY) + const override final A_NONNULL(2); /** * Returns the item ID. diff --git a/src/gui/fonts/font.h b/src/gui/fonts/font.h index 3da6d9c7d..0188586b3 100644 --- a/src/gui/fonts/font.h +++ b/src/gui/fonts/font.h @@ -110,7 +110,8 @@ class Font final Color col, const Color &col2, const std::string &text, - const int x, const int y); + const int x, + const int y) A_NONNULL(2); void clear(); diff --git a/src/gui/gui.h b/src/gui/gui.h index 8a2935208..a8b862f63 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -127,7 +127,7 @@ class Gui final */ ~Gui(); - void postInit(Graphics *const graphics); + void postInit(Graphics *const graphics) A_NONNULL(2); /** * Performs logic of the GUI. Overridden to track mouse pointer diff --git a/src/gui/viewport.h b/src/gui/viewport.h index e459afcae..0963bd394 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -74,9 +74,9 @@ class Viewport final : public WindowContainer, /** * Draws the viewport. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * Implements player to keep following mouse. @@ -183,14 +183,15 @@ class Viewport final : public WindowContainer, * Finds a path from the player to the mouse, and draws it. This is for * debug purposes. */ - void drawDebugPath(Graphics *const graphics); + void drawDebugPath(Graphics *const graphics) A_NONNULL(2); /** * Draws the given path. */ void drawPath(Graphics *const graphics, const Path &path, - const Color &color = Color(255, 0, 0)) const; + const Color &color = Color(255, 0, 0)) + const A_NONNULL(2); bool leftMouseAction(); diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h index 7c59f0924..3040b3261 100644 --- a/src/gui/widgets/avatarlistbox.h +++ b/src/gui/widgets/avatarlistbox.h @@ -41,9 +41,9 @@ class AvatarListBox final : public ListBox, /** * Draws the list box. */ - void draw(Graphics *gcnGraphics) override final; + void draw(Graphics *gcnGraphics) override final A_NONNULL(2); - void safeDraw(Graphics *gcnGraphics) override final; + void safeDraw(Graphics *gcnGraphics) override final A_NONNULL(2); void mousePressed(MouseEvent &event) override final; diff --git a/src/gui/widgets/basiccontainer2.h b/src/gui/widgets/basiccontainer2.h index 7243e68d3..dc5a65234 100644 --- a/src/gui/widgets/basiccontainer2.h +++ b/src/gui/widgets/basiccontainer2.h @@ -137,9 +137,9 @@ class BasicContainer2: public BasicContainer // Inherited from Widget - void draw(Graphics* graphics) override; + void draw(Graphics* graphics) override A_NONNULL(2); - void safeDraw(Graphics* graphics) override; + void safeDraw(Graphics* graphics) override A_NONNULL(2); protected: /** diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 012c04dd7..a3e7ad7f2 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -122,9 +122,9 @@ class BrowserBox final : public Widget, /** * Draws the browser box. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); void updateHeight(); diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index 233906d06..a4222c395 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -151,9 +151,9 @@ class Button final : public Widget, /** * Draws the button. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * Update the alpha value to the button components. diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h index 2f2fe812d..23b75ddae 100644 --- a/src/gui/widgets/checkbox.h +++ b/src/gui/widgets/checkbox.h @@ -109,9 +109,9 @@ class CheckBox final : public Widget, /** * Draws the caption, then calls drawBox to draw the check box. */ - void draw(Graphics *const graphics) override final; + void draw(Graphics *const graphics) override final A_NONNULL(2); - void safeDraw(Graphics *const graphics) override final; + void safeDraw(Graphics *const graphics) override final A_NONNULL(2); /** * Update the alpha value to the checkbox components. @@ -121,7 +121,7 @@ class CheckBox final : public Widget, /** * Draws the check box, not the caption. */ - void drawBox(Graphics *const graphics); + void drawBox(Graphics *const graphics) A_NONNULL(2); /** * Called when the mouse enteres the widget area. diff --git a/src/gui/widgets/colorpage.h b/src/gui/widgets/colorpage.h index 4863aaa60..7049ef2bc 100644 --- a/src/gui/widgets/colorpage.h +++ b/src/gui/widgets/colorpage.h @@ -36,9 +36,9 @@ class ColorPage final : public ListBox ~ColorPage(); - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); void resetAction(); diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h index 21da974cd..ec75c588d 100644 --- a/src/gui/widgets/desktop.h +++ b/src/gui/widgets/desktop.h @@ -65,9 +65,9 @@ class Desktop final : public Container, void widgetResized(const Event &event) override final; - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); void postInit() override final; diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index aea2752d0..df8e93d49 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -79,13 +79,13 @@ class DropDown final : public ActionListener, */ void updateAlpha(); - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); - void drawFrame(Graphics *graphics) override final; + void drawFrame(Graphics *graphics) override final A_NONNULL(2); - void safeDrawFrame(Graphics *graphics) override final; + void safeDrawFrame(Graphics *graphics) override final A_NONNULL(2); // Inherited from KeyListener diff --git a/src/gui/widgets/emotepage.h b/src/gui/widgets/emotepage.h index 24d166750..74829c13e 100644 --- a/src/gui/widgets/emotepage.h +++ b/src/gui/widgets/emotepage.h @@ -39,9 +39,9 @@ class EmotePage final : public Widget, ~EmotePage(); - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); void mousePressed(MouseEvent &event) override final; diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index c1ba76b2b..9dba54e5f 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -49,9 +49,9 @@ class EmoteShortcutContainer final : public ShortcutContainer /** * Draws the items. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * Handles mouse when dragged. diff --git a/src/gui/widgets/extendedlistbox.h b/src/gui/widgets/extendedlistbox.h index aca0ba8a8..3f2e30af4 100644 --- a/src/gui/widgets/extendedlistbox.h +++ b/src/gui/widgets/extendedlistbox.h @@ -42,9 +42,9 @@ class ExtendedListBox final : public ListBox /** * Draws the list box. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); void adjustSize() override; diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index af94c4ec9..ff9342661 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -110,9 +110,9 @@ class GuiTable final : public Widget, { mLinewiseMode = linewise; } // Inherited from Widget - void draw(Graphics* graphics) override final; + void draw(Graphics* graphics) override final A_NONNULL(2); - void safeDraw(Graphics* graphics) override final; + void safeDraw(Graphics* graphics) override final A_NONNULL(2); Widget *getWidgetAt(int x, int y) override final A_WARN_UNUSED; diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index 8b30e5f8b..243104ead 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -74,9 +74,9 @@ class ItemContainer final : public Widget, /** * Draws the items. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); // KeyListener void keyPressed(KeyEvent &event) override final; diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h index a211941c2..424db2ac3 100644 --- a/src/gui/widgets/itemshortcutcontainer.h +++ b/src/gui/widgets/itemshortcutcontainer.h @@ -49,9 +49,9 @@ class ItemShortcutContainer final : public ShortcutContainer /** * Draws the items. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * Handles mouse when dragged. diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h index bbe49a1e0..fd7e144e0 100644 --- a/src/gui/widgets/label.h +++ b/src/gui/widgets/label.h @@ -108,9 +108,9 @@ class Label final : public Widget, /** * Draws the label. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); void adjustSize(); diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 9dff11e09..382f56dfe 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -108,9 +108,9 @@ class ListBox notfinal : public Widget, /** * Draws the list box. */ - void draw(Graphics *graphics) override; + void draw(Graphics *graphics) override A_NONNULL(2); - void safeDraw(Graphics *graphics) override; + void safeDraw(Graphics *graphics) override A_NONNULL(2); /** * Update the alpha value to the graphic components. diff --git a/src/gui/widgets/passwordfield.h b/src/gui/widgets/passwordfield.h index 0efce0dcf..6b3da5e50 100644 --- a/src/gui/widgets/passwordfield.h +++ b/src/gui/widgets/passwordfield.h @@ -44,9 +44,9 @@ class PasswordField final : public TextField /** * Draws the password field. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); protected: unsigned char mPasswordChar; diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h index b331b7a1b..ee15f32ba 100644 --- a/src/gui/widgets/playerbox.h +++ b/src/gui/widgets/playerbox.h @@ -76,9 +76,9 @@ class PlayerBox final : public Widget, /** * Draws the scroll area. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * Draws the background and border of the scroll area. diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index a784990ec..9f043114e 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -76,9 +76,9 @@ class Popup notfinal : public Container, /** * Draws the popup. */ - void draw(Graphics *graphics) override; + void draw(Graphics *graphics) override A_NONNULL(2); - void safeDraw(Graphics *graphics) override; + void safeDraw(Graphics *graphics) override A_NONNULL(2); /** * Sets the size of this popup. diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index 89ee13e85..4b45f1aab 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -71,9 +71,9 @@ class ProgressBar final : public Widget, /** * Draws the progress bar. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * Sets the current progress. diff --git a/src/gui/widgets/progressindicator.h b/src/gui/widgets/progressindicator.h index cc278e8a2..6957b6993 100644 --- a/src/gui/widgets/progressindicator.h +++ b/src/gui/widgets/progressindicator.h @@ -43,9 +43,9 @@ class ProgressIndicator final : public Widget void logic() override final; - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); private: SimpleAnimation *mIndicator; diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h index f1e4748e1..50b000f31 100644 --- a/src/gui/widgets/radiobutton.h +++ b/src/gui/widgets/radiobutton.h @@ -112,9 +112,9 @@ class RadioButton final : public Widget, * Implementation of the draw methods. * Thus, avoiding the rhomb around the radio button. */ - void draw(Graphics* graphics) override final; + void draw(Graphics* graphics) override final A_NONNULL(2); - void safeDraw(Graphics* graphics) override final; + void safeDraw(Graphics* graphics) override final A_NONNULL(2); /** * Called when the mouse enteres the widget area. diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index deb24ff79..5d9b2e70b 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -137,9 +137,9 @@ class ScrollArea final : public BasicContainer, /** * Draws the scroll area. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * Draws the background and border of the scroll area. @@ -449,21 +449,23 @@ class ScrollArea final : public BasicContainer, */ void checkPolicies(); - void drawButton(Graphics *const graphics, const BUTTON_DIR dir); - void calcButton(Graphics *const graphics, const BUTTON_DIR dir); - void drawVBar(Graphics *const graphics) const; - void drawHBar(Graphics *const graphics) const; - void drawVMarker(Graphics *const graphics); - void drawHMarker(Graphics *const graphics); + void drawButton(Graphics *const graphics, + const BUTTON_DIR dir) A_NONNULL(2); + void calcButton(Graphics *const graphics, + const BUTTON_DIR dir) A_NONNULL(2); + void drawVBar(Graphics *const graphics) const A_NONNULL(2); + void drawHBar(Graphics *const graphics) const A_NONNULL(2); + void drawVMarker(Graphics *const graphics) A_NONNULL(2); + void drawHMarker(Graphics *const graphics) A_NONNULL(2); - void calcVBar(const Graphics *const graphics); - void calcHBar(const Graphics *const graphics); - void calcVMarker(Graphics *const graphics); - void calcHMarker(Graphics *const graphics); + void calcVBar(const Graphics *const graphics) A_NONNULL(2); + void calcHBar(const Graphics *const graphics) A_NONNULL(2); + void calcVMarker(Graphics *const graphics) A_NONNULL(2); + void calcHMarker(Graphics *const graphics) A_NONNULL(2); Image *getImageByState(Rect &dim, const BUTTON_DIR dir); - void updateCalcFlag(Graphics *const graphics); + void updateCalcFlag(Graphics *const graphics) A_NONNULL(2); static int instances; static float mAlpha; diff --git a/src/gui/widgets/serverslistbox.h b/src/gui/widgets/serverslistbox.h index 5586cf1d1..e15bebb41 100644 --- a/src/gui/widgets/serverslistbox.h +++ b/src/gui/widgets/serverslistbox.h @@ -43,7 +43,7 @@ class ServersListBox final : public ListBox mHighlightColor = getThemeColor(ThemeColorId::HIGHLIGHT); } - void draw(Graphics *graphics) override final + void draw(Graphics *graphics) override final A_NONNULL(2) { if (!mListModel) return; diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index ff7835dd0..d0c230f9d 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -55,9 +55,9 @@ class ShopListBox final : public ListBox /** * Draws the list box. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * gives information about the current player's money diff --git a/src/gui/widgets/skilllistbox.h b/src/gui/widgets/skilllistbox.h index 4eda139a5..a27c57147 100644 --- a/src/gui/widgets/skilllistbox.h +++ b/src/gui/widgets/skilllistbox.h @@ -90,7 +90,7 @@ class SkillListBox final : public ListBox return static_cast<SkillModel*>(mListModel)->getSkillAt(selected); } - void draw(Graphics *graphics) override final + void draw(Graphics *graphics) override final A_NONNULL(2) { if (!mListModel) return; diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h index d31c9e9fc..256c64819 100644 --- a/src/gui/widgets/slider.h +++ b/src/gui/widgets/slider.h @@ -125,9 +125,9 @@ class Slider final : public Widget, /** * Draws the slider. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * Called when the mouse enteres the widget area. diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h index a48ffeb4a..525fd3c92 100644 --- a/src/gui/widgets/sliderlist.h +++ b/src/gui/widgets/sliderlist.h @@ -55,9 +55,9 @@ class SliderList final : public Container, void resize(); - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); void action(const ActionEvent &event) override final; diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index eb2dbec49..21fc0d5b9 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -49,9 +49,9 @@ class SpellShortcutContainer final : public ShortcutContainer /** * Draws the items. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * Handles mouse when dragged. diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 3d123f2ec..40ac05753 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -102,9 +102,9 @@ class TabbedArea final : public ActionListener, /** * Draw the tabbed area. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * Return how many tabs have been created. diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h index 65ebc57b7..ded1e6709 100644 --- a/src/gui/widgets/tabs/tab.h +++ b/src/gui/widgets/tabs/tab.h @@ -109,9 +109,9 @@ class Tab notfinal : public BasicContainer, /** * Draw the tabbed area. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * Set the normal color for the tab's text. diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h index 611efd4a0..6fe3aefd9 100644 --- a/src/gui/widgets/textbox.h +++ b/src/gui/widgets/textbox.h @@ -107,9 +107,9 @@ class TextBox final : public Widget, void keyPressed(KeyEvent& event) override final; - void draw(Graphics* graphics) override final; + void draw(Graphics* graphics) override final A_NONNULL(2); - void safeDraw(Graphics* graphics) override final; + void safeDraw(Graphics* graphics) override final A_NONNULL(2); void setForegroundColor(const Color &color); @@ -287,7 +287,9 @@ class TextBox final : public Widget, * @param x the x position. * @param y the y position. */ - void drawCaret(Graphics *const graphics, const int x, const int y); + void drawCaret(Graphics *const graphics, + const int x, + const int y) A_NONNULL(2); /** * Adjusts the text box's size to fit the text. diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index 0c5335143..75c3d9253 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -107,9 +107,9 @@ class TextField notfinal : public Widget, /** * Draws the text field. */ - void draw(Graphics *graphics) override; + void draw(Graphics *graphics) override A_NONNULL(2); - void safeDraw(Graphics *graphics) override; + void safeDraw(Graphics *graphics) override A_NONNULL(2); /** * Update the alpha value to the graphic components. diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h index 62e3d1cd1..f56eac5bb 100644 --- a/src/gui/widgets/textpreview.h +++ b/src/gui/widgets/textpreview.h @@ -100,9 +100,9 @@ class TextPreview final : public Widget * * @param graphics graphics to draw into */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * Set opacity for this widget (whether or not to show the background diff --git a/src/gui/widgets/virtshortcutcontainer.h b/src/gui/widgets/virtshortcutcontainer.h index 96aea1012..5405c2046 100644 --- a/src/gui/widgets/virtshortcutcontainer.h +++ b/src/gui/widgets/virtshortcutcontainer.h @@ -51,9 +51,9 @@ class VirtShortcutContainer final : public ShortcutContainer /** * Draws the items. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); /** * Handles mouse when dragged. diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h index 416782dc2..c5573b404 100644 --- a/src/gui/widgets/widget.h +++ b/src/gui/widgets/widget.h @@ -121,9 +121,9 @@ class Widget notfinal : public Widget2 * @param graphics aA graphics object to draw with. * @since 0.1.0 */ - virtual void draw(Graphics* graphics) = 0; + virtual void draw(Graphics* graphics) A_NONNULL(2) = 0; - virtual void safeDraw(Graphics* graphics) = 0; + virtual void safeDraw(Graphics* graphics) A_NONNULL(2) = 0; /** * Called when a widget is given a chance to draw a frame around itself. @@ -145,10 +145,10 @@ class Widget notfinal : public Widget2 * @see setFrameSize, getFrameSize * @since 0.8.0 */ - virtual void drawFrame(Graphics* graphics A_UNUSED) + virtual void drawFrame(Graphics* graphics A_UNUSED) A_NONNULL(2) { } - virtual void safeDrawFrame(Graphics* graphics A_UNUSED) + virtual void safeDrawFrame(Graphics* graphics A_UNUSED) A_NONNULL(2) { } /** diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index e062de671..ae1e922c9 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -128,9 +128,9 @@ class Window notfinal : public BasicContainer2, /** * Draws the window. */ - void draw(Graphics *graphics) override; + void draw(Graphics *graphics) override A_NONNULL(2); - void safeDraw(Graphics *graphics) override; + void safeDraw(Graphics *graphics) override A_NONNULL(2); /** * Sets the size of this window. diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h index 59fd54af1..6188777d2 100644 --- a/src/gui/widgets/windowcontainer.h +++ b/src/gui/widgets/windowcontainer.h @@ -55,7 +55,7 @@ class WindowContainer notfinal : public Container Widget *const widget); #ifdef USE_PROFILER - void draw(Graphics* graphics) override; + void draw(Graphics* graphics) override A_NONNULL(2); #endif private: diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index c5b5aea1a..ea71e4716 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -280,9 +280,9 @@ class ChatWindow final : public Window, void mouseExited(MouseEvent& event A_UNUSED) override final; - void draw(Graphics* graphics) override final; + void draw(Graphics* graphics) override final A_NONNULL(2); - void safeDraw(Graphics* graphics) override final; + void safeDraw(Graphics* graphics) override final A_NONNULL(2); void updateVisibility(); diff --git a/src/gui/windows/connectiondialog.h b/src/gui/windows/connectiondialog.h index 6fdeeff00..b7318d79f 100644 --- a/src/gui/windows/connectiondialog.h +++ b/src/gui/windows/connectiondialog.h @@ -58,9 +58,9 @@ class ConnectionDialog final : public Window, */ void action(const ActionEvent &) override final; - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); private: State mCancelState; diff --git a/src/gui/windows/debugwindow.h b/src/gui/windows/debugwindow.h index 5496852f6..0ccbae3a1 100644 --- a/src/gui/windows/debugwindow.h +++ b/src/gui/windows/debugwindow.h @@ -54,9 +54,9 @@ class DebugWindow final : public Window */ void slowLogic(); - void draw(Graphics *g) override final; + void draw(Graphics *g) override final A_NONNULL(2); - void safeDraw(Graphics *g) override final; + void safeDraw(Graphics *g) override final A_NONNULL(2); void setPing(int pingTime); diff --git a/src/gui/windows/equipmentwindow.h b/src/gui/windows/equipmentwindow.h index 6ad9b2fd2..640aa2564 100644 --- a/src/gui/windows/equipmentwindow.h +++ b/src/gui/windows/equipmentwindow.h @@ -70,9 +70,9 @@ class EquipmentWindow final : public Window, /** * Draws the equipment window. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); void action(const ActionEvent &event) override final; diff --git a/src/gui/windows/minimap.h b/src/gui/windows/minimap.h index 8c7150080..bd9126bba 100644 --- a/src/gui/windows/minimap.h +++ b/src/gui/windows/minimap.h @@ -59,11 +59,11 @@ class Minimap final : public Window, public ConfigListener /** * Draws the minimap. */ - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); - void draw2(Graphics *const graphics); + void draw2(Graphics *const graphics) A_NONNULL(2); void mouseMoved(MouseEvent &event) override final; diff --git a/src/gui/windows/ministatuswindow.h b/src/gui/windows/ministatuswindow.h index 0146b3f00..c1a93d6d9 100644 --- a/src/gui/windows/ministatuswindow.h +++ b/src/gui/windows/ministatuswindow.h @@ -69,9 +69,9 @@ class MiniStatusWindow final : public Window, void logic() override final; - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); void mouseMoved(MouseEvent &event) override final; diff --git a/src/gui/windows/outfitwindow.h b/src/gui/windows/outfitwindow.h index b27bd7d4a..7033a3f13 100644 --- a/src/gui/windows/outfitwindow.h +++ b/src/gui/windows/outfitwindow.h @@ -52,9 +52,9 @@ class OutfitWindow final : public Window, void action(const ActionEvent &event) override final; - void draw(Graphics *graphics) override final; + void draw(Graphics *graphics) override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final A_NONNULL(2); void mousePressed(MouseEvent &event) override final; diff --git a/src/imagesprite.h b/src/imagesprite.h index b5623a12a..528b8c6ac 100644 --- a/src/imagesprite.h +++ b/src/imagesprite.h @@ -47,7 +47,8 @@ class ImageSprite final : public Sprite { return false; } void draw(Graphics *const graphics, - const int posX, const int posY) const override final; + const int posX, const int posY) + const override final A_NONNULL(2); int getWidth() const override final A_WARN_UNUSED { return mImage ? mImage->getWidth() : 0; } diff --git a/src/localconsts.h b/src/localconsts.h index 1566292f5..dcd0613b2 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -70,6 +70,7 @@ #define A_WARN_UNUSED __attribute__ ((warn_unused_result)) #define DEPRECATED __attribute__ ((deprecated)) #define restrict __restrict__ +#define A_NONNULL(...) __attribute__((nonnull (__VA_ARGS__))) #else #define A_UNUSED #define A_WARN_UNUSED diff --git a/src/particle/imageparticle.h b/src/particle/imageparticle.h index ecae08c37..b6b74362b 100644 --- a/src/particle/imageparticle.h +++ b/src/particle/imageparticle.h @@ -55,7 +55,7 @@ class ImageParticle notfinal : public Particle */ virtual void draw(Graphics *const graphics, const int offsetX, - const int offsetY) const override final; + const int offsetY) const override final A_NONNULL(2); void setAlpha(const float alpha) override final { mAlpha = alpha; } diff --git a/src/particle/particle.h b/src/particle/particle.h index ad141ffc7..7f3a743bf 100644 --- a/src/particle/particle.h +++ b/src/particle/particle.h @@ -95,7 +95,7 @@ class Particle notfinal : public Actor */ virtual void draw(Graphics *const graphics, const int offsetX, - const int offsetY) const override; + const int offsetY) const override A_NONNULL(2); /** * Necessary for sorting with the other sprites. diff --git a/src/particle/textparticle.h b/src/particle/textparticle.h index 1553c6ef3..6858ee6a1 100644 --- a/src/particle/textparticle.h +++ b/src/particle/textparticle.h @@ -41,7 +41,8 @@ class TextParticle final : public Particle * Draws the particle image. */ void draw(Graphics *const graphics, - const int offsetX, const int offsetY) const override final; + const int offsetX, + const int offsetY) const override final A_NONNULL(2); // hack to improve text visibility int getPixelY() const override final A_WARN_UNUSED diff --git a/src/resources/ambientlayer.h b/src/resources/ambientlayer.h index 906363a6f..06f60bdbe 100644 --- a/src/resources/ambientlayer.h +++ b/src/resources/ambientlayer.h @@ -57,9 +57,13 @@ class AmbientLayer final ~AmbientLayer(); - void update(const int timePassed, const float dx, const float dy); + void update(const int timePassed, + const float dx, + const float dy); - void draw(Graphics *const graphics, const int x, const int y) const; + void draw(Graphics *const graphics, + const int x, + const int y) const A_NONNULL(2); private: Image *mImage; diff --git a/src/resources/map/map.h b/src/resources/map/map.h index 28bf9c4b2..4553f5aa8 100644 --- a/src/resources/map/map.h +++ b/src/resources/map/map.h @@ -109,14 +109,17 @@ class Map final : public Properties, public ConfigListener * the clipping rectangle set on the Graphics object. However, * currently the map is always drawn full-screen. */ - void draw(Graphics *const graphics, int scrollX, int scrollY); + void draw(Graphics *const graphics, + int scrollX, + int scrollY) A_NONNULL(2); /** * Visualizes collision layer for debugging */ void drawCollision(Graphics *const graphics, - const int scrollX, const int scrollY, - const MapTypeT drawFlags) const; + const int scrollX, + const int scrollY, + const MapTypeT drawFlags) const A_NONNULL(2); /** * Adds a layer to this map. The map takes ownership of the layer. @@ -357,8 +360,9 @@ class Map final : public Properties, public ConfigListener /** * Draws the foreground or background layers to the given graphics output. */ - void drawAmbientLayers(Graphics *const graphics, const LayerType type, - const int detail) const; + void drawAmbientLayers(Graphics *const graphics, + const LayerType type, + const int detail) const A_NONNULL(2); /** * Tells whether the given coordinates fall within the map boundaries. diff --git a/src/resources/map/mapitem.h b/src/resources/map/mapitem.h index e9203e564..4fd84320f 100644 --- a/src/resources/map/mapitem.h +++ b/src/resources/map/mapitem.h @@ -71,8 +71,9 @@ class MapItem final void setName(const std::string &name) { mName = name; } - void draw(Graphics *const graphics, const int x, const int y, - const int dx, const int dy) const; + void draw(Graphics *const graphics, + const int x, const int y, + const int dx, const int dy) const A_NONNULL(2); private: Image *mImage; diff --git a/src/resources/map/maplayer.h b/src/resources/map/maplayer.h index 4cf30ade1..6588e0303 100644 --- a/src/resources/map/maplayer.h +++ b/src/resources/map/maplayer.h @@ -87,30 +87,43 @@ class MapLayer final: public ConfigListener * layer. */ void draw(Graphics *const graphics, - int startX, int startY, int endX, int endY, - const int scrollX, const int scrollY) const; + int startX, + int startY, + int endX, + int endY, + const int scrollX, + const int scrollY) const A_NONNULL(2); - void drawSDL(Graphics *const graphics) const; + void drawSDL(Graphics *const graphics) const A_NONNULL(2); #ifdef USE_OPENGL - void drawOGL(Graphics *const graphics) const; + void drawOGL(Graphics *const graphics) const A_NONNULL(2); void updateOGL(Graphics *const graphics, - int startX, int startY, - int endX, int endY, - const int scrollX, const int scrollY); + int startX, + int startY, + int endX, + int endY, + const int scrollX, + const int scrollY) A_NONNULL(2); #endif void updateSDL(const Graphics *const graphics, - int startX, int startY, - int endX, int endY, - const int scrollX, const int scrollY); + int startX, + int startY, + int endX, + int endY, + const int scrollX, + const int scrollY) A_NONNULL(2); void drawFringe(Graphics *const graphics, - int startX, int startY, - int endX, int endY, - const int scrollX, const int scrollY, - const Actors *const actors) const; + int startX, + int startY, + int endX, + int endY, + const int scrollX, + const int scrollY, + const Actors *const actors) const A_NONNULL(2); bool isFringeLayer() const A_WARN_UNUSED { return mIsFringeLayer; } diff --git a/src/resources/map/speciallayer.h b/src/resources/map/speciallayer.h index 518f23bcf..13a75a9d5 100644 --- a/src/resources/map/speciallayer.h +++ b/src/resources/map/speciallayer.h @@ -40,9 +40,10 @@ class SpecialLayer final ~SpecialLayer(); - void draw(Graphics *const graphics, int startX, int startY, + void draw(Graphics *const graphics, + int startX, int startY, int endX, int endY, - const int scrollX, const int scrollY) const; + const int scrollX, const int scrollY) const A_NONNULL(2); MapItem* getTile(const int x, const int y) const A_WARN_UNUSED; diff --git a/src/simpleanimation.h b/src/simpleanimation.h index 2c290bb10..4e588e78b 100644 --- a/src/simpleanimation.h +++ b/src/simpleanimation.h @@ -64,7 +64,7 @@ class SimpleAnimation final bool update(const int timePassed); void draw(Graphics *const graphics, - const int posX, const int posY) const; + const int posX, const int posY) const A_NONNULL(2); /** * Resets the animation. diff --git a/src/sprite.h b/src/sprite.h index 568663590..1062615c9 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -62,7 +62,8 @@ class Sprite notfinal * pixels. */ virtual void draw(Graphics *const graphics, - const int posX, const int posY) const = 0; + const int posX, const int posY) + const A_NONNULL(2) = 0; /** * Gets the width in pixels of the image of the current frame diff --git a/src/text.h b/src/text.h index fc9b0f08c..ae53a5984 100644 --- a/src/text.h +++ b/src/text.h @@ -74,7 +74,7 @@ class Text notfinal * Draws the text. */ virtual void draw(Graphics *const graphics, - const int xOff, const int yOff); + const int xOff, const int yOff) A_NONNULL(2); private: Font *mFont; /**< The font of the text */ @@ -121,7 +121,7 @@ class FlashText final : public Text * Draws the text. */ void draw(Graphics *const graphics, - const int xOff, const int yOff) override final; + const int xOff, const int yOff) override final A_NONNULL(2); private: int mTime; /**< Time left for flashing */ diff --git a/src/textmanager.h b/src/textmanager.h index 299c384c7..cebd4cec6 100644 --- a/src/textmanager.h +++ b/src/textmanager.h @@ -63,7 +63,8 @@ class TextManager final * Draw the text */ void draw(Graphics *const graphics, - const int xOff, const int yOff); + const int xOff, + const int yOff) A_NONNULL(2); private: /** |