Err, fixed these
This commit is contained in:
		@@ -69,8 +69,8 @@ int  CPluginMngr::loadPluginsFromFile( const char* filename )
 | 
			
		||||
 | 
			
		||||
	while ( !feof(fp) ) 
 | 
			
		||||
	{
 | 
			
		||||
		*pluginName = 0;
 | 
			
		||||
		*debug = 0;
 | 
			
		||||
		pluginName[0] = '\0';
 | 
			
		||||
		debug[0] = '\0';
 | 
			
		||||
		debugFlag = 0;
 | 
			
		||||
		line.clear();
 | 
			
		||||
		line._fread(fp);
 | 
			
		||||
 
 | 
			
		||||
@@ -39,9 +39,7 @@ public:
 | 
			
		||||
	String() 
 | 
			
		||||
	{
 | 
			
		||||
		v = NULL;
 | 
			
		||||
		mSize = 0;
 | 
			
		||||
		cSize = 0;
 | 
			
		||||
		Grow(2);
 | 
			
		||||
		a_size = 0;
 | 
			
		||||
		assign("");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -54,41 +52,38 @@ public:
 | 
			
		||||
	String(const char *src) 
 | 
			
		||||
	{
 | 
			
		||||
		v = NULL; 
 | 
			
		||||
		mSize = 0; 
 | 
			
		||||
		cSize = 0; assign(src); 
 | 
			
		||||
		a_size = 0;
 | 
			
		||||
		assign(src); 
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	String(String &src) 
 | 
			
		||||
	{
 | 
			
		||||
		v = NULL;
 | 
			
		||||
		mSize = 0;
 | 
			
		||||
		cSize = 0;
 | 
			
		||||
		a_size = 0;
 | 
			
		||||
		assign(src.c_str()); 
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const char *c_str() { return v?v:""; }
 | 
			
		||||
	const char *c_str() const { return v?v:""; }
 | 
			
		||||
	const char *c_str() { return v; }
 | 
			
		||||
 | 
			
		||||
	const char *c_str() const { return v; }
 | 
			
		||||
 | 
			
		||||
	void append(const char *t)
 | 
			
		||||
	{
 | 
			
		||||
		Grow(cSize + strlen(t) + 1);
 | 
			
		||||
		Grow(strlen(v) + strlen(t) + 1);
 | 
			
		||||
		strcat(v, t);
 | 
			
		||||
		cSize = strlen(v);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void append(const char c)
 | 
			
		||||
	{
 | 
			
		||||
		Grow(cSize + 2);
 | 
			
		||||
		v[cSize] = c;
 | 
			
		||||
		v[++cSize] = 0;
 | 
			
		||||
		size_t len = strlen(v);
 | 
			
		||||
		Grow(len + 2);
 | 
			
		||||
		v[len] = c;
 | 
			
		||||
		v[len + 1] = '\0';
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void append(String &d)
 | 
			
		||||
	{
 | 
			
		||||
		const char *t = d.c_str();
 | 
			
		||||
		Grow(cSize + strlen(t));
 | 
			
		||||
		strcat(v, t);
 | 
			
		||||
		cSize = strlen(v);
 | 
			
		||||
		append(d.c_str());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void assign(const String &src)
 | 
			
		||||
@@ -100,79 +95,51 @@ public:
 | 
			
		||||
	{
 | 
			
		||||
		if (!d)
 | 
			
		||||
		{
 | 
			
		||||
			Grow(1);
 | 
			
		||||
			cSize = 0;
 | 
			
		||||
			strcpy(v, "");
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		Grow(strlen(d));
 | 
			
		||||
		if (v)
 | 
			
		||||
		{
 | 
			
		||||
			strcpy(v, d);
 | 
			
		||||
			cSize = strlen(v);
 | 
			
		||||
			clear();
 | 
			
		||||
		} else {
 | 
			
		||||
			cSize = 0;
 | 
			
		||||
			Grow(strlen(d) + 1, false);
 | 
			
		||||
			strcpy(v, d);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void clear()
 | 
			
		||||
	{
 | 
			
		||||
		if (v)
 | 
			
		||||
		{
 | 
			
		||||
			v[0] = 0;
 | 
			
		||||
			cSize = 0;
 | 
			
		||||
		}
 | 
			
		||||
		v[0] = '\0';
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	int compare (const char *d)
 | 
			
		||||
	{
 | 
			
		||||
		if (v) {
 | 
			
		||||
			if (d) {
 | 
			
		||||
				return strcmp(v, d);
 | 
			
		||||
			} else {
 | 
			
		||||
				return strlen(v);
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			if (d) {
 | 
			
		||||
				return strlen(d);
 | 
			
		||||
			} else {
 | 
			
		||||
				return 0;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return strcmp(v, d);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//Added this for amxx inclusion
 | 
			
		||||
	bool empty()
 | 
			
		||||
	{
 | 
			
		||||
		if (!v || !cSize)
 | 
			
		||||
		if (v[0] == '\0')
 | 
			
		||||
			return true;
 | 
			
		||||
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	int size()
 | 
			
		||||
	size_t size()
 | 
			
		||||
	{
 | 
			
		||||
		if (!v)
 | 
			
		||||
			return 0;
 | 
			
		||||
		return cSize;
 | 
			
		||||
		return strlen(v);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const char * _fread(FILE *fp)
 | 
			
		||||
	{
 | 
			
		||||
		Grow(512);
 | 
			
		||||
		char * ret = fgets(v, 511, fp);
 | 
			
		||||
		cSize = strlen(v);
 | 
			
		||||
		Grow(512, false);
 | 
			
		||||
		char *ret = fgets(v, 511, fp);
 | 
			
		||||
		return ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	int find(const char c, int index = 0)
 | 
			
		||||
	{
 | 
			
		||||
		if (!v)
 | 
			
		||||
			return npos;
 | 
			
		||||
		if (index >= (int)cSize || index < 0)
 | 
			
		||||
		size_t len = strlen(v);
 | 
			
		||||
		if (index >= (int)len || index < 0)
 | 
			
		||||
			return npos;
 | 
			
		||||
		unsigned int i = 0;
 | 
			
		||||
		for (i=index; i<cSize; i++)
 | 
			
		||||
		for (i=index; i<(int)len; i++)
 | 
			
		||||
		{
 | 
			
		||||
			if (v[i] == c)
 | 
			
		||||
			{
 | 
			
		||||
@@ -197,12 +164,11 @@ public:
 | 
			
		||||
	
 | 
			
		||||
	void trim()
 | 
			
		||||
	{
 | 
			
		||||
		if (!v)
 | 
			
		||||
			return;
 | 
			
		||||
		unsigned int i = 0;
 | 
			
		||||
		unsigned int j = 0;
 | 
			
		||||
		size_t len = strlen(v);
 | 
			
		||||
 | 
			
		||||
		if (cSize == 1)
 | 
			
		||||
		if (len == 1)
 | 
			
		||||
		{
 | 
			
		||||
			if (is_space(v[i]))
 | 
			
		||||
			{
 | 
			
		||||
@@ -215,9 +181,9 @@ public:
 | 
			
		||||
 | 
			
		||||
		if (is_space(c0))
 | 
			
		||||
		{
 | 
			
		||||
			for (i=0; i<cSize; i++)
 | 
			
		||||
			for (i=0; i<len; i++)
 | 
			
		||||
			{
 | 
			
		||||
				if (!is_space(v[i]) || (is_space(v[i]) && ((unsigned char)i==cSize-1)))
 | 
			
		||||
				if (!is_space(v[i]) || (is_space(v[i]) && ((unsigned char)i==len-1)))
 | 
			
		||||
				{
 | 
			
		||||
					erase(0, i);
 | 
			
		||||
					break;
 | 
			
		||||
@@ -225,16 +191,16 @@ public:
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		cSize = strlen(v);
 | 
			
		||||
		len = strlen(v);
 | 
			
		||||
 | 
			
		||||
		if (cSize < 1)
 | 
			
		||||
		if (len < 1)
 | 
			
		||||
		{
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (is_space(v[cSize-1]))
 | 
			
		||||
		if (is_space(v[len-1]))
 | 
			
		||||
		{
 | 
			
		||||
			for (i=cSize-1; i>=0; i--)
 | 
			
		||||
			for (i=len-1; i>=0; i--)
 | 
			
		||||
			{
 | 
			
		||||
				if (!is_space(v[i])
 | 
			
		||||
					|| (is_space(v[i]) && i==0))
 | 
			
		||||
@@ -246,7 +212,7 @@ public:
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (cSize == 1)
 | 
			
		||||
		if (len == 1)
 | 
			
		||||
		{
 | 
			
		||||
			if (is_space(v[0]))
 | 
			
		||||
			{
 | 
			
		||||
@@ -256,21 +222,20 @@ public:
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	String & erase(unsigned int start, int num = npos)
 | 
			
		||||
	void erase(unsigned int start, int num = npos)
 | 
			
		||||
	{
 | 
			
		||||
		if (!v)
 | 
			
		||||
			return (*this);
 | 
			
		||||
		unsigned int i = 0;
 | 
			
		||||
		size_t len = size();
 | 
			
		||||
		//check for bounds
 | 
			
		||||
		if (num == npos || start+num > cSize-num+1)
 | 
			
		||||
			num = cSize - start;
 | 
			
		||||
		if (num == npos || start+num > len-num+1)
 | 
			
		||||
			num = len - start;
 | 
			
		||||
		//do the erasing
 | 
			
		||||
		bool copyflag = false;
 | 
			
		||||
		for (i=0; i<cSize; i++)
 | 
			
		||||
		for (i=0; i<len; i++)
 | 
			
		||||
		{
 | 
			
		||||
			if (i>=start && i<start+num)
 | 
			
		||||
			{
 | 
			
		||||
				if (i+num < cSize)
 | 
			
		||||
				if (i+num < len)
 | 
			
		||||
				{	
 | 
			
		||||
					v[i] = v[i+num];
 | 
			
		||||
				} else {
 | 
			
		||||
@@ -278,7 +243,7 @@ public:
 | 
			
		||||
				}
 | 
			
		||||
				copyflag = true;
 | 
			
		||||
			} else if (copyflag) {
 | 
			
		||||
				if (i+num < cSize)
 | 
			
		||||
				if (i+num < len)
 | 
			
		||||
				{
 | 
			
		||||
					v[i] = v[i+num];
 | 
			
		||||
				} else {
 | 
			
		||||
@@ -286,51 +251,45 @@ public:
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		cSize -= num;
 | 
			
		||||
		v[cSize] = 0;
 | 
			
		||||
 | 
			
		||||
		return (*this);
 | 
			
		||||
		len -= num;
 | 
			
		||||
		v[len] = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	String substr(unsigned int index, int num = npos)
 | 
			
		||||
	{
 | 
			
		||||
		String ns;
 | 
			
		||||
 | 
			
		||||
		if (index >= cSize || !v)
 | 
			
		||||
		size_t len = size();
 | 
			
		||||
 | 
			
		||||
		if (index >= len || !v)
 | 
			
		||||
			return ns;
 | 
			
		||||
		
 | 
			
		||||
		if (num == npos)
 | 
			
		||||
		{
 | 
			
		||||
			num = cSize - index;
 | 
			
		||||
		} else if (index+num >= cSize) {
 | 
			
		||||
			num = cSize - index;
 | 
			
		||||
			num = len - index;
 | 
			
		||||
		} else if (index+num >= len) {
 | 
			
		||||
			num = len - index;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		unsigned int i = 0, j=0;
 | 
			
		||||
		char *s = new char[cSize+1];
 | 
			
		||||
		unsigned int nslen = num + 2;
 | 
			
		||||
 | 
			
		||||
		ns.Grow(nslen);
 | 
			
		||||
 | 
			
		||||
		for (i=index; i<index+num; i++)
 | 
			
		||||
		{
 | 
			
		||||
			s[j++] = v[i];
 | 
			
		||||
		}
 | 
			
		||||
		s[j] = 0;
 | 
			
		||||
 | 
			
		||||
		ns.assign(s);
 | 
			
		||||
 | 
			
		||||
		delete [] s;
 | 
			
		||||
			ns.append(v[i]);
 | 
			
		||||
 | 
			
		||||
		return ns;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void toLower()
 | 
			
		||||
	{
 | 
			
		||||
		if (!v)
 | 
			
		||||
			return;
 | 
			
		||||
		unsigned int i = 0;
 | 
			
		||||
		for (i=0; i<cSize; i++)
 | 
			
		||||
		size_t len = strlen(v);
 | 
			
		||||
		for (i=0; i<len; i++)
 | 
			
		||||
		{
 | 
			
		||||
			if (v[i] >= 65 && v[i] <= 90)
 | 
			
		||||
				v[i] |= 32;
 | 
			
		||||
				v[i] &= ~(1<<5);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -349,7 +308,7 @@ public:
 | 
			
		||||
 | 
			
		||||
	char operator [] (unsigned int index)
 | 
			
		||||
	{
 | 
			
		||||
		if (index > cSize)
 | 
			
		||||
		if (index > size())
 | 
			
		||||
		{
 | 
			
		||||
			return -1;
 | 
			
		||||
		} else {
 | 
			
		||||
@@ -359,7 +318,7 @@ public:
 | 
			
		||||
 | 
			
		||||
	int at(int a)
 | 
			
		||||
	{
 | 
			
		||||
		if (a < 0 || a >= (int)cSize)
 | 
			
		||||
		if (a < 0 || a >= (int)size())
 | 
			
		||||
			return -1;
 | 
			
		||||
 | 
			
		||||
		return v[a];
 | 
			
		||||
@@ -367,7 +326,7 @@ public:
 | 
			
		||||
 | 
			
		||||
	bool at(int at, char c)
 | 
			
		||||
	{
 | 
			
		||||
		if (at < 0 || at >= (int)cSize)
 | 
			
		||||
		if (at < 0 || at >= (int)size())
 | 
			
		||||
			return false;
 | 
			
		||||
 | 
			
		||||
		v[at] = c;
 | 
			
		||||
@@ -376,27 +335,20 @@ public:
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	void Grow(unsigned int d)
 | 
			
		||||
	void Grow(unsigned int d, bool copy=true)
 | 
			
		||||
	{
 | 
			
		||||
		if (d<1)
 | 
			
		||||
		if (d <= a_size)
 | 
			
		||||
			return;
 | 
			
		||||
		if (d > mSize)
 | 
			
		||||
		{
 | 
			
		||||
			mSize = d + 16;	// allocate a buffer
 | 
			
		||||
			char *t = new char[d+1];
 | 
			
		||||
			if (v) {
 | 
			
		||||
				strcpy(t, v);
 | 
			
		||||
				t[cSize] = 0;
 | 
			
		||||
				delete [] v;
 | 
			
		||||
			}
 | 
			
		||||
			v = t;
 | 
			
		||||
			mSize = d;
 | 
			
		||||
		}
 | 
			
		||||
		char *n = new char[d + 1];
 | 
			
		||||
		if (copy)
 | 
			
		||||
			strcpy(n, v);
 | 
			
		||||
		delete [] v;
 | 
			
		||||
		v = n;
 | 
			
		||||
		a_size = d + 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	char *v;
 | 
			
		||||
	unsigned int mSize;
 | 
			
		||||
	unsigned int cSize;
 | 
			
		||||
	unsigned int a_size;
 | 
			
		||||
public:
 | 
			
		||||
	static const int npos = -1;
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -255,7 +255,10 @@
 | 
			
		||||
				SuppressStartupBanner="TRUE"
 | 
			
		||||
				AdditionalLibraryDirectories="..\extra\lib_win32"
 | 
			
		||||
				ModuleDefinitionFile=""
 | 
			
		||||
				GenerateDebugInformation="TRUE"
 | 
			
		||||
				ProgramDatabaseFile=".\memtestrelease/amxx_mm.pdb"
 | 
			
		||||
				GenerateMapFile="TRUE"
 | 
			
		||||
				MapExports="TRUE"
 | 
			
		||||
				ImportLibrary=".\memtestrelease/amxx_mm.lib"/>
 | 
			
		||||
			<Tool
 | 
			
		||||
				Name="VCMIDLTool"
 | 
			
		||||
@@ -392,7 +395,9 @@
 | 
			
		||||
				SuppressStartupBanner="TRUE"
 | 
			
		||||
				AdditionalLibraryDirectories="..\extra\lib_win32"
 | 
			
		||||
				ModuleDefinitionFile=""
 | 
			
		||||
				GenerateDebugInformation="TRUE"
 | 
			
		||||
				ProgramDatabaseFile=".\jitrelease/amxx_mm.pdb"
 | 
			
		||||
				GenerateMapFile="FALSE"
 | 
			
		||||
				ImportLibrary=".\jitrelease/amxx_mm.lib"/>
 | 
			
		||||
			<Tool
 | 
			
		||||
				Name="VCMIDLTool"
 | 
			
		||||
@@ -460,6 +465,7 @@
 | 
			
		||||
				SuppressStartupBanner="TRUE"
 | 
			
		||||
				AdditionalLibraryDirectories="..\extra\lib_win32"
 | 
			
		||||
				ModuleDefinitionFile=""
 | 
			
		||||
				GenerateDebugInformation="TRUE"
 | 
			
		||||
				ProgramDatabaseFile=".\jitmemtestrelease/amxx_mm.pdb"
 | 
			
		||||
				ImportLibrary=".\jitmemtestrelease/amxx_mm.lib"/>
 | 
			
		||||
			<Tool
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user