Migrate extensions to common AMTL string funcs (#785)
This commit is contained in:
committed by
Kyle Sanderson
parent
6c7e29cbdb
commit
5611ec54a2
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <IShareSys.h>
|
||||
#include <ILibrarySys.h>
|
||||
#include "am-string.h"
|
||||
|
||||
/**
|
||||
* @file IExtensionSys.h
|
||||
@@ -443,7 +444,7 @@ namespace SourceMod
|
||||
{ \
|
||||
if (errbuf) \
|
||||
{ \
|
||||
size_t len = snprintf(errbuf, \
|
||||
size_t len = ke::SafeSprintf(errbuf, \
|
||||
errsize, \
|
||||
"Could not find interface: %s (version: %d)", \
|
||||
SM_IFACEPAIR(prefix)); \
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "smsdk_ext.h"
|
||||
#include "am-string.h"
|
||||
|
||||
/**
|
||||
* @file smsdk_ext.cpp
|
||||
@@ -128,7 +129,7 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
snprintf(error, maxlength, "Metamod attach failed");
|
||||
ke::SafeStrcpy(error, maxlength, "Metamod attach failed");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -376,7 +377,7 @@ bool SDKExtension::Unload(char *error, size_t maxlen)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
snprintf(error, maxlen, "This extension must be unloaded by SourceMod.");
|
||||
ke::SafeStrcpy(error, maxlen, "This extension must be unloaded by SourceMod.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -390,7 +391,7 @@ bool SDKExtension::Pause(char *error, size_t maxlen)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
snprintf(error, maxlen, "This extension must be paused by SourceMod.");
|
||||
ke::SafeStrcpy(error, maxlen, "This extension must be paused by SourceMod.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -406,7 +407,7 @@ bool SDKExtension::Unpause(char *error, size_t maxlen)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
snprintf(error, maxlen, "This extension must be unpaused by SourceMod.");
|
||||
ke::SafeStrcpy(error, maxlen, "This extension must be unpaused by SourceMod.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
+3
-2
@@ -43,6 +43,7 @@
|
||||
#include <sp_vm_api.h>
|
||||
#include <sm_platform.h>
|
||||
#include <ISourceMod.h>
|
||||
#include "am-string.h"
|
||||
#if defined SMEXT_ENABLE_FORWARDSYS
|
||||
#include <IForwardSys.h>
|
||||
#endif //SMEXT_ENABLE_FORWARDSYS
|
||||
@@ -327,7 +328,7 @@ extern IServerGameDLL *gamedll;
|
||||
{ \
|
||||
if (error != NULL && maxlength) \
|
||||
{ \
|
||||
size_t len = snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \
|
||||
size_t len = ke::SafeSprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \
|
||||
if (len >= maxlength) \
|
||||
{ \
|
||||
error[maxlength - 1] = '\0'; \
|
||||
@@ -344,7 +345,7 @@ extern IServerGameDLL *gamedll;
|
||||
{ \
|
||||
if (error != NULL && maxlength) \
|
||||
{ \
|
||||
size_t len = snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \
|
||||
size_t len = ke::SafeSprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \
|
||||
if (len >= maxlength) \
|
||||
{ \
|
||||
error[maxlength - 1] = '\0'; \
|
||||
|
||||
Reference in New Issue
Block a user