Skip to content

Commit c1e0f24

Browse files
committed
Fix PVS-Studio warning №V802
V802 On 64-bit platform, structure size can be reduced from 48 to 40 bytes by rearranging the fields according to their sizes in decreasing order. Also replace one LPCSTR to pcstr
1 parent 4fa8d8f commit c1e0f24

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/xrCore/LocatorAPI.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class XRCORE_API CLocatorAPI
4444
public:
4545
struct file
4646
{
47-
LPCSTR name; // low-case name
47+
pcstr name; // low-case name
4848
u32 vfs; // 0xffffffff - standart file
4949
u32 crc; // contents CRC
5050
u32 ptr; // pointer inside vfs
@@ -55,12 +55,13 @@ class XRCORE_API CLocatorAPI
5555

5656
struct archive
5757
{
58+
u32 size;
59+
u32 vfs_idx;
5860
shared_str path;
5961
void *hSrcFile, *hSrcMap;
60-
u32 size;
6162
CInifile* header;
62-
u32 vfs_idx;
63-
archive() : hSrcFile(nullptr), hSrcMap(nullptr), header(nullptr), size(0), vfs_idx(u32(-1)) {}
63+
64+
archive() : size(0), vfs_idx(u32(-1)), hSrcFile(nullptr), hSrcMap(nullptr), header(nullptr) {}
6465
void open();
6566
void close();
6667
};

src/xrGame/ai/monsters/ai_monster_defs.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,16 @@ using AA_VECTOR = xr_vector<SAAParam>;
375375

376376
struct SCurrentAnimationInfo
377377
{
378-
shared_str name;
379-
380378
u8 index;
381-
382379
TTime time_started;
380+
float speed_change_vel;
381+
382+
private:
383+
EMotionAnim motion;
384+
385+
public:
386+
shared_str name;
387+
CBlend* blend;
383388

384389
struct
385390
{
@@ -392,21 +397,18 @@ struct SCurrentAnimationInfo
392397
{
393398
target = v;
394399
VERIFY2(_abs(v) < 1000, "_set_target(). monster speed is too big");
400+
395401
}
396402
IC float _get_current() { return current; }
397403
IC float _get_target() { return target; }
404+
398405
private:
399406
float current;
400407
float target;
401408
} speed;
402409

403-
float speed_change_vel;
404-
CBlend* blend;
405-
406410
void set_motion(EMotionAnim new_motion);
407411
EMotionAnim get_motion() const { return motion; }
408-
private:
409-
EMotionAnim motion;
410412
};
411413

412414
//////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)