[Smipl-devel] SF.net SVN: smipl:[20] smipl-devel
Brought to you by:
the_student
From: <the...@us...> - 2009-08-01 12:49:29
|
Revision: 20 http://smipl.svn.sourceforge.net/smipl/?rev=20&view=rev Author: the_student Date: 2009-08-01 12:49:19 +0000 (Sat, 01 Aug 2009) Log Message: ----------- Fixed missing strcpy in About, and Help. Added strtoupper(char*) Made Help/About file access upper-case only Modified Paths: -------------- smipl-devel/Console.h smipl-devel/String.h Modified: smipl-devel/Console.h =================================================================== --- smipl-devel/Console.h 2009-08-01 10:42:16 UTC (rev 19) +++ smipl-devel/Console.h 2009-08-01 12:49:19 UTC (rev 20) @@ -53,6 +53,8 @@ } else { str=new char[strlen(command.argv[1])+strlen("/Help/")]; + strtoupper(command.argv[1]); + str=strdup("/Help/",command.argv[1]); if(PHYSFS_exists(str))PrintFile(str); else cout<<"Help for "<<command.argv[1]<<" not found!"<<endl; delete[]str; @@ -66,6 +68,8 @@ } else { str=new char[strlen(command.argv[1])+strlen("/About/")]; + strtoupper(command.argv[1]); + str=strdup("/About/",command.argv[1]); if(PHYSFS_exists(command.argv[1]))PrintFile(str); else cout<<"About "<<command.argv[1]<<" not found!"<<endl; delete[]str; Modified: smipl-devel/String.h =================================================================== --- smipl-devel/String.h 2009-08-01 10:42:16 UTC (rev 19) +++ smipl-devel/String.h 2009-08-01 12:49:19 UTC (rev 20) @@ -1,11 +1,19 @@ pthread_mutex_t do_split=PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t do_strdup=PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t do_strtoupper=PTHREAD_MUTEX_INITIALIZER; + char *strdup(char *a, char* b) { char* str=new char[strlen(a)+strlen(b)]; strcpy(str,a); strcat(str,a); return str; } +void strtoupper(char*a) { + pthread_mutex_lock(&do_strtoupper); + for(unsigned int i=0;a[i]!=0;i++) a[i]=toupper(a[i]); + pthread_mutex_unlock(&do_strtoupper); +} + bool isDelim(char a, bool disallow_spaces=true, bool disallow_comparison=true) { if(disallow_spaces)if(a==' ') return true; if(a=='\n') return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |