Index adjustments from derping around.

This commit is contained in:
ThePhD 2020-01-24 20:16:37 -05:00
parent 5301bc1d4c
commit ba9507107b
No known key found for this signature in database
GPG Key ID: 1509DB1C0F702BFA
3 changed files with 10 additions and 10 deletions

View File

@ -682,15 +682,15 @@ namespace sol {
static detail::error_result set_category(std::random_access_iterator_tag, lua_State* L, T& self, stack_object okey, stack_object value) {
decltype(auto) key = okey.as<K>();
if (key <= 0) {
key += deferred_uc::index_adjustment(L, self);
if (key < 0) {
return detail::error_result("sol: out of bounds (too small) for set on '%s'", detail::demangle<T>().c_str());
}
key += deferred_uc::index_adjustment(L, self);
std::ptrdiff_t len = static_cast<std::ptrdiff_t>(size_start(L, self));
if (key == len) {
return add_copyable(is_copyable(), L, self, std::move(value));
}
else if (key > len) {
else if (key >= len) {
return detail::error_result("sol: out of bounds (too big) for set on '%s'", detail::demangle<T>().c_str());
}
auto it = std::next(deferred_uc::begin(L, self), key);

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script.
// Generated 2020-01-25 00:57:45.038692 UTC
// This header was generated with sol v3.2.0 (revision c77b5b4)
// Generated 2020-01-25 01:16:25.945664 UTC
// This header was generated with sol v3.2.0 (revision 5301bc1)
// https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script.
// Generated 2020-01-25 00:57:44.490128 UTC
// This header was generated with sol v3.2.0 (revision c77b5b4)
// Generated 2020-01-25 01:16:25.151902 UTC
// This header was generated with sol v3.2.0 (revision 5301bc1)
// https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP
@ -19854,15 +19854,15 @@ namespace sol {
static detail::error_result set_category(std::random_access_iterator_tag, lua_State* L, T& self, stack_object okey, stack_object value) {
decltype(auto) key = okey.as<K>();
if (key <= 0) {
key += deferred_uc::index_adjustment(L, self);
if (key < 0) {
return detail::error_result("sol: out of bounds (too small) for set on '%s'", detail::demangle<T>().c_str());
}
key += deferred_uc::index_adjustment(L, self);
std::ptrdiff_t len = static_cast<std::ptrdiff_t>(size_start(L, self));
if (key == len) {
return add_copyable(is_copyable(), L, self, std::move(value));
}
else if (key > len) {
else if (key >= len) {
return detail::error_result("sol: out of bounds (too big) for set on '%s'", detail::demangle<T>().c_str());
}
auto it = std::next(deferred_uc::begin(L, self), key);