mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-22 03:45:36 +00:00
refactor: remove arrayWithLength, replace with std::vector
Eliminates the custom arrayWithLength<T> wrapper and all typedefs, replacing with std::vector<T> directly.
This commit is contained in:
@@ -45,18 +45,18 @@ int ConsoleSaveFileInputStream::read() {
|
||||
return static_cast<int>(byteRead);
|
||||
}
|
||||
|
||||
// Reads up to b.length bytes of data from this input stream into an array of
|
||||
// Reads up to b.size() bytes of data from this input stream into an array of
|
||||
// bytes. This method blocks until some input is available. Parameters: b - the
|
||||
// buffer into which the data is read. Returns: the total number of bytes read
|
||||
// into the buffer, or -1 if there is no more data because the end of the file
|
||||
// has been reached.
|
||||
int ConsoleSaveFileInputStream::read(byteArray b) {
|
||||
int ConsoleSaveFileInputStream::read(std::vector<uint8_t>& b) {
|
||||
unsigned int numberOfBytesRead;
|
||||
|
||||
bool result =
|
||||
m_saveFile->readFile(m_file,
|
||||
&b.data, // data buffer
|
||||
b.length, // number of bytes to read
|
||||
b.data(), // data buffer
|
||||
b.size(), // number of bytes to read
|
||||
&numberOfBytesRead // number of bytes read
|
||||
);
|
||||
|
||||
@@ -78,10 +78,10 @@ int ConsoleSaveFileInputStream::read(byteArray b) {
|
||||
// b len - the maximum number of bytes read. Returns: the total number of bytes
|
||||
// read into the buffer, or -1 if there is no more data because the end of the
|
||||
// file has been reached.
|
||||
int ConsoleSaveFileInputStream::read(byteArray b, unsigned int offset,
|
||||
int ConsoleSaveFileInputStream::read(std::vector<uint8_t>& b, unsigned int offset,
|
||||
unsigned int length) {
|
||||
// 4J Stu - We don't want to read any more than the array buffer can hold
|
||||
assert(length <= (b.length - offset));
|
||||
assert(length <= (b.size() - offset));
|
||||
|
||||
unsigned int numberOfBytesRead;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user