llaudio: BOOL (int) to real bool

master
Lars Næsbye Christensen 2024-02-09 01:50:51 +01:00 committed by Andrey Lihatskiy
parent 5d8f1e4dbd
commit 79ceefe56b
4 changed files with 43 additions and 43 deletions

View File

@ -70,22 +70,22 @@ public:
LLVorbisDecodeState(const LLUUID &uuid, const std::string &out_filename);
BOOL initDecode();
BOOL decodeSection(); // Return TRUE if done.
BOOL finishDecode();
bool initDecode();
bool decodeSection(); // Return true if done.
bool finishDecode();
void flushBadFile();
void ioComplete(S32 bytes) { mBytesRead = bytes; }
BOOL isValid() const { return mValid; }
BOOL isDone() const { return mDone; }
bool isValid() const { return mValid; }
bool isDone() const { return mDone; }
const LLUUID &getUUID() const { return mUUID; }
protected:
virtual ~LLVorbisDecodeState();
BOOL mValid;
BOOL mDone;
bool mValid;
bool mDone;
LLAtomicS32 mBytesRead;
LLUUID mUUID;
@ -164,8 +164,8 @@ long cache_tell (void *datasource)
LLVorbisDecodeState::LLVorbisDecodeState(const LLUUID &uuid, const std::string &out_filename)
{
mDone = FALSE;
mValid = FALSE;
mDone = false;
mValid = false;
mBytesRead = -1;
mUUID = uuid;
mInFilep = NULL;
@ -188,7 +188,7 @@ LLVorbisDecodeState::~LLVorbisDecodeState()
}
BOOL LLVorbisDecodeState::initDecode()
bool LLVorbisDecodeState::initDecode()
{
ov_callbacks cache_callbacks;
cache_callbacks.read_func = cache_read;
@ -204,14 +204,14 @@ BOOL LLVorbisDecodeState::initDecode()
LL_WARNS("AudioEngine") << "unable to open vorbis source vfile for reading" << LL_ENDL;
delete mInFilep;
mInFilep = NULL;
return FALSE;
return false;
}
S32 r = ov_open_callbacks(mInFilep, &mVF, NULL, 0, cache_callbacks);
if(r < 0)
{
LL_WARNS("AudioEngine") << r << " Input to vorbis decode does not appear to be an Ogg bitstream: " << mUUID << LL_ENDL;
return(FALSE);
return(false);
}
S32 sample_count = (S32)ov_pcm_total(&mVF, -1);
@ -260,7 +260,7 @@ BOOL LLVorbisDecodeState::initDecode()
}
delete mInFilep;
mInFilep = NULL;
return FALSE;
return false;
}
try
@ -273,7 +273,7 @@ BOOL LLVorbisDecodeState::initDecode()
LL_WARNS("AudioEngine") << "Out of memory when trying to alloc buffer: " << size_guess << LL_ENDL;
delete mInFilep;
mInFilep = NULL;
return FALSE;
return false;
}
{
@ -360,31 +360,31 @@ BOOL LLVorbisDecodeState::initDecode()
// fprintf(stderr,"\nDecoded length: %ld samples\n", (long)ov_pcm_total(&vf,-1));
// fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
//}
return TRUE;
return true;
}
BOOL LLVorbisDecodeState::decodeSection()
bool LLVorbisDecodeState::decodeSection()
{
if (!mInFilep)
{
LL_WARNS("AudioEngine") << "No cache file to decode in vorbis!" << LL_ENDL;
return TRUE;
return true;
}
if (mDone)
{
// LL_WARNS("AudioEngine") << "Already done with decode, aborting!" << LL_ENDL;
return TRUE;
return true;
}
char pcmout[4096]; /*Flawfinder: ignore*/
BOOL eof = FALSE;
bool eof = false;
long ret=ov_read(&mVF, pcmout, sizeof(pcmout), 0, 2, 1, &mCurrentSection);
if (ret == 0)
{
/* EOF */
eof = TRUE;
mDone = TRUE;
mValid = TRUE;
eof = true;
mDone = true;
mValid = true;
// LL_INFOS("AudioEngine") << "Vorbis EOF" << LL_ENDL;
}
else if (ret < 0)
@ -394,10 +394,10 @@ BOOL LLVorbisDecodeState::decodeSection()
LL_WARNS("AudioEngine") << "BAD vorbis decode in decodeSection." << LL_ENDL;
mValid = FALSE;
mDone = TRUE;
// We're done, return TRUE.
return TRUE;
mValid = false;
mDone = true;
// We're done, return true.
return true;
}
else
{
@ -409,12 +409,12 @@ BOOL LLVorbisDecodeState::decodeSection()
return eof;
}
BOOL LLVorbisDecodeState::finishDecode()
bool LLVorbisDecodeState::finishDecode()
{
if (!isValid())
{
LL_WARNS("AudioEngine") << "Bogus vorbis decode state for " << getUUID() << ", aborting!" << LL_ENDL;
return TRUE; // We've finished
return true; // We've finished
}
if (mFileHandle == LLLFSThread::nullHandle())
@ -487,8 +487,8 @@ BOOL LLVorbisDecodeState::finishDecode()
if (36 == data_length)
{
LL_WARNS("AudioEngine") << "BAD Vorbis decode in finishDecode!" << LL_ENDL;
mValid = FALSE;
return TRUE; // we've finished
mValid = false;
return true; // we've finished
}
mBytesRead = -1;
mFileHandle = LLLFSThread::sLocal->write(mOutFilename, &mWAVBuffer[0], 0, mWAVBuffer.size(),
@ -502,21 +502,21 @@ BOOL LLVorbisDecodeState::finishDecode()
if (mBytesRead == 0)
{
LL_WARNS("AudioEngine") << "Unable to write file in LLVorbisDecodeState::finishDecode" << LL_ENDL;
mValid = FALSE;
return TRUE; // we've finished
mValid = false;
return true; // we've finished
}
}
else
{
return FALSE; // not done
return false; // not done
}
}
mDone = TRUE;
mDone = true;
LL_DEBUGS("AudioEngine") << "Finished decode for " << getUUID() << LL_ENDL;
return TRUE;
return true;
}
void LLVorbisDecodeState::flushBadFile()
@ -779,13 +779,13 @@ void LLAudioDecodeMgr::processQueue()
mImpl->processQueue();
}
BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
bool LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
{
if (gAudiop && gAudiop->hasDecodedFile(uuid))
{
// Already have a decoded version, don't need to decode it.
LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has decoded file already" << LL_ENDL;
return TRUE;
return true;
}
if (gAssetStorage->hasLocalAsset(uuid, LLAssetType::AT_SOUND))
@ -793,9 +793,9 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
// Just put it on the decode queue.
LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has local asset file already" << LL_ENDL;
mImpl->mDecodeQueue.push_back(uuid);
return TRUE;
return true;
}
LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " no file available" << LL_ENDL;
return FALSE;
return false;
}

