From 3b7d44aa0b84f9c208d906f4d10517e36220ee80 Mon Sep 17 00:00:00 2001 From: ljfa-ag Date: Sat, 5 Sep 2015 13:17:56 +0200 Subject: Create constant for maximum list and array length --- src/tag_array.cpp | 4 ++-- src/tag_list.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tag_array.cpp b/src/tag_array.cpp index 8bb8bf72e4..99e32549b7 100644 --- a/src/tag_array.cpp +++ b/src/tag_array.cpp @@ -81,7 +81,7 @@ void tag_array::read_payload(io::stream_reader& reader) template<> void tag_array::write_payload(io::stream_writer& writer) const { - if(size() > INT32_MAX) + if(size() > io::stream_writer::max_array_len) { writer.get_ostr().setstate(std::ios::failbit); throw std::length_error("Byte array is too large for NBT"); @@ -93,7 +93,7 @@ void tag_array::write_payload(io::stream_writer& writer) const template<> void tag_array::write_payload(io::stream_writer& writer) const { - if(size() > INT32_MAX) + if(size() > io::stream_writer::max_array_len) { writer.get_ostr().setstate(std::ios::failbit); throw std::length_error("Int array is too large for NBT"); diff --git a/src/tag_list.cpp b/src/tag_list.cpp index 039bd9b77a..67a3d4c15f 100644 --- a/src/tag_list.cpp +++ b/src/tag_list.cpp @@ -116,7 +116,7 @@ void tag_list::read_payload(io::stream_reader& reader) void tag_list::write_payload(io::stream_writer& writer) const { - if(size() > INT32_MAX) + if(size() > io::stream_writer::max_array_len) { writer.get_ostr().setstate(std::ios::failbit); throw std::length_error("List is too large for NBT"); -- cgit 0.0.5-2-1-g0f52