diff --git a/include/tag_array.h b/include/tag_array.h index d4108e1..99d99f1 100644 --- a/include/tag_array.h +++ b/include/tag_array.h @@ -41,7 +41,7 @@ namespace detail ///@endcond /** - * @brief Tag that contains an array of byte or int values + * @brief Tag that contains an array of byte, int or long values * * Common class for tag_byte_array, tag_int_array and tag_long_array. */ diff --git a/src/tag.cpp b/src/tag.cpp index 745a83c..7e3be39 100644 --- a/src/tag.cpp +++ b/src/tag.cpp @@ -33,7 +33,7 @@ static_assert(std::numeric_limits::is_iec559 && std::numeric_limits tag::clone() && diff --git a/src/tag_array.cpp b/src/tag_array.cpp index 4eb70dc..3208fcd 100644 --- a/src/tag_array.cpp +++ b/src/tag_array.cpp @@ -51,18 +51,18 @@ void tag_array::read_payload(io::stream_reader& reader) if(length < 0) reader.get_istr().setstate(std::ios::failbit); if(!reader.get_istr()) - throw io::input_error("Error reading length of generic array tag"); + throw io::input_error("Error reading length of array tag"); data.clear(); data.reserve(length); - for(T i = 0; i < length; ++i) + for(int32_t i = 0; i < length; ++i) { T val; reader.read_num(val); data.push_back(val); } if(!reader.get_istr()) - throw io::input_error("Error reading contents of generic array tag"); + throw io::input_error("Error reading contents of array tag"); } //Writing @@ -84,7 +84,7 @@ void tag_array::write_payload(io::stream_writer& writer) const if(size() > io::stream_writer::max_array_len) { writer.get_ostr().setstate(std::ios::failbit); - throw std::length_error("Generic array is too large for NBT"); + throw std::length_error("Array is too large for NBT"); } writer.write_num(static_cast(size())); for(T i: data) diff --git a/test/nbttest.h b/test/nbttest.h index ee686a8..e3e16c5 100644 --- a/test/nbttest.h +++ b/test/nbttest.h @@ -37,8 +37,8 @@ class nbttest : public CxxTest::TestSuite TS_ASSERT(is_valid_type(1)); TS_ASSERT(is_valid_type(5, false)); TS_ASSERT(is_valid_type(7, true)); - TS_ASSERT(is_valid_type(11)); - TS_ASSERT(!is_valid_type(12)); + TS_ASSERT(is_valid_type(12)); + TS_ASSERT(!is_valid_type(13)); //looks like TS_ASSERT_EQUALS can't handle abstract classes... TS_ASSERT(*tag::create(tag_type::Byte) == tag_byte()); diff --git a/test/read_test.h b/test/read_test.h index e7c00a8..4f71495 100644 --- a/test/read_test.h +++ b/test/read_test.h @@ -66,8 +66,8 @@ class read_test : public CxxTest::TestSuite TS_ASSERT(!is); is.clear(); - //Test for invalid tag type 12 - is.str("\x0c"); + //Test for invalid tag type 13 + is.str("\x0d"); TS_ASSERT_THROWS(reader.read_type(), io::input_error); TS_ASSERT(!is); is.clear();