summaryrefslogtreecommitdiffstats
path: root/src/text
diff options
context:
space:
mode:
authorFire_Head <Fire-Head@users.noreply.github.com>2020-08-03 00:03:24 +0200
committerGitHub <noreply@github.com>2020-08-03 00:03:24 +0200
commit4b614333c6778ae49cef688f6ef691dd58384d13 (patch)
treeced50966eaaf373f8733547046baf2bdc558662d /src/text
parentcleanup (diff)
parentMove sdk and eax (diff)
downloadre3-4b614333c6778ae49cef688f6ef691dd58384d13.tar
re3-4b614333c6778ae49cef688f6ef691dd58384d13.tar.gz
re3-4b614333c6778ae49cef688f6ef691dd58384d13.tar.bz2
re3-4b614333c6778ae49cef688f6ef691dd58384d13.tar.lz
re3-4b614333c6778ae49cef688f6ef691dd58384d13.tar.xz
re3-4b614333c6778ae49cef688f6ef691dd58384d13.tar.zst
re3-4b614333c6778ae49cef688f6ef691dd58384d13.zip
Diffstat (limited to 'src/text')
-rw-r--r--src/text/Text.cpp18
-rw-r--r--src/text/Text.h8
2 files changed, 14 insertions, 12 deletions
diff --git a/src/text/Text.cpp b/src/text/Text.cpp
index c9e22a84..1f6cda89 100644
--- a/src/text/Text.cpp
+++ b/src/text/Text.cpp
@@ -23,8 +23,8 @@ CText::Load(void)
{
uint8 *filedata;
char filename[32], type[4];
- int length;
- int offset, sectlen;
+ intptr_t offset, length;
+ size_t sectlen;
Unload();
filedata = new uint8[0x40000];
@@ -176,12 +176,13 @@ CText::UpperCase(wchar *s)
void
-CKeyArray::Load(uint32 length, uint8 *data, int *offset)
+CKeyArray::Load(size_t length, uint8 *data, intptr_t *offset)
{
- uint32 i;
+ size_t i;
uint8 *rawbytes;
- numEntries = length / sizeof(CKeyEntry);
+ // You can make numEntries size_t if you want to exceed 32-bit boundaries, everything else should be ready.
+ numEntries = (int)(length / sizeof(CKeyEntry));
entries = new CKeyEntry[numEntries];
rawbytes = (uint8*)entries;
@@ -255,12 +256,13 @@ CKeyArray::Search(const char *key)
void
-CData::Load(uint32 length, uint8 *data, int *offset)
+CData::Load(size_t length, uint8 *data, intptr_t *offset)
{
- uint32 i;
+ size_t i;
uint8 *rawbytes;
- numChars = length / sizeof(wchar);
+ // You can make numChars size_t if you want to exceed 32-bit boundaries, everything else should be ready.
+ numChars = (int)(length / sizeof(wchar));
chars = new wchar[numChars];
rawbytes = (uint8*)chars;
diff --git a/src/text/Text.h b/src/text/Text.h
index bd6544d2..4be9b6e6 100644
--- a/src/text/Text.h
+++ b/src/text/Text.h
@@ -26,11 +26,11 @@ class CKeyArray
{
public:
CKeyEntry *entries;
- int numEntries;
+ int numEntries; // You can make this size_t if you want to exceed 32-bit boundaries, everything else should be ready.
CKeyArray(void) : entries(nil), numEntries(0) {}
~CKeyArray(void) { Unload(); }
- void Load(uint32 length, uint8 *data, int *offset);
+ void Load(size_t length, uint8 *data, intptr_t *offset);
void Unload(void);
void Update(wchar *chars);
CKeyEntry *BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high);
@@ -45,11 +45,11 @@ class CData
{
public:
wchar *chars;
- int numChars;
+ int numChars; // You can make this size_t if you want to exceed 32-bit boundaries, everything else should be ready.
CData(void) : chars(nil), numChars(0) {}
~CData(void) { Unload(); }
- void Load(uint32 length, uint8 *data, int *offset);
+ void Load(size_t length, uint8 *data, intptr_t *offset);
void Unload(void);
};