From 8cbbdedaf4dfec9e320e7e2be58b75d256950df1 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 20 Jul 2020 12:16:20 +0200 Subject: Refactor: Update integer type usage This updates the usage of integer types in code I wrote according to our new style guides. Major changes: * Use signed instead of unsigned integers in many places. * C++ containers in blenlib use `int64_t` for size and indices now (instead of `uint`). * Hash values for C++ containers are 64 bit wide now (instead of 32 bit). I do hope that I broke no builds, but it is quite likely that some compiler reports slightly different errors. Please let me know when there are any errors. If the fix is small, feel free to commit it yourself. I compiled successfully on linux with gcc and on windows. --- source/blender/nodes/NOD_derived_node_tree.hh | 44 +++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'source/blender/nodes/NOD_derived_node_tree.hh') diff --git a/source/blender/nodes/NOD_derived_node_tree.hh b/source/blender/nodes/NOD_derived_node_tree.hh index 84370dcd399..d79bd9031b8 100644 --- a/source/blender/nodes/NOD_derived_node_tree.hh +++ b/source/blender/nodes/NOD_derived_node_tree.hh @@ -46,15 +46,15 @@ class DSocket : NonCopyable, NonMovable { protected: DNode *node_; const SocketRef *socket_ref_; - uint id_; + int id_; friend DerivedNodeTree; public: const DNode &node() const; - uint id() const; - uint index() const; + int id() const; + int index() const; bool is_input() const; bool is_output() const; @@ -105,7 +105,7 @@ class DGroupInput : NonCopyable, NonMovable { const InputSocketRef *socket_ref_; DParentNode *parent_; Vector linked_sockets_; - uint id_; + int id_; friend DerivedNodeTree; @@ -114,7 +114,7 @@ class DGroupInput : NonCopyable, NonMovable { bNodeSocket *bsocket() const; const DParentNode *parent() const; Span linked_sockets() const; - uint id() const; + int id() const; StringRefNull name() const; }; @@ -126,7 +126,7 @@ class DNode : NonCopyable, NonMovable { Span inputs_; Span outputs_; - uint id_; + int id_; friend DerivedNodeTree; @@ -137,13 +137,13 @@ class DNode : NonCopyable, NonMovable { Span inputs() const; Span outputs() const; - const DInputSocket &input(uint index) const; - const DOutputSocket &output(uint index) const; + const DInputSocket &input(int index) const; + const DOutputSocket &output(int index) const; - const DInputSocket &input(uint index, StringRef expected_name) const; - const DOutputSocket &output(uint index, StringRef expected_name) const; + const DInputSocket &input(int index, StringRef expected_name) const; + const DOutputSocket &output(int index, StringRef expected_name) const; - uint id() const; + int id() const; PointerRNA *rna() const; StringRefNull idname() const; @@ -157,14 +157,14 @@ class DParentNode : NonCopyable, NonMovable { private: const NodeRef *node_ref_; DParentNode *parent_; - uint id_; + int id_; friend DerivedNodeTree; public: const DParentNode *parent() const; const NodeRef &node_ref() const; - uint id() const; + int id() const; }; using NodeTreeRefMap = Map>; @@ -240,12 +240,12 @@ inline const DNode &DSocket::node() const return *node_; } -inline uint DSocket::id() const +inline int DSocket::id() const { return id_; } -inline uint DSocket::index() const +inline int DSocket::index() const { return socket_ref_->index(); } @@ -367,7 +367,7 @@ inline Span DGroupInput::linked_sockets() const return linked_sockets_; } -inline uint DGroupInput::id() const +inline int DGroupInput::id() const { return id_; } @@ -401,17 +401,17 @@ inline Span DNode::outputs() const return outputs_; } -inline const DInputSocket &DNode::input(uint index) const +inline const DInputSocket &DNode::input(int index) const { return *inputs_[index]; } -inline const DOutputSocket &DNode::output(uint index) const +inline const DOutputSocket &DNode::output(int index) const { return *outputs_[index]; } -inline const DInputSocket &DNode::input(uint index, StringRef expected_name) const +inline const DInputSocket &DNode::input(int index, StringRef expected_name) const { const DInputSocket &socket = *inputs_[index]; BLI_assert(socket.name() == expected_name); @@ -419,7 +419,7 @@ inline const DInputSocket &DNode::input(uint index, StringRef expected_name) con return socket; } -inline const DOutputSocket &DNode::output(uint index, StringRef expected_name) const +inline const DOutputSocket &DNode::output(int index, StringRef expected_name) const { const DOutputSocket &socket = *outputs_[index]; BLI_assert(socket.name() == expected_name); @@ -427,7 +427,7 @@ inline const DOutputSocket &DNode::output(uint index, StringRef expected_name) c return socket; } -inline uint DNode::id() const +inline int DNode::id() const { return id_; } @@ -461,7 +461,7 @@ inline const NodeRef &DParentNode::node_ref() const return *node_ref_; } -inline uint DParentNode::id() const +inline int DParentNode::id() const { return id_; } -- cgit v1.2.3