Simplify pof_read_short

Use the general little-endian helper.
This commit is contained in:
Kp 2022-08-22 01:24:49 +00:00
parent 87c79206e8
commit 69579df368

View file

@ -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)) #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; const auto r = GET_INTEL_SHORT(&bufp[Pof_addr]);
s = *(reinterpret_cast<int16_t *>(&bufp[Pof_addr]));
Pof_addr += 2; Pof_addr += 2;
return INTEL_SHORT(s); return r;
// if (PHYSFS_read(f,&s,sizeof(s),1) != 1)
// Error("Unexpected end-of-file while reading object");
//
// return s;
} }
static void pof_read_string(char *buf,int max_char, ubyte *bufp) static void pof_read_string(char *buf,int max_char, ubyte *bufp)