fix LEB128 integer decoding of negative numbers smaller than -134217728 (-2^27)
Due to mismatch of data types of result value and the zero constant/literal, smaller numbers were decoded wrongly:
-134217728 → -134217728
-134217729 → -1
-134217730 → -2
Limits of the current implementation:
relpipe-in-cli --relation "velká_čísla" --attribute "číslo" integer --record -9223372036854775808 --record 9223372036854775807 | relpipe-out-tabular
velká_čísla:
╭──────────────────────╮
│ číslo (integer) │
├──────────────────────┤
│ -9223372036854775808 │
│ 9223372036854775807 │
╰──────────────────────╯
Record count: 2
i.e. +2^63 and -(2^63-1)
/**
* Relational pipes (library)
* Copyright © 2018 František Kučera (Frantovo.cz, GlobalCode.info)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the:
* - GNU Lesser General Public License as published by the Free Software Foundation;
* version 3 of the License or (at your option)
* - GNU General Public License as published by the Free Software Foundation;
* version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vector>
#include "../TypeId.h"
#include "RelationalReaderBaseHandler.h"
namespace relpipe {
namespace reader {
namespace handlers {
class RelationalReaderValueHandler : public RelationalReaderBaseHandler {
public:
virtual void attribute(const void* value, const std::type_info& type) = 0;
};
}
}
}