diff --git a/Source/codec.cpp b/Source/codec.cpp index 9e5ffb869..49a7831d8 100644 --- a/Source/codec.cpp +++ b/Source/codec.cpp @@ -66,7 +66,7 @@ error: void codec_init_key(int unused, char *pszPassword) { char key[136]; // last 64 bytes are the SHA1 - std::uint32_t rand_state = 0x7058; + uint32_t rand_state = 0x7058; for (std::size_t i = 0; i < sizeof(key); ++i) { rand_state = rand_state * 214013 + 2531011; key[i] = rand_state >> 16; // Downcasting to char keeps the 2 least-significant bytes diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 0f54420be..67a1032ba 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -262,11 +262,11 @@ private: memset(&fhdr, 0, sizeof(fhdr)); fhdr.signature = SDL_SwapLE32('\x1AQPM'); fhdr.headersize = SDL_SwapLE32(32); - fhdr.filesize = SDL_SwapLE32(static_cast(size)); + fhdr.filesize = SDL_SwapLE32(static_cast(size)); fhdr.version = SDL_SwapLE16(0); fhdr.sectorsizeid = SDL_SwapLE16(3); - fhdr.hashoffset = SDL_SwapLE32(static_cast(kMpqHashEntryOffset)); - fhdr.blockoffset = SDL_SwapLE32(static_cast(kMpqBlockEntryOffset)); + fhdr.hashoffset = SDL_SwapLE32(static_cast(kMpqHashEntryOffset)); + fhdr.blockoffset = SDL_SwapLE32(static_cast(kMpqBlockEntryOffset)); fhdr.hashcount = SDL_SwapLE32(2048); fhdr.blockcount = SDL_SwapLE32(2048); @@ -514,9 +514,9 @@ BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, DWORD d str_ptr = tmp + 1; Hash(str_ptr, 3); - constexpr std::uint32_t kSectorSize = 4096; - const std::uint32_t num_sectors = (dwLen + (kSectorSize - 1)) / kSectorSize; - const std::uint32_t offset_table_bytesize = sizeof(std::uint32_t) * (num_sectors + 1); + constexpr uint32_t kSectorSize = 4096; + const uint32_t num_sectors = (dwLen + (kSectorSize - 1)) / kSectorSize; + const uint32_t offset_table_bytesize = sizeof(uint32_t) * (num_sectors + 1); pBlk->offset = mpqapi_find_free_block(dwLen + offset_table_bytesize, &pBlk->sizealloc); pBlk->sizefile = dwLen; pBlk->flags = 0x80000100; @@ -524,7 +524,7 @@ BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, DWORD d // We populate the table of sector offset while we write the data. // We can't pre-populate it because we don't know the compressed sector sizes yet. // First offset is the start of the first sector, last offset is the end of the last sector. - std::unique_ptr sectoroffsettable(new std::uint32_t[num_sectors + 1]); + std::unique_ptr sectoroffsettable(new uint32_t[num_sectors + 1]); #ifdef CAN_SEEKP_BEYOND_EOF if (!cur_archive.stream.seekp(pBlk->offset + offset_table_bytesize, std::ios::beg)) @@ -550,11 +550,11 @@ BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, DWORD d #endif const BYTE *src = pbData; - std::uint32_t destsize = offset_table_bytesize; + uint32_t destsize = offset_table_bytesize; BYTE mpq_buf[kSectorSize]; std::size_t cur_sector = 0; while (true) { - std::uint32_t len = std::min(dwLen, kSectorSize); + uint32_t len = std::min(dwLen, kSectorSize); memcpy(mpq_buf, src, len); src += len; len = PkwareCompress(mpq_buf, len); @@ -577,7 +577,7 @@ BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, DWORD d return FALSE; if (destsize < pBlk->sizealloc) { - const std::uint32_t block_size = pBlk->sizealloc - destsize; + const uint32_t block_size = pBlk->sizealloc - destsize; if (block_size >= 1024) { pBlk->sizealloc = destsize; mpqapi_alloc_block(pBlk->sizealloc + pBlk->offset, block_size); diff --git a/Source/sha.cpp b/Source/sha.cpp index bb25b427c..07715a01c 100644 --- a/Source/sha.cpp +++ b/Source/sha.cpp @@ -12,7 +12,7 @@ namespace { /* * Diablo-"SHA1" circular left shift, portable version. */ -std::uint32_t SHA1CircularShift(std::uint32_t bits, std::uint32_t word) { +uint32_t SHA1CircularShift(uint32_t bits, uint32_t word) { assert(bits < 32); assert(bits > 0); diff --git a/SourceX/display.cpp b/SourceX/display.cpp index 57edd8e54..a25b4ff8c 100644 --- a/SourceX/display.cpp +++ b/SourceX/display.cpp @@ -24,7 +24,7 @@ extern BOOL was_window_init; /** defined in dx.cpp */ extern SDL_Surface *renderer_texture_surface; /** defined in dx.cpp */ #ifdef USE_SDL1 -void SetVideoMode(int width, int height, int bpp, std::uint32_t flags) { +void SetVideoMode(int width, int height, int bpp, uint32_t flags) { SDL_Log("Setting video mode %dx%d bpp=%u flags=0x%08X", width, height, bpp, flags); SDL_SetVideoMode(width, height, bpp, flags); const auto ¤t = *SDL_GetVideoInfo(); diff --git a/SourceX/display.h b/SourceX/display.h index 06dc5ff0b..48ed973c4 100644 --- a/SourceX/display.h +++ b/SourceX/display.h @@ -18,7 +18,7 @@ extern SDL_Surface *pal_surface; extern unsigned int pal_surface_palette_version; #ifdef USE_SDL1 -void SetVideoMode(int width, int height, int bpp, std::uint32_t flags); +void SetVideoMode(int width, int height, int bpp, uint32_t flags); bool IsFullScreen(); void SetVideoModeToPrimary(bool fullscreen = IsFullScreen()); #endif