Skip to content

Commit 886e1c2

Browse files
committed
general: fix many compilation warnings in GCC 8
1 parent d89efcf commit 886e1c2

File tree

68 files changed

+218
-322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+218
-322
lines changed

contrib/src/rplight/internalLightManager.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void InternalLightManager::setup_shadows(RPLight* light) {
135135
}
136136

137137
// Init all sources
138-
for (int i = 0; i < num_sources; ++i) {
138+
for (size_t i = 0; i < num_sources; ++i) {
139139
ShadowSource* source = light->get_shadow_source(i);
140140

141141
// Set the source as dirty, so it gets updated in the beginning

contrib/src/rplight/pointerSlotStorage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class PointerSlotStorage {
170170
_num_entries--;
171171

172172
// Update maximum index
173-
if (slot == _max_index) {
173+
if ((int)slot == _max_index) {
174174
while (_max_index >= 0 && !_data[_max_index--]);
175175
}
176176
}

contrib/src/rplight/rpLight.I

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*
3434
* @return Amount of shadow sources
3535
*/
36-
inline int RPLight::get_num_shadow_sources() const {
36+
inline size_t RPLight::get_num_shadow_sources() const {
3737
return _shadow_sources.size();
3838
}
3939

contrib/src/rplight/rpLight.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class RPLight : public ReferenceCount {
5757
virtual void update_shadow_sources() = 0;
5858
virtual void write_to_command(GPUCommand &cmd);
5959

60-
inline int get_num_shadow_sources() const;
60+
inline size_t get_num_shadow_sources() const;
6161
inline ShadowSource* get_shadow_source(size_t index) const;
6262
inline void clear_shadow_sources();
6363

contrib/src/rplight/shadowAtlas.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,12 @@ LVecBase4i ShadowAtlas::find_and_reserve_region(size_t tile_width, size_t tile_h
173173
void ShadowAtlas::free_region(const LVecBase4i& region) {
174174
// Out of bounds check, can't hurt
175175
nassertv(region.get_x() >= 0 && region.get_y() >= 0);
176-
nassertv(region.get_x() + region.get_z() <= _num_tiles && region.get_y() + region.get_w() <= _num_tiles);
176+
nassertv(region.get_x() + region.get_z() <= (int)_num_tiles && region.get_y() + region.get_w() <= (int)_num_tiles);
177177

178178
_num_used_tiles -= region.get_z() * region.get_w();
179179

180-
for (size_t x = 0; x < region.get_z(); ++x) {
181-
for (size_t y = 0; y < region.get_w(); ++y) {
180+
for (int x = 0; x < region.get_z(); ++x) {
181+
for (int y = 0; y < region.get_w(); ++y) {
182182
// Could do an assert here, that the tile should have been used (=true) before
183183
set_tile(region.get_x() + x, region.get_y() + y, false);
184184
}

direct/src/dcparser/dcLexer.cxx.prebuilt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ input_chars(char *buffer, int &result, int max_size) {
744744
// Define this macro carefully, since different flex versions call it
745745
// with a different type for result.
746746
#define YY_INPUT(buffer, result, max_size) { \
747-
int int_result; \
747+
int int_result = 0; \
748748
input_chars((buffer), int_result, (max_size)); \
749749
(result) = int_result; \
750750
}

direct/src/dcparser/dcLexer.lxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ input_chars(char *buffer, int &result, int max_size) {
169169
// Define this macro carefully, since different flex versions call it
170170
// with a different type for result.
171171
#define YY_INPUT(buffer, result, max_size) { \
172-
int int_result; \
172+
int int_result = 0; \
173173
input_chars((buffer), int_result, (max_size)); \
174174
(result) = int_result; \
175175
}

dtool/src/interrogatedb/py_panda.I

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ DtoolInstance_GetPointer(PyObject *self, T *&into) {
3131
if (_IS_FINAL(T)) {
3232
if (DtoolInstance_TYPE(self) == target_class) {
3333
into = (T *)DtoolInstance_VOID_PTR(self);
34+
} else {
35+
return false;
3436
}
3537
} else {
3638
into = (T *)DtoolInstance_UPCAST(self, *target_class);
@@ -52,6 +54,8 @@ DtoolInstance_GetPointer(PyObject *self, T *&into, Dtool_PyTypedObject &target_c
5254
if (_IS_FINAL(T)) {
5355
if (DtoolInstance_TYPE(self) == &target_class) {
5456
into = (T *)DtoolInstance_VOID_PTR(self);
57+
} else {
58+
return false;
5559
}
5660
} else {
5761
into = (T *)DtoolInstance_UPCAST(self, target_class);

dtool/src/interrogatedb/py_wrappers.cxx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,19 +1209,6 @@ static PyObject *Dtool_MappingWrapper_Keys_repr(PyObject *self) {
12091209
return result;
12101210
}
12111211

1212-
static PySequenceMethods Dtool_MappingWrapper_Keys_SequenceMethods = {
1213-
Dtool_SequenceWrapper_length,
1214-
nullptr, // sq_concat
1215-
nullptr, // sq_repeat
1216-
Dtool_MappingWrapper_Items_getitem,
1217-
nullptr, // sq_slice
1218-
nullptr, // sq_ass_item
1219-
nullptr, // sq_ass_slice
1220-
Dtool_MappingWrapper_contains,
1221-
nullptr, // sq_inplace_concat
1222-
nullptr, // sq_inplace_repeat
1223-
};
1224-
12251212
PyTypeObject Dtool_MappingWrapper_Keys_Type = {
12261213
PyVarObject_HEAD_INIT(nullptr, 0)
12271214
"sequence wrapper",

panda/src/bullet/bulletBodyNode.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ add_shapes_from_collision_solids(CollisionNode *cnode) {
784784

785785
PT(BulletTriangleMesh) mesh = nullptr;
786786

787-
for (int j=0; j<cnode->get_num_solids(); j++) {
787+
for (size_t j = 0; j < cnode->get_num_solids(); ++j) {
788788
CPT(CollisionSolid) solid = cnode->get_solid(j);
789789
TypeHandle type = solid->get_type();
790790

@@ -819,9 +819,9 @@ add_shapes_from_collision_solids(CollisionNode *cnode) {
819819
mesh = new BulletTriangleMesh();
820820
}
821821

822-
for (int i=2; i < polygon->get_num_points(); i++ ) {
822+
for (size_t i = 2; i < polygon->get_num_points(); ++i) {
823823
LPoint3 p1 = polygon->get_point(0);
824-
LPoint3 p2 = polygon->get_point(i-1);
824+
LPoint3 p2 = polygon->get_point(i - 1);
825825
LPoint3 p3 = polygon->get_point(i);
826826

827827
mesh->do_add_triangle(p1, p2, p3, true);

0 commit comments

Comments
 (0)