Skip to content

Commit

Permalink
优化指针有效性判定
Browse files Browse the repository at this point in the history
  • Loading branch information
lakwsh committed Sep 2, 2023
1 parent 9202357 commit 9f8e7bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions l4dtoolz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ void l4dtoolz::ServerActivate(edict_t *, int, int){
if(slots>=0) write_signature(rules_max_ptr, max_player_new);
}

// Linux: float GetTickInterval(void *);
float GetTickInterval(){
// Linux: static float GetTickInterval(void *);
static float GetTickInterval(){
static float tickinv = 1.0/tickrate;
return tickinv;
}

#ifdef WIN32
int PreAuth(const void *, int, uint64 steamID){
static int PreAuth(const void *, int, uint64 steamID){
#else
int PreAuth(void *, const void *, int, uint64 steamID){
static int PreAuth(void *, const void *, int, uint64 steamID){
#endif
if(!steamID){
Msg("[L4DToolZ] invalid steamID.\n");
Expand Down Expand Up @@ -190,8 +190,8 @@ void l4dtoolz::OnAntiSharing(IConVar *var, const char *pOldValue, float flOldVal
}
ConVar sv_anti_sharing("sv_anti_sharing", "0", 0, "No family sharing", true, 0, true, 1, l4dtoolz::OnAntiSharing);

// Linux: void ReplyReservationRequest(void *, void *, void *);
void ReplyReservationRequest(void *, void *){
// Linux: static void ReplyReservationRequest(void *, void *, void *);
static void ReplyReservationRequest(void *, void *){
return;
}

Expand Down
5 changes: 3 additions & 2 deletions l4dtoolz.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

#include "signature.h"

#define BINMSIZE 0x1400000 // 20M
#define CHKPTR(P, V) (P && !((uint)(P)&V))
#define CMPPTR(P, V, C) (CHKPTR(P, V) && !((uint)P>>24^(uint)C>>24))
#define CMPPTR(P, V, C) (CHKPTR(P, V) && abs((int)P-(int)C)<BINMSIZE)
#define READCALL(P) ((P+5-1)+*(int *)(P))
#define CHKVAL \
int new_value = ((ConVar *)var)->GetInt(); \
Expand All @@ -32,7 +33,7 @@ class l4dtoolz:public IServerPluginCallbacks{
virtual void Unload();
virtual void Pause(){ }
virtual void UnPause(){ }
virtual const char *GetPluginDescription(){ return "L4DToolZ v2.2.4p1, https://github.com/lakwsh/l4dtoolz"; }
virtual const char *GetPluginDescription(){ return "L4DToolZ v2.2.4p3, https://github.com/lakwsh/l4dtoolz"; }
virtual void LevelInit(char const *pMapName){ }
virtual void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
virtual void GameFrame(bool simulating){ }
Expand Down

0 comments on commit 9f8e7bf

Please sign in to comment.