load_abc.cpp | load_abc.cpp | |||
---|---|---|---|---|
skipping to change at line 271 | skipping to change at line 271 | |||
static void abc_add_event(ABCHANDLE *h, ABCTRACK *tp, ABCEVENT *e); | static void abc_add_event(ABCHANDLE *h, ABCTRACK *tp, ABCEVENT *e); | |||
static void abc_add_setloop(ABCHANDLE *h, ABCTRACK *tp, uint32_t tracktime) ; | static void abc_add_setloop(ABCHANDLE *h, ABCTRACK *tp, uint32_t tracktime) ; | |||
static void abc_add_setjumploop(ABCHANDLE *h, ABCTRACK *tp, uint32_t trackt ime, ABCEVENT_JUMPTYPE j); | static void abc_add_setjumploop(ABCHANDLE *h, ABCTRACK *tp, uint32_t trackt ime, ABCEVENT_JUMPTYPE j); | |||
static uint32_t abc_pattracktime(ABCHANDLE *h, uint32_t tracktime); | static uint32_t abc_pattracktime(ABCHANDLE *h, uint32_t tracktime); | |||
static int abc_patno(ABCHANDLE *h, uint32_t tracktime); | static int abc_patno(ABCHANDLE *h, uint32_t tracktime); | |||
#ifndef HAVE_SETENV | #ifndef HAVE_SETENV | |||
static void setenv(const char *name, const char *value, int overwrite) | static void setenv(const char *name, const char *value, int overwrite) | |||
{ | { | |||
int len = strlen(name)+1+strlen(value)+1; | int len = strlen(name)+1+strlen(value)+1; | |||
char *str = (char *)alloca(len); | char *str = (char *)malloc(len); | |||
sprintf(str, "%s=%s", name, value); | sprintf(str, "%s=%s", name, value); | |||
putenv(str); | putenv(str); | |||
free(str); | ||||
} | } | |||
#endif | #endif | |||
static int abc_isvalidchar(char c) { | static int abc_isvalidchar(char c) { | |||
return(isalpha(c) || isdigit(c) || isspace(c) || c == '%' || c == ': '); | return(isalpha(c) || isdigit(c) || isspace(c) || c == '%' || c == ': '); | |||
} | } | |||
static void abc_message(const char *s1, const char *s2) | static void abc_message(const char *s1, const char *s2) | |||
{ | { | |||
char txt[256]; | char txt[256]; | |||
skipping to change at line 2295 | skipping to change at line 2296 | |||
// ======================================================================== ============= | // ======================================================================== ============= | |||
#ifdef NEWMIKMOD | #ifdef NEWMIKMOD | |||
BOOL ABC_Test(MMSTREAM *mmfile) | BOOL ABC_Test(MMSTREAM *mmfile) | |||
#else | #else | |||
BOOL CSoundFile::TestABC(const BYTE *lpStream, DWORD dwMemLength) | BOOL CSoundFile::TestABC(const BYTE *lpStream, DWORD dwMemLength) | |||
#endif | #endif | |||
// ======================================================================== ============= | // ======================================================================== ============= | |||
{ | { | |||
char id[128]; | char id[128]; | |||
bool hasK = false, hasX = false; | ||||
// scan file for first K: line (last in header) | // scan file for first K: line (last in header) | |||
#ifdef NEWMIKMOD | #ifdef NEWMIKMOD | |||
_mm_fseek(mmfile,0,SEEK_SET); | _mm_fseek(mmfile,0,SEEK_SET); | |||
while(abc_fgets(mmfile,id,128)) { | while(abc_fgets(mmfile,id,128)) { | |||
#else | #else | |||
MMFILE mmfile; | MMFILE mmfile; | |||
mmfile.mm = (char *)lpStream; | mmfile.mm = (char *)lpStream; | |||
mmfile.sz = dwMemLength; | mmfile.sz = dwMemLength; | |||
mmfseek(&mmfile,0,SEEK_SET); | mmfseek(&mmfile,0,SEEK_SET); | |||
while(abc_fgets(&mmfile,id,128)) { | while(abc_fgets(&mmfile,id,128)) { | |||
#endif | #endif | |||
if (id[0] == 0) continue; // blank line. | if (id[0] == 0) continue; // blank line. | |||
if (id[0] == '%' && id[1] != '%') continue; // comment line. | ||||
if (!abc_isvalidchar(id[0]) || !abc_isvalidchar(id[1])) { | if (!abc_isvalidchar(id[0]) || !abc_isvalidchar(id[1])) { | |||
return(0); // probably not an ABC. | return(0); // probably not an ABC. | |||
} | } | |||
if(id[0]=='K' | if(id[0]=='K' | |||
&& id[1]==':' | && id[1]==':' | |||
&& (isalpha(id[2]) || isspace(id[2])) ) hasK = true; | && (isalpha(id[2]) || isspace(id[2])) ) return 1; | |||
if (id[0]=='X' | ||||
&& id[1]== ':' | ||||
&& (abc_isvalidchar(id[2])) ) hasX = true; | ||||
if (hasK && hasX) { return 1; printf("valid\n"); } | ||||
} | } | |||
return 0; | return 0; | |||
} | } | |||
// ======================================================================== ============= | // ======================================================================== ============= | |||
static ABCHANDLE *ABC_Init(void) | static ABCHANDLE *ABC_Init(void) | |||
{ | { | |||
ABCHANDLE *retval; | ABCHANDLE *retval; | |||
char *p; | char *p; | |||
char buf[10]; | char buf[10]; | |||
End of changes. 6 change blocks. | ||||
9 lines changed or deleted | 4 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |