summaryrefslogtreecommitdiff
path: root/indra/llkdu
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2016-11-03 20:48:41 -0400
committerNat Goodspeed <nat@lindenlab.com>2016-11-03 20:48:41 -0400
commit0413e40d82cc53c1e8180023db36108557b6f21c (patch)
treebd358b773a730070aa5e5843f76bd57931215a50 /indra/llkdu
parent6cc4a8dcd2a0a320698312fe4775a946a16575e4 (diff)
DRTVWR-418: Update KDU and llimagej2ckdu* with certain clang fixes.
Diffstat (limited to 'indra/llkdu')
-rw-r--r--indra/llkdu/llimagej2ckdu.cpp31
-rw-r--r--indra/llkdu/llimagej2ckdu.h6
-rw-r--r--indra/llkdu/tests/llimagej2ckdu_test.cpp6
3 files changed, 27 insertions, 16 deletions
diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp
index b85e39b452..0540e55e07 100644
--- a/indra/llkdu/llimagej2ckdu.cpp
+++ b/indra/llkdu/llimagej2ckdu.cpp
@@ -37,7 +37,6 @@
#include "llpointer.h"
#include "llmath.h"
#include "llkdumem.h"
-#include "stringize.h"
#define kdu_xxxx "kdu_block_coding.h"
#include "include_kdu_xxxx.h"
@@ -50,6 +49,18 @@ using namespace kdu_core;
#include <sstream>
#include <iomanip>
+// stream kdu_dims to std::ostream
+// Turns out this must NOT be in the anonymous namespace!
+// It must also precede #include "stringize.h".
+inline
+std::ostream& operator<<(std::ostream& out, const kdu_dims& dims)
+{
+ return out << "(" << dims.pos.x << "," << dims.pos.y << "),"
+ "[" << dims.size.x << "x" << dims.size.y << "]";
+}
+
+#include "stringize.h"
+
namespace {
// Failure to load an image shouldn't crash the whole viewer.
struct KDUError: public LLContinueError
@@ -92,15 +103,6 @@ std::string report_kdu_exception(kdu_exception mb)
}
} // anonymous namespace
-// stream kdu_dims to std::ostream
-// Turns out this must NOT be in the anonymous namespace!
-inline
-std::ostream& operator<<(std::ostream& out, const kdu_dims& dims)
-{
- return out << "(" << dims.pos.x << "," << dims.pos.y << "),"
- "[" << dims.size.x << "x" << dims.size.y << "]";
-}
-
class kdc_flow_control {
public:
@@ -356,9 +358,9 @@ void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECod
// This method is only called from methods that catch KDUError.
// We want to fail the image load, not crash the viewer.
LLTHROW(KDUError(STRINGIZE("Component " << idx << " dimensions "
- << other_dims
- << " do not match component 0 dimensions "
- << dims << "!")));
+ << stringize(other_dims)
+ << " do not match component 0 dimensions "
+ << stringize(dims) << "!")));
}
}
@@ -570,7 +572,8 @@ bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco
kdu_coords offset = tile_dims.pos - dims.pos;
int row_gap = channels*dims.size.x; // inter-row separation
kdu_byte *buf = buffer + offset.y*row_gap + offset.x*channels;
- mDecodeState.reset(new LLKDUDecodeState(tile, buf, row_gap));
+ mDecodeState.reset(new LLKDUDecodeState(tile, buf, row_gap,
+ mCodeStreamp.get()));
}
// Do the actual processing
F32 remaining_time = decode_time - decode_timer.getElapsedTimeF32();
diff --git a/indra/llkdu/llimagej2ckdu.h b/indra/llkdu/llimagej2ckdu.h
index fd9a396722..b57e4cc40e 100644
--- a/indra/llkdu/llimagej2ckdu.h
+++ b/indra/llkdu/llimagej2ckdu.h
@@ -104,10 +104,12 @@ private:
}
}
- kdu_codestream* operator->() { return &mCodeStream; }
+ // for those few times when you need a raw kdu_codestream*
+ kdu_core::kdu_codestream* get() { return &mCodeStream; }
+ kdu_core::kdu_codestream* operator->() { return &mCodeStream; }
private:
- kdu_codestream mCodeStream;
+ kdu_core::kdu_codestream mCodeStream;
};
// Encode variable
diff --git a/indra/llkdu/tests/llimagej2ckdu_test.cpp b/indra/llkdu/tests/llimagej2ckdu_test.cpp
index 1407da3aa2..ae6138d4c6 100644
--- a/indra/llkdu/tests/llimagej2ckdu_test.cpp
+++ b/indra/llkdu/tests/llimagej2ckdu_test.cpp
@@ -29,7 +29,13 @@
// Class to test
#include "llimagej2ckdu.h"
+#if LL_DARWIN
+// For this source, it's true that private fields in llkdumem.h are unused.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-private-field"
#include "llkdumem.h"
+#pragma clang diagnostic pop
+#endif
#include "kdu_block_coding.h"
// Tut header
#include "lltut.h"