summaryrefslogtreecommitdiff
path: root/plugins/adplug/adplug/sa2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/adplug/adplug/sa2.cpp')
-rw-r--r--plugins/adplug/adplug/sa2.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/plugins/adplug/adplug/sa2.cpp b/plugins/adplug/adplug/sa2.cpp
index 8d81e9c1..bdf1b22c 100644
--- a/plugins/adplug/adplug/sa2.cpp
+++ b/plugins/adplug/adplug/sa2.cpp
@@ -20,7 +20,6 @@
* SAdT Loader by Mamiya <mamiya@users.sourceforge.net>
*/
-#include <cstring>
#include <stdio.h>
#include <string.h>
@@ -32,7 +31,7 @@ CPlayer *Csa2Loader::factory(Copl *newopl)
return new Csa2Loader(newopl);
}
-bool Csa2Loader::load(const std::string &filename, const CFileProvider &fp)
+bool Csa2Loader::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
struct {
@@ -161,7 +160,7 @@ bool Csa2Loader::load(const std::string &filename, const CFileProvider &fp)
AdPlug_LogWrite("Csa2Loader::load(\"%s\"): sat_type = %x, nop = %d, "
"length = %d, restartpos = %d, activechan = %x, bpm = %d\n",
- filename.c_str(), sat_type, nop, length, restartpos, activechan, bpm);
+ filename, sat_type, nop, length, restartpos, activechan, bpm);
// track data
if(sat_type & HAS_OLDPATTERNS) {
@@ -227,15 +226,13 @@ bool Csa2Loader::load(const std::string &filename, const CFileProvider &fp)
return true;
}
-std::string Csa2Loader::gettype()
+const char * Csa2Loader::gettype()
{
- char tmpstr[40];
-
- sprintf(tmpstr,"Surprise! Adlib Tracker 2 (version %d)",header.version);
- return std::string(tmpstr);
+ snprintf(filetype,sizeof(filetype),"Surprise! Adlib Tracker 2 (version %d)",header.version);
+ return filetype;
}
-std::string Csa2Loader::gettitle()
+const char * Csa2Loader::gettitle()
{
char bufinst[29*17],buf[18];
int i,ptr;
@@ -256,8 +253,12 @@ std::string Csa2Loader::gettitle()
strcat(bufinst,buf);
}
- if(strchr(bufinst,'"'))
- return std::string(bufinst,strchr(bufinst,'"')-bufinst+1,strrchr(bufinst,'"')-strchr(bufinst,'"')-1);
- else
- return std::string();
+ if(strchr(bufinst,'"')) {
+ const char *pos = strchr(bufinst,'"')+1;
+ int len = strrchr(bufinst,'"')-pos;
+ memcpy (title,pos,len);
+ title[len] = 0;
+ return title;
+ }
+ return "";
}