output: use StringIsEqual()

This commit is contained in:
Max Kellermann
2019-09-26 14:44:48 +02:00
parent d8a74802d1
commit 3d03683e7d
6 changed files with 23 additions and 23 deletions

View File

@@ -25,12 +25,11 @@
#include "util/SplitString.hxx"
#include "util/RuntimeError.hxx"
#include "util/Domain.hxx"
#include "util/StringAPI.hxx"
#include "Log.hxx"
#include <ao/ao.h>
#include <string.h>
/* An ao_sample_format, with all fields set to zero: */
static ao_sample_format OUR_AO_FORMAT_INITIALIZER;
@@ -105,7 +104,7 @@ AoOutput::AoOutput(const ConfigBlock &block)
write_size(block.GetPositiveValue("write_size", 1024U))
{
const char *value = block.GetBlockValue("driver", "default");
if (0 == strcmp(value, "default"))
if (StringIsEqual(value, "default"))
driver = ao_default_driver_id();
else
driver = ao_driver_id(value);

View File

@@ -30,6 +30,7 @@
#include "thread/Mutex.hxx"
#include "thread/Cond.hxx"
#include "util/ByteOrder.hxx"
#include "util/StringAPI.hxx"
#include "util/StringBuffer.hxx"
#include "util/StringFormat.hxx"
#include "Log.hxx"
@@ -138,11 +139,11 @@ OSXOutput::OSXOutput(const ConfigBlock &block)
{
const char *device = block.GetBlockValue("device");
if (device == nullptr || 0 == strcmp(device, "default")) {
if (device == nullptr || StringIsEqual(device, "default")) {
component_subtype = kAudioUnitSubType_DefaultOutput;
device_name = nullptr;
}
else if (0 == strcmp(device, "system")) {
else if (StringIsEqual(device, "system")) {
component_subtype = kAudioUnitSubType_SystemOutput;
device_name = nullptr;
}
@@ -689,7 +690,7 @@ osx_output_set_device(OSXOutput *oo)
if (!cfname_.GetCString(name, sizeof(name)))
throw std::runtime_error("Unable to convert device name from CFStringRef to char*");
if (strcmp(oo->device_name, name) == 0) {
if (StringIsEqual(oo->device_name, name)) {
FormatDebug(osx_output_domain,
"found matching device: ID=%u, name=%s",
(unsigned)deviceids[i], name);

View File

@@ -35,7 +35,6 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
static constexpr unsigned DEFAULT_CONN_TIMEOUT = 2;
@@ -123,15 +122,15 @@ ShoutOutput::ShoutOutput(const ConfigBlock &block)
unsigned protocol;
const char *value = block.GetBlockValue("protocol");
if (value != nullptr) {
if (0 == strcmp(value, "shoutcast") &&
if (StringIsEqual(value, "shoutcast") &&
!StringIsEqual(mime_type, "audio/mpeg"))
throw FormatRuntimeError("you cannot stream \"%s\" to shoutcast, use mp3",
mime_type);
else if (0 == strcmp(value, "shoutcast"))
else if (StringIsEqual(value, "shoutcast"))
protocol = SHOUT_PROTOCOL_ICY;
else if (0 == strcmp(value, "icecast1"))
else if (StringIsEqual(value, "icecast1"))
protocol = SHOUT_PROTOCOL_XAUDIOCAST;
else if (0 == strcmp(value, "icecast2"))
else if (StringIsEqual(value, "icecast2"))
protocol = SHOUT_PROTOCOL_HTTP;
else
throw FormatRuntimeError("shout protocol \"%s\" is not \"shoutcast\" or "
@@ -145,15 +144,15 @@ ShoutOutput::ShoutOutput(const ConfigBlock &block)
unsigned tls;
value = block.GetBlockValue("tls");
if (value != nullptr) {
if (0 == strcmp(value, "disabled"))
if (StringIsEqual(value, "disabled"))
tls = SHOUT_TLS_DISABLED;
else if(0 == strcmp(value, "auto"))
else if (StringIsEqual(value, "auto"))
tls = SHOUT_TLS_AUTO;
else if(0 == strcmp(value, "auto_no_plain"))
else if (StringIsEqual(value, "auto_no_plain"))
tls = SHOUT_TLS_AUTO_NO_PLAIN;
else if(0 == strcmp(value, "rfc2818"))
else if (StringIsEqual(value, "rfc2818"))
tls = SHOUT_TLS_RFC2818;
else if(0 == strcmp(value, "rfc2817"))
else if (StringIsEqual(value, "rfc2817"))
tls = SHOUT_TLS_RFC2817;
else
throw FormatRuntimeError("invalid shout TLS option \"%s\"", value);