More aggressive sanitization. Loads of integer definition fixes
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -6,18 +6,18 @@
|
||||
|
||||
class FileByteCodeStream : public IPkmnBinaryStream {
|
||||
private:
|
||||
FILE* _file;
|
||||
FILE* non_null _file;
|
||||
size_t _readPosition = 0;
|
||||
|
||||
public:
|
||||
explicit FileByteCodeStream(FILE* file, size_t bound) : IPkmnBinaryStream(bound), _file(file) {}
|
||||
explicit FileByteCodeStream(FILE* non_null file, size_t bound) : IPkmnBinaryStream(bound), _file(file) {}
|
||||
|
||||
int Write(const void* ptr, asUINT size) override {
|
||||
int Write(const void* non_null ptr, asUINT size) override {
|
||||
if (size == 0)
|
||||
return 0;
|
||||
return fwrite(ptr, size, 1, _file);
|
||||
}
|
||||
int Read(void* ptr, asUINT size) override {
|
||||
int Read(void* non_null ptr, asUINT size) override {
|
||||
if (size == 0)
|
||||
return 0;
|
||||
if (_readPosition + size >= _angelScriptBound) {
|
||||
|
||||
@@ -14,9 +14,9 @@ protected:
|
||||
|
||||
public:
|
||||
virtual void WriteTypes(
|
||||
const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo*>>& types,
|
||||
const ArbUt::Dictionary<ArbUt::StringView, asITypeInfo*>& itemUseTypes,
|
||||
const ArbUt::Dictionary<ArbUt::StringView, asITypeInfo*>& evolutionTypes) {
|
||||
const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo* non_null>>& types,
|
||||
const ArbUt::Dictionary<ArbUt::StringView, asITypeInfo* non_null>& itemUseTypes,
|
||||
const ArbUt::Dictionary<ArbUt::StringView, asITypeInfo* non_null>& evolutionTypes) {
|
||||
// We serialize our types in the format
|
||||
// "[category(byte)][name(str)]\2[decl(str)]\2[name(str)]\2[decl(str)]\1[category(byte)]...."
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
Write("\1", sizeof(char));
|
||||
}
|
||||
|
||||
virtual ArbUt::Dictionary<i16, ArbUt::Dictionary<ArbUt::StringView, uint32_t>> ReadTypes() {
|
||||
virtual ArbUt::Dictionary<i16, ArbUt::Dictionary<ArbUt::StringView, u32>> ReadTypes() {
|
||||
_angelScriptBound = SIZE_MAX;
|
||||
ArbUt::Dictionary<i16, ArbUt::Dictionary<ArbUt::StringView, uint32_t>> types;
|
||||
i16 categoryArr[1];
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
class MemoryByteCodeStream : public IPkmnBinaryStream {
|
||||
private:
|
||||
uint8_t* _out;
|
||||
uint8_t* non_null _out;
|
||||
size_t _index = 0;
|
||||
size_t _size = 0;
|
||||
size_t _capacity = 0;
|
||||
@@ -15,14 +15,14 @@ private:
|
||||
public:
|
||||
MemoryByteCodeStream()
|
||||
: IPkmnBinaryStream(SIZE_MAX), _out((uint8_t*)malloc(MEM_STEPS * sizeof(uint8_t))), _capacity(MEM_STEPS){};
|
||||
MemoryByteCodeStream(uint8_t* in, size_t size) : IPkmnBinaryStream(SIZE_MAX), _out(in), _size(size) {}
|
||||
MemoryByteCodeStream(uint8_t* non_null in, size_t size) : IPkmnBinaryStream(SIZE_MAX), _out(in), _size(size) {}
|
||||
|
||||
uint8_t* GetOut() const { return _out; }
|
||||
uint8_t* non_null GetOut() const { return _out; }
|
||||
size_t GetWrittenSize() const { return _size; }
|
||||
|
||||
void SetAngelScriptBound(size_t bound) noexcept { _angelScriptBound = bound; }
|
||||
|
||||
int Write(const void* ptr, asUINT size) final {
|
||||
int Write(const void* non_null ptr, asUINT size) final {
|
||||
if (size == 0)
|
||||
return 0;
|
||||
auto initialSize = _size;
|
||||
@@ -42,14 +42,14 @@ public:
|
||||
return size;
|
||||
}
|
||||
|
||||
void WriteToPosition(const void* ptr, asUINT size, size_t position) {
|
||||
void WriteToPosition(const void* non_null ptr, asUINT size, size_t position) {
|
||||
auto start = reinterpret_cast<const uint8_t*>(ptr);
|
||||
for (asUINT index = 0; index < size; index++) {
|
||||
_out[position + index] = *(start + index);
|
||||
}
|
||||
}
|
||||
|
||||
int Read(void* ptr, asUINT size) final {
|
||||
int Read(void* non_null ptr, asUINT size) final {
|
||||
if (size == 0)
|
||||
return 0;
|
||||
auto toRead = size;
|
||||
|
||||
Reference in New Issue
Block a user