mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
Slight cleanup to MV_GetVorbisCommentLoops(). The biggest change here is swapping calls to atol to our Batol macro, which is actually backed by strtol instead of atol.
git-svn-id: https://svn.eduke32.com/eduke32@7284 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
91096d2415
commit
c3f88abf73
1 changed files with 14 additions and 16 deletions
|
@ -67,10 +67,10 @@ static void MV_GetVorbisCommentLoops(VoiceNode *voice, vorbis_comment *vc)
|
|||
|
||||
for (int comment = 0; comment < vc->comments; ++comment)
|
||||
{
|
||||
const char *entry = (const char *)vc->user_comments[comment];
|
||||
auto entry = (const char *)vc->user_comments[comment];
|
||||
if (entry != NULL && entry[0] != '\0')
|
||||
{
|
||||
const char *value = strchr(entry, '=');
|
||||
const char *value = Bstrchr(entry, '=');
|
||||
|
||||
if (!value)
|
||||
continue;
|
||||
|
@ -80,22 +80,22 @@ static void MV_GetVorbisCommentLoops(VoiceNode *voice, vorbis_comment *vc)
|
|||
|
||||
for (size_t t = 0; t < loopStartTagCount && vc_loopstart == NULL; ++t)
|
||||
{
|
||||
char const * const tag = loopStartTags[t];
|
||||
if (field == strlen(tag) && Bstrncasecmp(entry, tag, field) == 0)
|
||||
auto tag = loopStartTags[t];
|
||||
if (field == Bstrlen(tag) && Bstrncasecmp(entry, tag, field) == 0)
|
||||
vc_loopstart = value;
|
||||
}
|
||||
|
||||
for (size_t t = 0; t < loopEndTagCount && vc_loopend == NULL; ++t)
|
||||
{
|
||||
char const * const tag = loopEndTags[t];
|
||||
if (field == strlen(tag) && Bstrncasecmp(entry, tag, field) == 0)
|
||||
auto tag = loopEndTags[t];
|
||||
if (field == Bstrlen(tag) && Bstrncasecmp(entry, tag, field) == 0)
|
||||
vc_loopend = value;
|
||||
}
|
||||
|
||||
for (size_t t = 0; t < loopLengthTagCount && vc_looplength == NULL; ++t)
|
||||
{
|
||||
char const * const tag = loopLengthTags[t];
|
||||
if (field == strlen(tag) && Bstrncasecmp(entry, tag, field) == 0)
|
||||
auto tag = loopLengthTags[t];
|
||||
if (field == Bstrlen(tag) && Bstrncasecmp(entry, tag, field) == 0)
|
||||
vc_looplength = value;
|
||||
}
|
||||
}
|
||||
|
@ -103,20 +103,18 @@ static void MV_GetVorbisCommentLoops(VoiceNode *voice, vorbis_comment *vc)
|
|||
|
||||
if (vc_loopstart != NULL)
|
||||
{
|
||||
const ogg_int64_t ov_loopstart = Batol(vc_loopstart);
|
||||
if (ov_loopstart >= 0) // a loop starting at 0 is valid
|
||||
{
|
||||
const ogg_int64_t ov_loopstart = atol(vc_loopstart);
|
||||
if (ov_loopstart >= 0) // a loop starting at 0 is valid
|
||||
{
|
||||
voice->LoopStart = (const char *) (intptr_t) ov_loopstart;
|
||||
voice->LoopSize = 1;
|
||||
}
|
||||
voice->LoopStart = (const char *) (intptr_t) ov_loopstart;
|
||||
voice->LoopSize = 1;
|
||||
}
|
||||
}
|
||||
if (vc_loopend != NULL)
|
||||
{
|
||||
if (voice->LoopSize > 0)
|
||||
{
|
||||
const ogg_int64_t ov_loopend = atol(vc_loopend);
|
||||
const ogg_int64_t ov_loopend = Batol(vc_loopend);
|
||||
if (ov_loopend > 0) // a loop ending at 0 is invalid
|
||||
voice->LoopEnd = (const char *) (intptr_t) ov_loopend;
|
||||
}
|
||||
|
@ -125,7 +123,7 @@ static void MV_GetVorbisCommentLoops(VoiceNode *voice, vorbis_comment *vc)
|
|||
{
|
||||
if (voice->LoopSize > 0 && voice->LoopEnd == 0)
|
||||
{
|
||||
const ogg_int64_t ov_looplength = atol(vc_looplength);
|
||||
const ogg_int64_t ov_looplength = Batol(vc_looplength);
|
||||
if (ov_looplength > 0) // a loop of length 0 is invalid
|
||||
voice->LoopEnd = (const char *) ((intptr_t) ov_looplength + (intptr_t) voice->LoopStart);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue