Permalink
Browse files

endian.h: fix incorrect regex replacements caused by stdint.h changes

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
  • Loading branch information...
1 parent 735fd69 commit 8ca24d323404521366ee26830c5da5da53679d88 @tycho committed Mar 3, 2012
Showing with 31 additions and 31 deletions.
  1. +6 −6 engine.cpp
  2. +8 −8 file.cpp
  3. +4 −4 file.h
  4. +7 −7 resource.cpp
  5. +6 −6 serializer.cpp
View
@@ -126,9 +126,9 @@ void Engine::saveGameState(uint8_t slot, const char *desc) {
warning("Unable to save state file '%s'", stateFile);
} else {
// header
- f.writeUint32_tBE('AWSV');
- f.writeUint16_tBE(Serializer::CUR_VER);
- f.writeUint16_tBE(0);
+ f.writeUint32BE('AWSV');
+ f.writeUint16BE(Serializer::CUR_VER);
+ f.writeUint16BE(0);
char hdrdesc[32];
strncpy(hdrdesc, desc, sizeof(hdrdesc) - 1);
f.write(hdrdesc, sizeof(hdrdesc));
@@ -154,16 +154,16 @@ void Engine::loadGameState(uint8_t slot) {
if (!f.open(stateFile, _saveDir, "rb")) {
warning("Unable to open state file '%s'", stateFile);
} else {
- uint32_t id = f.readUint32_tBE();
+ uint32_t id = f.readUint32BE();
if (id != 'AWSV') {
warning("Bad savegame format");
} else {
// mute
player.stop();
mixer.stopAll();
// header
- uint16_t ver = f.readUint16_tBE();
- f.readUint16_tBE();
+ uint16_t ver = f.readUint16BE();
+ f.readUint16BE();
char hdrdesc[32];
f.read(hdrdesc, sizeof(hdrdesc));
// contents
View
@@ -153,15 +153,15 @@ uint8_t File::readByte() {
return b;
}
-uint16_t File::readUint16_tBE() {
+uint16_t File::readUint16BE() {
uint8_t hi = readByte();
uint8_t lo = readByte();
return (hi << 8) | lo;
}
-uint32_t File::readUint32_tBE() {
- uint16_t hi = readUint16_tBE();
- uint16_t lo = readUint16_tBE();
+uint32_t File::readUint32BE() {
+ uint16_t hi = readUint16BE();
+ uint16_t lo = readUint16BE();
return (hi << 16) | lo;
}
@@ -173,12 +173,12 @@ void File::writeByte(uint8_t b) {
write(&b, 1);
}
-void File::writeUint16_tBE(uint16_t n) {
+void File::writeUint16BE(uint16_t n) {
writeByte(n >> 8);
writeByte(n & 0xFF);
}
-void File::writeUint32_tBE(uint32_t n) {
- writeUint16_tBE(n >> 16);
- writeUint16_tBE(n & 0xFFFF);
+void File::writeUint32BE(uint32_t n) {
+ writeUint16BE(n >> 16);
+ writeUint16BE(n & 0xFFFF);
}
View
8 file.h
@@ -35,12 +35,12 @@ struct File {
void seek(int32_t off);
void read(void *ptr, uint32_t size);
uint8_t readByte();
- uint16_t readUint16_tBE();
- uint32_t readUint32_tBE();
+ uint16_t readUint16BE();
+ uint32_t readUint32BE();
void write(void *ptr, uint32_t size);
void writeByte(uint8_t b);
- void writeUint16_tBE(uint16_t n);
- void writeUint32_tBE(uint32_t n);
+ void writeUint16BE(uint16_t n);
+ void writeUint32BE(uint32_t n);
};
#endif
View
@@ -85,15 +85,15 @@ void Resource::readEntries() {
assert(_numMemList < ARRAYSIZE(_memList));
memEntry->state = f.readByte();
memEntry->type = f.readByte();
- memEntry->bufPtr = 0; f.readUint16_tBE();
- memEntry->unk4 = f.readUint16_tBE();
+ memEntry->bufPtr = 0; f.readUint16BE();
+ memEntry->unk4 = f.readUint16BE();
memEntry->rankNum = f.readByte();
memEntry->bankId = f.readByte();
- memEntry->bankOffset = f.readUint32_tBE();
- memEntry->unkC = f.readUint16_tBE();
- memEntry->packedSize = f.readUint16_tBE();
- memEntry->unk10 = f.readUint16_tBE();
- memEntry->size = f.readUint16_tBE();
+ memEntry->bankOffset = f.readUint32BE();
+ memEntry->unkC = f.readUint16BE();
+ memEntry->packedSize = f.readUint16BE();
+ memEntry->unk10 = f.readUint16BE();
+ memEntry->size = f.readUint16BE();
//Memory tracking
if (memEntry->packedSize==memEntry->size)
View
@@ -61,7 +61,7 @@ void Serializer::saveEntries(Entry *entry) {
}
break;
case SET_PTR:
- _stream->writeUint32_tBE(*(uint8_t **)(entry->data) - _ptrBlock);
+ _stream->writeUint32BE(*(uint8_t **)(entry->data) - _ptrBlock);
_bytesCount += 4;
break;
case SET_END:
@@ -94,7 +94,7 @@ void Serializer::loadEntries(Entry *entry) {
}
break;
case SET_PTR:
- *(uint8_t **)(entry->data) = _ptrBlock + _stream->readUint32_tBE();
+ *(uint8_t **)(entry->data) = _ptrBlock + _stream->readUint32BE();
_bytesCount += 4;
break;
case SET_END:
@@ -110,10 +110,10 @@ void Serializer::saveInt(uint8_t es, void *p) {
_stream->writeByte(*(uint8_t *)p);
break;
case 2:
- _stream->writeUint16_tBE(*(uint16_t *)p);
+ _stream->writeUint16BE(*(uint16_t *)p);
break;
case 4:
- _stream->writeUint32_tBE(*(uint32_t *)p);
+ _stream->writeUint32BE(*(uint32_t *)p);
break;
}
}
@@ -124,10 +124,10 @@ void Serializer::loadInt(uint8_t es, void *p) {
*(uint8_t *)p = _stream->readByte();
break;
case 2:
- *(uint16_t *)p = _stream->readUint16_tBE();
+ *(uint16_t *)p = _stream->readUint16BE();
break;
case 4:
- *(uint32_t *)p = _stream->readUint32_tBE();
+ *(uint32_t *)p = _stream->readUint32BE();
break;
}
}

0 comments on commit 8ca24d3

Please sign in to comment.