parent
5dcda02b65
commit
3cda059669
|
@ -289,7 +289,18 @@ size_t CAmxxReader::GetBufferSize()
|
|||
m_pFile = NULL; \
|
||||
return m_Status; \
|
||||
}
|
||||
|
||||
#define DATAREAD_RELEASE(addr, itemsize, itemcount) \
|
||||
if (fread(addr, itemsize, itemcount, m_pFile) != static_cast<size_t>(itemcount)) \
|
||||
{ \
|
||||
if (feof(m_pFile)) \
|
||||
m_Status = Err_FileInvalid; \
|
||||
else \
|
||||
m_Status = Err_FileRead; \
|
||||
fclose(m_pFile); \
|
||||
m_pFile = NULL; \
|
||||
delete[] tempBuffer;\
|
||||
return m_Status; \
|
||||
}
|
||||
CAmxxReader::Error CAmxxReader::GetSection(void *buffer)
|
||||
{
|
||||
if (!m_pFile)
|
||||
|
@ -311,7 +322,7 @@ CAmxxReader::Error CAmxxReader::GetSection(void *buffer)
|
|||
PluginEntry *pe = &(m_Bh.plugins[m_Entry]);
|
||||
char *tempBuffer = new char[m_SectionLength + 1];
|
||||
fseek(m_pFile, pe->offs, SEEK_SET);
|
||||
DATAREAD((void *)tempBuffer, 1, m_SectionLength);
|
||||
DATAREAD_RELEASE((void *)tempBuffer, 1, m_SectionLength);
|
||||
uLongf destLen = GetBufferSize();
|
||||
int result = uncompress((Bytef *)buffer, &destLen, (Bytef *)tempBuffer, m_SectionLength);
|
||||
delete [] tempBuffer;
|
||||
|
@ -335,7 +346,7 @@ CAmxxReader::Error CAmxxReader::GetSection(void *buffer)
|
|||
// read the data to a temporary buffer
|
||||
char *tempBuffer = new char[m_SectionLength + 1];
|
||||
//fread(tempBuffer, sizeof(char), m_SectionLength, m_pFile);
|
||||
DATAREAD((void*)tempBuffer, 1, m_SectionLength);
|
||||
DATAREAD_RELEASE((void*)tempBuffer, 1, m_SectionLength);
|
||||
// decompress
|
||||
int result = uncompress((Bytef *)buffer, &destLen, (Bytef *)tempBuffer, m_SectionLength);
|
||||
delete [] tempBuffer;
|
||||
|
|
|
@ -96,12 +96,14 @@ static cell AMX_NATIVE_CALL read_file(AMX *amx, cell *params)
|
|||
{
|
||||
length = strlen(buffer);
|
||||
|
||||
if (buffer[length - 1] == '\n')
|
||||
if (length > 0)
|
||||
{
|
||||
if (buffer[length - 1] == '\n')
|
||||
buffer[--length] = '\0';
|
||||
|
||||
if (buffer[length - 1] == '\r')
|
||||
if (buffer[length - 1] == '\r')
|
||||
buffer[--length] = '\0';
|
||||
|
||||
}
|
||||
cell* textLen = get_amxaddr(amx, params[5]);
|
||||
*textLen = set_amxstring_utf8(amx, params[3], buffer, length, params[4]);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#define _MAX_PATH 250
|
||||
#endif
|
||||
#if !defined DIRSEP_CHAR
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE___
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
#define DIRSEP_CHAR '/'
|
||||
#elif defined macintosh
|
||||
#define DIRSEP_CHAR ':'
|
||||
|
|
|
@ -229,8 +229,8 @@ void ListboxItemSelected(HWND hDlg) {
|
|||
// Retrieve complete stats record of this position. Position in listbox should be same as rank in our records!
|
||||
RankSystem::RankStats* stats = g_rank.findEntryInRankByPos((int)nItem + 1);
|
||||
if (stats == NULL) {
|
||||
char msg[] = "Error: Couldn't find the record by position! (nItem = %d)";
|
||||
sprintf(msg, msg, nItem);
|
||||
char msg[512];
|
||||
sprintf(msg, "Error: Couldn't find the record by position! (nItem = %d)", nItem);
|
||||
MessageBox(hDlg, msg, "Oh fiddlesticks!", MB_OK);
|
||||
ClearStatsfields(hDlg);
|
||||
return;
|
||||
|
|
|
@ -307,10 +307,10 @@ static cell AMX_NATIVE_CALL custom_wpn_dmg(AMX *amx, cell *params){ // wid,att,v
|
|||
CPlayer* pAtt = GET_PLAYER_POINTER_I(att);
|
||||
CPlayer* pVic = GET_PLAYER_POINTER_I(vic);
|
||||
|
||||
if ( !pAtt ) pAtt = pVic;
|
||||
pVic->pEdict->v.dmg_inflictor = NULL;
|
||||
pAtt->saveHit( pVic , weapon , dmg, aim );
|
||||
|
||||
if ( !pAtt ) pAtt = pVic;
|
||||
int TA = 0;
|
||||
if ( (pVic->teamId == pAtt->teamId) && ( pVic != pAtt) )
|
||||
TA = 1;
|
||||
|
|
|
@ -506,7 +506,7 @@ static cell AMX_NATIVE_CALL objective_set_data(AMX *amx, cell *params){ // index
|
|||
GET_CP_PD(pent).model_body_neutral = ivalue;
|
||||
return 1;
|
||||
case CP_model_body_allies :
|
||||
GET_CP_PD(pent).model_body_axis = ivalue;
|
||||
GET_CP_PD(pent).model_body_allies = ivalue;
|
||||
return 1;
|
||||
case CP_model_body_axis :
|
||||
GET_CP_PD(pent).model_body_axis = ivalue;
|
||||
|
|
|
@ -387,12 +387,12 @@ static cell AMX_NATIVE_CALL cwpn_dmg(AMX *amx, cell *params)
|
|||
|
||||
pVic->pEdict->v.dmg_inflictor = NULL;
|
||||
|
||||
if(pAtt->index != pVic->index)
|
||||
pAtt->saveHit(pVic , weapon , dmg, aim);
|
||||
|
||||
if(!pAtt)
|
||||
pAtt = pVic;
|
||||
|
||||
if(pAtt->index != pVic->index)
|
||||
pAtt->saveHit(pVic , weapon , dmg, aim);
|
||||
|
||||
int TA = 0;
|
||||
|
||||
if((pVic->pEdict->v.team == pAtt->pEdict->v.team) && (pVic != pAtt))
|
||||
|
|
|
@ -1110,9 +1110,9 @@ static cell AMX_NATIVE_CALL set_es(AMX *amx, cell *params)
|
|||
es->vuser3.z = amx_ctof(ptr[2]);
|
||||
return 1;
|
||||
case ES_vUser4:
|
||||
es->vuser3.x = amx_ctof(ptr[0]);
|
||||
es->vuser3.y = amx_ctof(ptr[1]);
|
||||
es->vuser3.z = amx_ctof(ptr[2]);
|
||||
es->vuser4.x = amx_ctof(ptr[0]);
|
||||
es->vuser4.y = amx_ctof(ptr[1]);
|
||||
es->vuser4.z = amx_ctof(ptr[2]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -262,10 +262,10 @@ static cell AMX_NATIVE_CALL cwpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg
|
|||
CPlayer* pAtt = GET_PLAYER_POINTER_I(att);
|
||||
CPlayer* pVic = GET_PLAYER_POINTER_I(vic);
|
||||
|
||||
if ( !pAtt ) pAtt = pVic;
|
||||
pVic->pEdict->v.dmg_inflictor = NULL;
|
||||
pAtt->saveHit( pVic , weapon , dmg, aim );
|
||||
|
||||
if ( !pAtt ) pAtt = pVic;
|
||||
int TA = 0;
|
||||
if ( (pVic->pEdict->v.team == pAtt->pEdict->v.team ) && ( pVic != pAtt) )
|
||||
TA = 1;
|
||||
|
|
|
@ -47,7 +47,7 @@ bool isModuleActive(){
|
|||
|
||||
bool util_strncmp( const char *sz1, const char *sz2, int size){
|
||||
int i = 0;
|
||||
while( sz1[i] && i<=size){
|
||||
while( i<=size && sz1[i] ){
|
||||
if ( sz1[i] != sz2[i] )
|
||||
return false;
|
||||
i++;
|
||||
|
|
|
@ -295,10 +295,10 @@ static cell AMX_NATIVE_CALL cwpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg
|
|||
CPlayer* pAtt = GET_PLAYER_POINTER_I(att);
|
||||
CPlayer* pVic = GET_PLAYER_POINTER_I(vic);
|
||||
|
||||
if ( !pAtt ) pAtt = pVic;
|
||||
pVic->pEdict->v.dmg_inflictor = NULL;
|
||||
pAtt->saveHit( pVic , weapon , dmg, aim );
|
||||
|
||||
if ( !pAtt ) pAtt = pVic;
|
||||
int TA = 0;
|
||||
if ( (pVic->pEdict->v.team == pAtt->pEdict->v.team ) && ( pVic != pAtt) )
|
||||
TA = 1;
|
||||
|
|
|
@ -122,7 +122,8 @@ void Client_TSHealth_End(void* mValue){
|
|||
|
||||
weapon = 37; // throwing knife
|
||||
aim = pAttacker ? pAttacker->aiming : 0;
|
||||
pAttacker->saveHit( mPlayer , weapon , damage, aim );
|
||||
if (pAttacker)
|
||||
pAttacker->saveHit( mPlayer , weapon , damage, aim );
|
||||
}
|
||||
}
|
||||
if ( !pAttacker ) pAttacker = mPlayer;
|
||||
|
|
2
third_party/libmaxminddb/maxminddb.c
vendored
2
third_party/libmaxminddb/maxminddb.c
vendored
|
@ -831,7 +831,7 @@ MMDB_lookup_result_s MMDB_lookup_string(MMDB_s *const mmdb,
|
|||
struct addrinfo *addresses = NULL;
|
||||
*gai_error = resolve_any_address(ipstr, &addresses);
|
||||
|
||||
if (!*gai_error) {
|
||||
if (!*gai_error && NULL != addresses) {
|
||||
result = MMDB_lookup_sockaddr(mmdb, addresses->ai_addr, mmdb_error);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user