From 69579df368c8f081efbae584ebb44cceeb75e78d Mon Sep 17 00:00:00 2001 From: Kp Date: Mon, 22 Aug 2022 01:24:49 +0000 Subject: [PATCH] Simplify pof_read_short Use the general little-endian helper. --- similar/main/polyobj.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/similar/main/polyobj.cpp b/similar/main/polyobj.cpp index a5b820e61..5f558b298 100644 --- a/similar/main/polyobj.cpp +++ b/similar/main/polyobj.cpp @@ -103,17 +103,11 @@ static size_t pof_cfread(void *const dst, const size_t elsize, const uint8_t *bu #define new_pof_read_int(i,f) pof_cfread(&(i), sizeof(i), (f)) -static short pof_read_short(ubyte *bufp) +static short pof_read_short(const uint8_t *bufp) { - short s; - - s = *(reinterpret_cast(&bufp[Pof_addr])); + const auto r = GET_INTEL_SHORT(&bufp[Pof_addr]); Pof_addr += 2; - return INTEL_SHORT(s); -// if (PHYSFS_read(f,&s,sizeof(s),1) != 1) -// Error("Unexpected end-of-file while reading object"); -// -// return s; + return r; } static void pof_read_string(char *buf,int max_char, ubyte *bufp)