util/{Const,Writable}Buffer, ...: rename IsEmpty() to empty(), imitating STL

This commit is contained in:
Max Kellermann
2017-11-10 19:24:33 +01:00
parent 523051132d
commit 49784513b1
51 changed files with 142 additions and 142 deletions

View File

@@ -496,7 +496,7 @@ DecoderBridge::SubmitData(InputStream *is,
SongTime::FromS(timestamp) -
dc.song->GetStartTime(),
kbit_rate);
if (dest.IsEmpty()) {
if (dest.empty()) {
/* the chunk is full, flush it */
FlushChunk();
continue;

View File

@@ -25,7 +25,7 @@ bool
DecoderBuffer::Fill()
{
auto w = buffer.Write();
if (w.IsEmpty())
if (w.empty())
/* buffer is full */
return false;

View File

@@ -127,7 +127,7 @@ adts_song_duration(DecoderBuffer &buffer)
if (frames == 0) {
auto data = ConstBuffer<uint8_t>::FromVoid(buffer.Read());
assert(!data.IsEmpty());
assert(!data.empty());
assert(frame_length <= data.size);
sample_rate = adts_sample_rates[(data.data[2] & 0x3c) >> 2];
@@ -255,7 +255,7 @@ faad_decoder_init(NeAACDecHandle decoder, DecoderBuffer &buffer,
AudioFormat &audio_format)
{
auto data = ConstBuffer<uint8_t>::FromVoid(buffer.Read());
if (data.IsEmpty())
if (data.empty())
throw std::runtime_error("Empty file");
uint8_t channels;
@@ -283,7 +283,7 @@ faad_decoder_decode(NeAACDecHandle decoder, DecoderBuffer &buffer,
NeAACDecFrameInfo *frame_info)
{
auto data = ConstBuffer<uint8_t>::FromVoid(buffer.Read());
if (data.IsEmpty())
if (data.empty())
return nullptr;
return NeAACDecDecode(decoder, frame_info,

View File

@@ -617,7 +617,7 @@ FfmpegCheckTag(DecoderClient &client, InputStream &is,
TagBuilder tag;
FfmpegScanTag(format_context, audio_stream, tag);
if (!tag.IsEmpty())
if (!tag.empty())
client.SubmitTag(is, tag.Commit());
}

View File

@@ -97,7 +97,7 @@ flac_scan_comment(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
if (handler.pair != nullptr) {
const char *comment = (const char *)entry->entry;
const DivideString split(comment, '=');
if (split.IsDefined() && !split.IsEmpty())
if (split.IsDefined() && !split.empty())
tag_handler_invoke_pair(handler, handler_ctx,
split.GetFirst(),
split.GetSecond());

View File

@@ -211,7 +211,7 @@ MPDOpusDecoder::HandleTags(const ogg_packet &packet)
if (ScanOpusTags(packet.packet, packet.bytes,
&rgi,
add_tag_handler, &tag_builder) &&
!tag_builder.IsEmpty()) {
!tag_builder.empty()) {
client.SubmitReplayGain(&rgi);
Tag tag = tag_builder.Commit();

View File

@@ -44,7 +44,7 @@ FillBuffer(DecoderClient &client, InputStream &is, B &buffer)
{
buffer.Shift();
auto w = buffer.Write();
if (w.IsEmpty())
if (w.empty())
return true;
size_t nbytes = decoder_read(client, is, w.data, w.size);
@@ -185,7 +185,7 @@ pcm_stream_decode(DecoderClient &client, InputStream &is)
r.size = (r.size / 3) * 4;
}
cmd = !r.IsEmpty()
cmd = !r.empty()
? client.SubmitData(is, r.data, r.size, 0)
: client.GetCommand();
if (cmd == DecoderCommand::SEEK) {