View File

@ -43,7 +43,7 @@ class LLAudioDecodeMgr : public LLSingleton<LLAudioDecodeMgr>
~LLAudioDecodeMgr();
public:
void processQueue();
BOOL addDecodeRequest(const LLUUID &uuid);
bool addDecodeRequest(const LLUUID &uuid);
void addAudioRequest(const LLUUID &uuid);
protected:

View File

@ -265,7 +265,7 @@ public:
void preload(const LLUUID &audio_id); // Only used for preloading UI sounds, now.
void addAudioData(LLAudioData *adp, bool set_current = TRUE);
void addAudioData(LLAudioData *adp, bool set_current = true);
void setForcedPriority(const bool ambient) { mForcedPriority = ambient; }
bool isForcedPriority() const { return mForcedPriority; }

View File

@ -75,7 +75,7 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro
U32 chunk_length = 0;
U32 raw_data_length = 0;
U32 bytes_per_sec = 0;
BOOL uncompressed_pcm = FALSE;
bool uncompressed_pcm = false;
unsigned char wav_header[44]; /*Flawfinder: ignore*/
@ -133,7 +133,7 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro
{
if ((wav_header[8] == 0x01) && (wav_header[9] == 0x00))
{
uncompressed_pcm = TRUE;
uncompressed_pcm = true;
}
num_channels = ((U16) wav_header[11] << 8) + wav_header[10];
sample_rate = ((U32) wav_header[15] << 24)