diff --git a/Source/automap.cpp b/Source/automap.cpp index 335d4f630..881c8b454 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -70,7 +70,7 @@ void __cdecl InitAutomap() ++v1; } while ( v1 < 31 ); - memset(automaptype, 0, 0x400u); + memset(automaptype, 0, sizeof(automaptype)); switch ( leveltype ) { case DTYPE_CATHEDRAL: @@ -103,7 +103,7 @@ void __cdecl InitAutomap() automaptype[i] = v8; } mem_free_dbg(v7); - memset(automapview, 0, 0x640u); + memset(automapview, 0, sizeof(automapview)); v13 = 0; do { diff --git a/Source/codec.cpp b/Source/codec.cpp index 416b5c090..805fd365f 100644 --- a/Source/codec.cpp +++ b/Source/codec.cpp @@ -38,7 +38,7 @@ int __fastcall codec_decode(void *pbSrcDst, int size, char *pszPassword) } while ( v7 < 64 ); SHA1Calculate(0, v9, 0); - memset(dst, 0, 0x14u); + memset(dst, 0, sizeof(dst)); memcpy(v4, v9, 0x40u); v4 += 64; passworda -= 64; @@ -46,7 +46,7 @@ int __fastcall codec_decode(void *pbSrcDst, int size, char *pszPassword) while ( passworda ); v5 = v11; } - memset(v9, 0, 0x80u); + memset(v9, 0, sizeof(v9)); if ( !v4[4] ) { SHA1Result(0, dst); @@ -55,7 +55,7 @@ int __fastcall codec_decode(void *pbSrcDst, int size, char *pszPassword) v8 = v5 + (unsigned char)v4[5] - 64; goto LABEL_14; } - memset(dst, 0, 0x14u); + memset(dst, 0, sizeof(dst)); } v8 = 0; LABEL_14: @@ -108,8 +108,8 @@ void __fastcall codec_init_key(int unused, char *pszPassword) ++v7; } while ( v7 < 0x88 ); - memset(v10, 0, 0x40u); - memset(dst, 0, 0x14u); + memset(v10, 0, sizeof(v10)); + memset(dst, 0, sizeof(dst)); v8 = 0; do { @@ -117,7 +117,7 @@ void __fastcall codec_init_key(int unused, char *pszPassword) SHA1Calculate(v8++, &v9[72], 0); } while ( v8 < 3 ); - memset(v9, 0, 0x88u); + memset(v9, 0, sizeof(v9)); } // 4035DB: using guessed type char var_E0[72]; // 4035DB: using guessed type char var_58[64]; @@ -166,7 +166,7 @@ void __fastcall codec_encode(void *pbSrcDst, int size, int size_64, char *pszPas ++v7; } while ( v7 < 64 ); - memset(dst, 0, 0x14u); + memset(dst, 0, sizeof(dst)); memcpy(v4, v9, 0x40u); v4 += 64; v12 -= v6; @@ -174,7 +174,7 @@ void __fastcall codec_encode(void *pbSrcDst, int size, int size_64, char *pszPas while ( v12 ); v5 = v6; } - memset(v9, 0, 0x80u); + memset(v9, 0, sizeof(v9)); SHA1Result(0, v10); v4[4] = 0; *((_WORD *)v4 + 3) = 0; diff --git a/Source/control.cpp b/Source/control.cpp index 70046ac57..fbcf184ae 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -2956,7 +2956,7 @@ void __fastcall control_drop_gold(int vkey) dropGoldValue = 0; return; } - memset(v6, 0, 6u); + memset(v6, 0, sizeof(v6)); _itoa(dropGoldValue, v6, 10); if ( v1 != VK_RETURN ) { diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index 6abec8832..7a029919b 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -659,7 +659,7 @@ void __cdecl InitL3Dungeon() int i; // edx int j; // ecx - memset(dungeon, 0, 0x640u); + memset(dungeon, 0, sizeof(dungeon)); for(i = 0; i < 40; i++) { diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 8c646d782..5ab639be2 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -889,8 +889,8 @@ void __cdecl InitL4Dungeon() signed int v1; // eax signed int v2; // ecx - memset(dung, 0, 0x190u); - memset(L4dungeon, 0, 0x1900u); + memset(dung, 0, sizeof(dung)); + memset(L4dungeon, 0, sizeof(L4dungeon)); v0 = 0; do { diff --git a/Source/dx.cpp b/Source/dx.cpp index fdd5e4d27..b9f046464 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -125,10 +125,10 @@ void __cdecl dx_create_back_buffer() if ( v1 != DDERR_CANTLOCKSURFACE ) ErrDlg(IDD_DIALOG1, v1, "C:\\Src\\Diablo\\Source\\dx.cpp", 81); } - memset(&v4, 0, 0x6Cu); + memset(&v4, 0, sizeof(v4)); v4.dwWidth = 768; v4.lPitch = 768; - v4.dwSize = 108; + v4.dwSize = sizeof(v4); v4.dwFlags = DDSD_PIXELFORMAT|DDSD_PITCH|DDSD_WIDTH|DDSD_HEIGHT|DDSD_CAPS; v4.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN; v4.dwHeight = 656; @@ -147,8 +147,8 @@ void __cdecl dx_create_primary_surface() int v0; // eax DDSURFACEDESC v1; // [esp+0h] [ebp-6Ch] - memset(&v1, 0, 0x6Cu); - v1.dwSize = 108; + memset(&v1, 0, sizeof(v1)); + v1.dwSize = sizeof(v1); v1.dwFlags = DDSD_CAPS; v1.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; v0 = lpDDInterface->CreateSurface(&v1, &lpDDSPrimary, NULL); @@ -198,7 +198,7 @@ void __cdecl lock_buf_priv() { if ( sgdwLockCount ) goto LABEL_9; - v2.dwSize = 108; + v2.dwSize = sizeof(v2); v1 = lpDDSBackBuf->Lock(NULL, &v2, DDLOCK_WAIT, NULL); if ( v1 ) DDErrMsg(v1, 235, "C:\\Src\\Diablo\\Source\\dx.cpp"); diff --git a/Source/gendung.cpp b/Source/gendung.cpp index f43ad3754..a7c8e2811 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -78,11 +78,11 @@ void __cdecl FillSolidBlockTbls() unsigned char v4; // bl int size; // [esp+8h] [ebp-4h] - memset(nBlockTable, 0, 0x801u); - memset(nSolidTable, 0, 0x801u); - memset(nTransTable, 0, 0x801u); - memset(nMissileTable, 0, 0x801u); - memset(nTrapTable, 0, 0x801u); + memset(nBlockTable, 0, sizeof(nBlockTable)); + memset(nSolidTable, 0, sizeof(nSolidTable)); + memset(nTransTable, 0, sizeof(nTransTable)); + memset(nMissileTable, 0, sizeof(nMissileTable)); + memset(nTrapTable, 0, sizeof(nTrapTable)); if ( leveltype != DTYPE_TOWN ) { switch ( leveltype ) @@ -674,8 +674,8 @@ void __cdecl SetDungeonMicros() void __cdecl DRLG_InitTrans() { - memset(dung_map, 0, 0x3100u); - memset(TransList, 0, 0x100u); + memset(dung_map, 0, sizeof(dung_map)); + memset(TransList, 0, sizeof(TransList)); TransVal = 1; } // 5A5590: using guessed type char TransVal; @@ -913,8 +913,8 @@ bool __fastcall DRLG_WillThemeRoomFit(int floor, int x, int y, int minSize, int return 0; if ( !SkipThemeRoom(x, y) ) return 0; - memset(xArray, 0, 0x50u); - memset(yArray, 0, 0x50u); + memset(xArray, 0, sizeof(xArray)); + memset(yArray, 0, sizeof(yArray)); if ( maxSize > 0 ) { v10 = 40 * v7; @@ -1279,7 +1279,7 @@ void __fastcall DRLG_PlaceThemeRooms(int minSize, int maxSize, int floor, int fr maxSize2 = maxSize; minSize2 = minSize; themeCount = 0; - memset(themeLoc, 0, 0x14u); + memset(themeLoc, 0, sizeof(*themeLoc)); do { x = 0; diff --git a/Source/items.cpp b/Source/items.cpp index 12fbc9009..2385f5e43 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -647,7 +647,7 @@ void __cdecl InitItemGFX() ++v0; } while ( v0 < 35 ); - memset(UniqueItemFlag, 0, 0x200u); + memset(UniqueItemFlag, 0, sizeof(UniqueItemFlag)); } bool __fastcall ItemPlace(int xp, int yp) @@ -2914,7 +2914,7 @@ int __fastcall CheckUnique(int i, int lvl, int uper, bool recreate) if ( random(28, 100) > uper ) return -1; numu = 0; - memset(uok, 0, 0x80u); + memset(uok, 0, sizeof(uok)); if ( UniqueItemList[0].UIItemId == -1 ) return -1; diff --git a/Source/lighting.cpp b/Source/lighting.cpp index a9749e4c9..20f07eb7a 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -1373,11 +1373,11 @@ void __cdecl ToggleLighting() lightflag ^= 1; if ( lightflag ) { - memset(dTransVal, 0, 0x3100u); + memset(dTransVal, 0, sizeof(dTransVal)); } else { - memcpy(dTransVal, dTransVal2, 0x3100u); + memcpy(dTransVal, dTransVal2, sizeof(dTransVal)); for(i = 0; i < 4; i++) { if ( plr[i].plractive ) diff --git a/Source/objects.cpp b/Source/objects.cpp index 3a1a6885b..64a2ca3df 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -375,7 +375,7 @@ void __cdecl InitObjectGFX() unsigned char fileload[56]; // [esp+4h] [ebp-58h] char filestr[32]; // [esp+3Ch] [ebp-20h] - memset(fileload, 0, 0x38u); + memset(fileload, 0, sizeof(fileload)); if ( AllObjects[0].oload != -1 ) { v0 = AllObjects; diff --git a/Source/pfile.cpp b/Source/pfile.cpp index 04fea7a06..440163967 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -308,7 +308,7 @@ BOOL __stdcall pfile_ui_set_hero_infos(BOOL (__stdcall *ui_add_hero_info)(_uiher LPCSTR lpSrcStr; // [esp+7C0h] [ebp-8h] int save_num; // [esp+7C4h] [ebp-4h] - memset(hero_names, 0, 0x140u); + memset(hero_names, 0, sizeof(hero_names)); if ( (unsigned char)gbMaxPlayers > 1u ) { lpSrcStr = 0; diff --git a/Source/town.cpp b/Source/town.cpp index 85f8fe269..0caa7da75 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -1639,13 +1639,13 @@ void __fastcall CreateTown(int entry) ViewY = 68; } T_Pass3(); - memset(dTransVal, 0, 0x3100u); - memset(dFlags, 0, 0x3100u); - memset(dPlayer, 0, 0x3100u); - memset(dMonster, 0, 0xC400u); - memset(dObject, 0, 0x3100u); - memset(dItem, 0, 0x3100u); - memset(dArch, 0, 0x3100u); + memset(dTransVal, 0, sizeof(dTransVal)); + memset(dFlags, 0, sizeof(dFlags)); + memset(dPlayer, 0, sizeof(dPlayer)); + memset(dMonster, 0, sizeof(dMonster)); + memset(dObject, 0, sizeof(dObject)); + memset(dItem, 0, sizeof(dItem)); + memset(dArch, 0, sizeof(dArch)); v2 = dPiece; do {