diff --git a/polymer/eduke32/source/jaudiolib/src/_multivc.h b/polymer/eduke32/source/jaudiolib/src/_multivc.h index 5562b79fb..c9a3c37e3 100644 --- a/polymer/eduke32/source/jaudiolib/src/_multivc.h +++ b/polymer/eduke32/source/jaudiolib/src/_multivc.h @@ -194,7 +194,7 @@ extern const int16_t *MV_RightVolume; extern int32_t MV_SampleSize; extern int32_t MV_RightChannelOffset; -#define loopStartTagCount 2 +#define loopStartTagCount 3 extern const char *loopStartTags[loopStartTagCount]; #define loopEndTagCount 2 extern const char *loopEndTags[loopEndTagCount]; diff --git a/polymer/eduke32/source/jaudiolib/src/flac.c b/polymer/eduke32/source/jaudiolib/src/flac.c index 82cd4c9e4..75ede1b45 100644 --- a/polymer/eduke32/source/jaudiolib/src/flac.c +++ b/polymer/eduke32/source/jaudiolib/src/flac.c @@ -553,7 +553,6 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t lo if (tags->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { FLAC__uint32 comment; - uint8_t loopTagCount; for (comment = 0; comment < tags->data.vorbis_comment.num_comments; ++comment) { const char *entry = (const char *)tags->data.vorbis_comment.comments[comment].entry; @@ -563,20 +562,26 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t lo const size_t field = value - entry; value += 1; - for (loopTagCount = 0; loopTagCount < loopStartTagCount && vc_loopstart == NULL; - ++loopTagCount) - if (strncasecmp(entry, loopStartTags[loopTagCount], field) == 0) + for (size_t t = 0; t < loopStartTagCount && vc_loopstart == NULL; ++t) + { + char const * const tag = loopStartTags[t]; + if (field == strlen(tag) && strncasecmp(entry, tag, field) == 0) vc_loopstart = strdup(value); + } - for (loopTagCount = 0; loopTagCount < loopEndTagCount && vc_loopend == NULL; - ++loopTagCount) - if (strncasecmp(entry, loopEndTags[loopTagCount], field) == 0) + for (size_t t = 0; t < loopEndTagCount && vc_loopend == NULL; ++t) + { + char const * const tag = loopEndTags[t]; + if (field == strlen(tag) && strncasecmp(entry, tag, field) == 0) vc_loopend = strdup(value); + } - for (loopTagCount = 0; loopTagCount < loopLengthTagCount && vc_looplength == NULL; - ++loopTagCount) - if (strncasecmp(entry, loopLengthTags[loopTagCount], field) == 0) + for (size_t t = 0; t < loopLengthTagCount && vc_looplength == NULL; ++t) + { + char const * const tag = loopLengthTags[t]; + if (field == strlen(tag) && strncasecmp(entry, tag, field) == 0) vc_looplength = strdup(value); + } } } } diff --git a/polymer/eduke32/source/jaudiolib/src/multivoc.c b/polymer/eduke32/source/jaudiolib/src/multivoc.c index d57dc060d..915c6f89e 100644 --- a/polymer/eduke32/source/jaudiolib/src/multivoc.c +++ b/polymer/eduke32/source/jaudiolib/src/multivoc.c @@ -1014,6 +1014,6 @@ int32_t MV_Shutdown(void) void MV_SetPrintf(void (*function)(const char *, ...)) { MV_Printf = function; } -const char *loopStartTags[loopStartTagCount] = { "LOOP_START", "LOOPSTART" }; +const char *loopStartTags[loopStartTagCount] = { "LOOP_START", "LOOPSTART", "LOOP" }; const char *loopEndTags[loopEndTagCount] = { "LOOP_END", "LOOPEND" }; const char *loopLengthTags[loopLengthTagCount] = { "LOOP_LENGTH", "LOOPLENGTH" }; diff --git a/polymer/eduke32/source/jaudiolib/src/vorbis.c b/polymer/eduke32/source/jaudiolib/src/vorbis.c index c7f946a0e..fb60ad0d1 100644 --- a/polymer/eduke32/source/jaudiolib/src/vorbis.c +++ b/polymer/eduke32/source/jaudiolib/src/vorbis.c @@ -83,17 +83,26 @@ static void MV_GetVorbisCommentLoops(VoiceNode *voice, vorbis_comment *vc) const size_t field = value - entry; value += 1; - for (uint8_t loopTagCount = 0; loopTagCount < loopStartTagCount && vc_loopstart == NULL; ++loopTagCount) - if (strncasecmp(entry, loopStartTags[loopTagCount], field) == 0) + for (size_t t = 0; t < loopStartTagCount && vc_loopstart == NULL; ++t) + { + char const * const tag = loopStartTags[t]; + if (field == strlen(tag) && strncasecmp(entry, tag, field) == 0) vc_loopstart = value; + } - for (uint8_t loopTagCount = 0; loopTagCount < loopEndTagCount && vc_loopend == NULL; ++loopTagCount) - if (strncasecmp(entry, loopEndTags[loopTagCount], field) == 0) + for (size_t t = 0; t < loopEndTagCount && vc_loopend == NULL; ++t) + { + char const * const tag = loopEndTags[t]; + if (field == strlen(tag) && strncasecmp(entry, tag, field) == 0) vc_loopend = value; + } - for (uint8_t loopTagCount = 0; loopTagCount < loopLengthTagCount && vc_looplength == NULL; ++loopTagCount) - if (strncasecmp(entry, loopLengthTags[loopTagCount], field) == 0) + for (size_t t = 0; t < loopLengthTagCount && vc_looplength == NULL; ++t) + { + char const * const tag = loopLengthTags[t]; + if (field == strlen(tag) && strncasecmp(entry, tag, field) == 0) vc_looplength = value; + } } }