Skip to content

Commit fde64f4

Browse files
committed
cppcheck fixes
1 parent c46e0fb commit fde64f4

5 files changed

Lines changed: 23 additions & 23 deletions

File tree

include/vsg/core/Array.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ namespace vsg
5757
dirty();
5858
}
5959

60-
explicit Array(uint32_t numElements, Properties in_properties = {}) :
60+
explicit Array(uint32_t numElements, const Properties& in_properties = {}) :
6161
Data(in_properties, sizeof(value_type)),
6262
_data(_allocate(numElements)),
6363
_size(numElements) { dirty(); }
6464

65-
Array(uint32_t numElements, value_type* data, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
65+
Array(uint32_t numElements, value_type* data, const Properties& in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
6666
Data(in_properties, sizeof(value_type)),
6767
_data(data),
6868
_size(numElements)
@@ -71,7 +71,7 @@ namespace vsg
7171
dirty();
7272
}
7373

74-
Array(uint32_t numElements, const value_type& value, Properties in_properties = {}) :
74+
Array(uint32_t numElements, const value_type& value, const Properties& in_properties = {}) :
7575
Data(in_properties, sizeof(value_type)),
7676
_data(_allocate(numElements)),
7777
_size(numElements)
@@ -80,7 +80,7 @@ namespace vsg
8080
dirty();
8181
}
8282

83-
Array(ref_ptr<Data> data, uint32_t offset, uint32_t stride, uint32_t numElements, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
83+
Array(ref_ptr<Data> data, uint32_t offset, uint32_t stride, uint32_t numElements, const Properties& in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
8484
Data(),
8585
_data(nullptr),
8686
_size(0)
@@ -247,7 +247,7 @@ namespace vsg
247247
return *this;
248248
}
249249

250-
void assign(uint32_t numElements, value_type* data, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
250+
void assign(uint32_t numElements, value_type* data, const Properties& in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
251251
{
252252
_delete();
253253

@@ -262,7 +262,7 @@ namespace vsg
262262
dirty();
263263
}
264264

265-
void assign(ref_ptr<Data> storage, uint32_t offset, uint32_t stride, uint32_t numElements, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
265+
void assign(ref_ptr<Data> storage, uint32_t offset, uint32_t stride, uint32_t numElements, const Properties& in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
266266
{
267267
_delete();
268268

include/vsg/core/Array2D.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace vsg
5757
}
5858
}
5959

60-
Array2D(uint32_t width, uint32_t height, Properties in_properties = {}) :
60+
Array2D(uint32_t width, uint32_t height, const Properties& in_properties = {}) :
6161
Data(in_properties, sizeof(value_type)),
6262
_data(nullptr),
6363
_width(width),
@@ -67,7 +67,7 @@ namespace vsg
6767
dirty();
6868
}
6969

70-
Array2D(uint32_t width, uint32_t height, value_type* data, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
70+
Array2D(uint32_t width, uint32_t height, value_type* data, const Properties& in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
7171
Data(in_properties, sizeof(value_type)),
7272
_data(data),
7373
_width(width),
@@ -77,7 +77,7 @@ namespace vsg
7777
dirty();
7878
}
7979

80-
Array2D(uint32_t width, uint32_t height, const value_type& value, Properties in_properties = {}) :
80+
Array2D(uint32_t width, uint32_t height, const value_type& value, const Properties& in_properties = {}) :
8181
Data(in_properties, sizeof(value_type)),
8282
_data(nullptr),
8383
_width(width),
@@ -91,7 +91,7 @@ namespace vsg
9191
}
9292
}
9393

94-
Array2D(ref_ptr<Data> data, uint32_t offset, uint32_t stride, uint32_t width, uint32_t height, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
94+
Array2D(ref_ptr<Data> data, uint32_t offset, uint32_t stride, uint32_t width, uint32_t height, const Properties& in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
9595
Data(),
9696
_data(nullptr),
9797
_width(0),
@@ -231,7 +231,7 @@ namespace vsg
231231
return *this;
232232
}
233233

234-
void assign(uint32_t width, uint32_t height, value_type* data, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
234+
void assign(uint32_t width, uint32_t height, value_type* data, const Properties& in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
235235
{
236236
_delete();
237237

@@ -247,7 +247,7 @@ namespace vsg
247247
dirty();
248248
}
249249

250-
void assign(ref_ptr<Data> storage, uint32_t offset, uint32_t stride, uint32_t width, uint32_t height, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
250+
void assign(ref_ptr<Data> storage, uint32_t offset, uint32_t stride, uint32_t width, uint32_t height, const Properties& in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
251251
{
252252
_delete();
253253

include/vsg/core/Array3D.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace vsg
5959
}
6060
}
6161

62-
Array3D(uint32_t width, uint32_t height, uint32_t depth, Properties in_properties = {}) :
62+
Array3D(uint32_t width, uint32_t height, uint32_t depth, const Properties& in_properties = {}) :
6363
Data(in_properties, sizeof(value_type)),
6464
_data(nullptr),
6565
_width(width),
@@ -70,7 +70,7 @@ namespace vsg
7070
dirty();
7171
}
7272

73-
Array3D(uint32_t width, uint32_t height, uint32_t depth, value_type* data, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
73+
Array3D(uint32_t width, uint32_t height, uint32_t depth, value_type* data, const Properties& in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
7474
Data(in_properties, sizeof(value_type)),
7575
_data(data),
7676
_width(width),
@@ -81,7 +81,7 @@ namespace vsg
8181
dirty();
8282
}
8383

84-
Array3D(uint32_t width, uint32_t height, uint32_t depth, const value_type& value, Properties in_properties = {}) :
84+
Array3D(uint32_t width, uint32_t height, uint32_t depth, const value_type& value, const Properties& in_properties = {}) :
8585
Data(in_properties, sizeof(value_type)),
8686
_data(nullptr),
8787
_width(width),
@@ -96,7 +96,7 @@ namespace vsg
9696
}
9797
}
9898

99-
Array3D(ref_ptr<Data> data, uint32_t offset, uint32_t stride, uint32_t width, uint32_t height, uint32_t depth, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
99+
Array3D(ref_ptr<Data> data, uint32_t offset, uint32_t stride, uint32_t width, uint32_t height, uint32_t depth, const Properties& in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
100100
Data(),
101101
_data(nullptr),
102102
_width(0),
@@ -242,7 +242,7 @@ namespace vsg
242242
return *this;
243243
}
244244

245-
void assign(uint32_t width, uint32_t height, uint32_t depth, value_type* data, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
245+
void assign(uint32_t width, uint32_t height, uint32_t depth, value_type* data, const Properties& in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
246246
{
247247
_delete();
248248

@@ -259,7 +259,7 @@ namespace vsg
259259
dirty();
260260
}
261261

262-
void assign(ref_ptr<Data> storage, uint32_t offset, uint32_t stride, uint32_t width, uint32_t height, uint32_t depth, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
262+
void assign(ref_ptr<Data> storage, uint32_t offset, uint32_t stride, uint32_t width, uint32_t height, uint32_t depth, const Properties& in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
263263
{
264264
_delete();
265265

include/vsg/core/Data.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ namespace vsg
144144
Data(const Data& data, const CopyOp& copyop = {}) :
145145
Object(data, copyop), properties(data.properties) {}
146146

147-
explicit Data(Properties layout) :
147+
explicit Data(const Properties& layout) :
148148
properties(layout) {}
149149

150-
Data(Properties layout, uint32_t min_stride) :
150+
Data(const Properties& layout, uint32_t min_stride) :
151151
properties(layout)
152152
{
153153
if (properties.stride < min_stride) properties.stride = min_stride;
@@ -240,7 +240,7 @@ namespace vsg
240240
using Layout = Properties;
241241

242242
/// deprecated: use data->properties = properties instead.
243-
void setLayout(Layout layout)
243+
void setLayout(const Layout& layout)
244244
{
245245
VkFormat previous_format = properties.format; // temporary hack to keep applications that call setFormat(..) before setLayout(..) working
246246
uint32_t previous_stride = properties.stride;
@@ -251,7 +251,7 @@ namespace vsg
251251
/// deprecated: use data->properties
252252
Layout& getLayout() { return properties; }
253253
/// deprecated: use data->properties
254-
Layout getLayout() const { return properties; }
254+
const Layout& getLayout() const { return properties; }
255255
#endif
256256
};
257257
VSG_type_name(vsg::Data);

include/vsg/core/Object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ namespace vsg
260260

261261
C dest;
262262
dest.reserve(src.size());
263-
for (auto& ptr : src)
263+
for (const auto& ptr : src)
264264
{
265265
dest.push_back(operator()(ptr));
266266
}

0 commit comments

Comments
 (0)