Commit 5d51af4d authored by Sebastian Pölsterl's avatar Sebastian Pölsterl Committed by Christian Schulte zu Berge
Browse files

Properly compare unsigned ints

Fixes -Wsign-compare
parent f8be6731
...@@ -263,13 +263,14 @@ namespace campvis { ...@@ -263,13 +263,14 @@ namespace campvis {
if (img != 0) { if (img != 0) {
const tgt::svec3& imgSize = img->getSize(); const tgt::svec3& imgSize = img->getSize();
if (p_xSliceNumber.getMaxValue() != imgSize.x - 1){ unsigned int maxValue = static_cast<unsigned int> (p_xSliceNumber.getMaxValue());
if (maxValue != imgSize.x - 1){
p_xSliceNumber.setMaxValue(static_cast<int>(imgSize.x) - 1); p_xSliceNumber.setMaxValue(static_cast<int>(imgSize.x) - 1);
} }
if (p_ySliceNumber.getMaxValue() != imgSize.y - 1){ if (maxValue != imgSize.y - 1){
p_ySliceNumber.setMaxValue(static_cast<int>(imgSize.y) - 1); p_ySliceNumber.setMaxValue(static_cast<int>(imgSize.y) - 1);
} }
if (p_zSliceNumber.getMaxValue() != imgSize.z - 1){ if (maxValue != imgSize.z - 1){
p_zSliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1); p_zSliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1);
} }
} }
......
...@@ -143,7 +143,7 @@ namespace campvis { ...@@ -143,7 +143,7 @@ namespace campvis {
if (img != 0) { if (img != 0) {
const tgt::svec3& imgSize = img->getSize(); const tgt::svec3& imgSize = img->getSize();
if (p_sliceNumber.getMaxValue() != imgSize.z - 1){ if (p_sliceNumber.getMaxValue() != static_cast<int>(imgSize.z) - 1){
p_sliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1); p_sliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1);
} }
} }
......
...@@ -251,15 +251,15 @@ namespace campvis { ...@@ -251,15 +251,15 @@ namespace campvis {
if (img != 0) { if (img != 0) {
const tgt::svec3& imgSize = img->getSize(); const tgt::svec3& imgSize = img->getSize();
if (_sliceExtractor.p_xSliceNumber.getMaxValue() != imgSize.x - 1){ if (_sliceExtractor.p_xSliceNumber.getMaxValue() != static_cast<int>(imgSize.x) - 1){
_sliceExtractor.p_xSliceNumber.setMaxValue(static_cast<int>(imgSize.x) - 1); _sliceExtractor.p_xSliceNumber.setMaxValue(static_cast<int>(imgSize.x) - 1);
_sliceExtractor.p_xSliceNumber.setValue(static_cast<int>(imgSize.x) / 2); _sliceExtractor.p_xSliceNumber.setValue(static_cast<int>(imgSize.x) / 2);
} }
if (_sliceExtractor.p_ySliceNumber.getMaxValue() != imgSize.y - 1){ if (_sliceExtractor.p_ySliceNumber.getMaxValue() != static_cast<int>(imgSize.y) - 1){
_sliceExtractor.p_ySliceNumber.setMaxValue(static_cast<int>(imgSize.y) - 1); _sliceExtractor.p_ySliceNumber.setMaxValue(static_cast<int>(imgSize.y) - 1);
_sliceExtractor.p_ySliceNumber.setValue(static_cast<int>(imgSize.y) / 2); _sliceExtractor.p_ySliceNumber.setValue(static_cast<int>(imgSize.y) / 2);
} }
if (_sliceExtractor.p_zSliceNumber.getMaxValue() != imgSize.z - 1){ if (_sliceExtractor.p_zSliceNumber.getMaxValue() != static_cast<int>(imgSize.z) - 1){
_sliceExtractor.p_zSliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1); _sliceExtractor.p_zSliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1);
_sliceExtractor.p_zSliceNumber.setValue(static_cast<int>(imgSize.z) / 2); _sliceExtractor.p_zSliceNumber.setValue(static_cast<int>(imgSize.z) / 2);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment