mirror of https://github.com/xbmc/xbmc
[clang-tidy] readability-container-size-empty
This commit is contained in:
parent
491bc8cfae
commit
97dfb97992
|
|
@ -18,5 +18,6 @@ Checks: "\
|
|||
performance-unnecessary-value-param,\
|
||||
readability-container-contains,\
|
||||
readability-container-data-pointer,\
|
||||
readability-container-size-empty,\
|
||||
"
|
||||
HeaderFilterRegex: '(^|/)(tools|xbmc)/'
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ bool CAutorun::RunDisc(IDirectory* pDir,
|
|||
if (StringUtils::EqualsNoCase(name, "HVDVD_TS") && bAllowVideo &&
|
||||
(options.bypassSettings || bAutorunDVDs))
|
||||
{
|
||||
if (hddvdname == "")
|
||||
if (hddvdname.empty())
|
||||
{
|
||||
CLog::Log(LOGINFO,"HD DVD: Checking for ifo.");
|
||||
// find Video Manager or Title Set Information
|
||||
|
|
@ -349,7 +349,7 @@ bool CAutorun::RunDisc(IDirectory* pDir,
|
|||
items.Copy (sitems);
|
||||
sitems.Clear();
|
||||
}
|
||||
if (hddvdname != "")
|
||||
if (!hddvdname.empty())
|
||||
{
|
||||
CFileItem item(URIUtils::AddFileToFolder(phddvdItem->GetPath(), hddvdname), false);
|
||||
item.SetLabel(CServiceBroker::GetMediaManager().GetDiskLabel(strDrive));
|
||||
|
|
|
|||
|
|
@ -134,10 +134,7 @@ public:
|
|||
return !line.empty();
|
||||
}
|
||||
|
||||
bool ready() const override
|
||||
{
|
||||
return m_data.size() > 0;
|
||||
}
|
||||
bool ready() const override { return !m_data.empty(); }
|
||||
|
||||
private:
|
||||
std::string m_data;
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ public:
|
|||
void AddSortMethod(const SortDescription& sortDescription,
|
||||
int buttonLabel,
|
||||
const LABEL_MASKS& labelMasks);
|
||||
bool HasSortDetails() const { return m_sortDetails.size() != 0; }
|
||||
bool HasSortDetails() const { return !m_sortDetails.empty(); }
|
||||
const std::vector<GUIViewSortDetails>& GetSortDetails() const { return m_sortDetails; }
|
||||
|
||||
/*! \brief Specify whether this list should be sorted with folders separate from files
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ void CLangInfo::CRegion::SetTimeZone(const std::string& strTimeZone)
|
|||
void CLangInfo::CRegion::SetGlobalLocale()
|
||||
{
|
||||
std::string strLocale;
|
||||
if (m_strRegionLocaleName.length() > 0)
|
||||
if (!m_strRegionLocaleName.empty())
|
||||
{
|
||||
#ifdef TARGET_WINDOWS
|
||||
std::string strLang, strRegion;
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ std::vector<std::string> CTextureDatabase::GetOldestCachedImages(unsigned int ma
|
|||
|
||||
bool CTextureDatabase::SetKeepCachedImages(const std::vector<std::string>& imagesToKeep)
|
||||
{
|
||||
if (!imagesToKeep.size())
|
||||
if (imagesToKeep.empty())
|
||||
return true;
|
||||
|
||||
std::string sql = "UPDATE texture SET lastlibrarycheck=CURRENT_TIMESTAMP WHERE url IN (";
|
||||
|
|
|
|||
16
xbmc/URL.cpp
16
xbmc/URL.cpp
|
|
@ -63,7 +63,8 @@ void CURL::Parse(std::string strURL1)
|
|||
// format 3: drive:directoryandfile
|
||||
//
|
||||
// first need 2 check if this is a protocol or just a normal drive & path
|
||||
if (!strURL.size()) return ;
|
||||
if (strURL.empty())
|
||||
return;
|
||||
if (strURL == "?") return;
|
||||
|
||||
// form is format 1 or 2
|
||||
|
|
@ -291,7 +292,7 @@ void CURL::Parse(std::string strURL1)
|
|||
|
||||
if (IsProtocol("musicdb") || IsProtocol("videodb") || IsProtocol("sources") || IsProtocol("pvr"))
|
||||
{
|
||||
if (m_strHostName != "" && m_strFileName != "")
|
||||
if (!m_strHostName.empty() && !m_strFileName.empty())
|
||||
{
|
||||
m_strFileName = StringUtils::Format("{}/{}", m_strHostName, m_strFileName);
|
||||
m_strHostName = "";
|
||||
|
|
@ -353,7 +354,7 @@ void CURL::SetOptions(std::string strOptions)
|
|||
{
|
||||
m_strOptions.clear();
|
||||
m_options.Clear();
|
||||
if( strOptions.length() > 0)
|
||||
if (!strOptions.empty())
|
||||
{
|
||||
if(strOptions[0] == '?' ||
|
||||
strOptions[0] == '#' ||
|
||||
|
|
@ -372,7 +373,7 @@ void CURL::SetProtocolOptions(std::string strOptions)
|
|||
{
|
||||
m_strProtocolOptions.clear();
|
||||
m_protocolOptions.Clear();
|
||||
if (strOptions.length() > 0)
|
||||
if (!strOptions.empty())
|
||||
{
|
||||
if (strOptions[0] == '|')
|
||||
m_strProtocolOptions = std::move(strOptions).substr(1);
|
||||
|
|
@ -558,9 +559,9 @@ std::string CURL::GetWithoutUserDetails(bool redact) const
|
|||
}
|
||||
strURL += m_strFileName;
|
||||
|
||||
if( m_strOptions.length() > 0 )
|
||||
if (!m_strOptions.empty())
|
||||
strURL += m_strOptions;
|
||||
if( m_strProtocolOptions.length() > 0 )
|
||||
if (!m_strProtocolOptions.empty())
|
||||
strURL += "|"+m_strProtocolOptions;
|
||||
|
||||
return strURL;
|
||||
|
|
@ -650,7 +651,8 @@ bool CURL::IsFileOnly(const std::string &url)
|
|||
|
||||
bool CURL::IsFullPath(const std::string &url)
|
||||
{
|
||||
if (url.size() && url[0] == '/') return true; // /foo/bar.ext
|
||||
if (!url.empty() && url[0] == '/')
|
||||
return true; // /foo/bar.ext
|
||||
if (url.find("://") != std::string::npos) return true; // foo://bar.ext
|
||||
if (url.size() > 1 && url[1] == ':') return true; // c:\\foo\\bar\\bar.ext
|
||||
if (StringUtils::StartsWith(url, "\\\\")) return true; // \\UNC\path\to\file
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ bool CUtil::GetDirectoryName(const std::string& strFileName, std::string& strDes
|
|||
size_t iPos = strDescription.find_last_of("/\\");
|
||||
if (iPos != std::string::npos)
|
||||
strDescription = strDescription.substr(iPos + 1);
|
||||
else if (strDescription.size() <= 0)
|
||||
else if (strDescription.empty())
|
||||
strDescription = strFName;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1214,7 +1214,7 @@ void CUtil::SplitParams(const std::string ¶mString, std::vector<std::string>
|
|||
parameter.erase(quotaPos, 1);
|
||||
}
|
||||
}
|
||||
if (!parameter.empty() || parameters.size())
|
||||
if (!parameter.empty() || !parameters.empty())
|
||||
parameters.push_back(parameter);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1269,7 +1269,7 @@ bool IsAddonImageChecked(const std::string& addonImage,
|
|||
std::vector<std::string> CAddonDatabase::GetUsedImages(
|
||||
const std::vector<std::string>& imagesToCheck) const
|
||||
{
|
||||
if (!imagesToCheck.size())
|
||||
if (imagesToCheck.empty())
|
||||
return {};
|
||||
|
||||
VECADDONS allAddons;
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ std::vector<std::string> CAddonInstaller::RemoveOrphanedDepsRecursively() const
|
|||
std::vector<std::string> removedItems;
|
||||
|
||||
auto toRemove = CServiceBroker::GetAddonMgr().GetOrphanedDependencies();
|
||||
while (toRemove.size() > 0)
|
||||
while (!toRemove.empty())
|
||||
{
|
||||
for (const auto& dep : toRemove)
|
||||
{
|
||||
|
|
@ -1257,7 +1257,7 @@ bool CAddonUnInstallJob::DoWork()
|
|||
{
|
||||
const auto removedItems = CAddonInstaller::GetInstance().RemoveOrphanedDepsRecursively();
|
||||
|
||||
if (removedItems.size() > 0)
|
||||
if (!removedItems.empty())
|
||||
{
|
||||
CLog::Log(LOGINFO, "CAddonUnInstallJob[{}]: removed orphaned dependencies ({})",
|
||||
m_addon->ID(), StringUtils::Join(removedItems, ", "));
|
||||
|
|
|
|||
|
|
@ -495,7 +495,7 @@ bool CAddonMgr::GetAddonsInternal(AddonType type,
|
|||
addons.emplace_back(std::move(addon));
|
||||
}
|
||||
}
|
||||
return addons.size() > 0;
|
||||
return !addons.empty();
|
||||
}
|
||||
|
||||
bool CAddonMgr::GetIncompatibleEnabledAddonInfos(std::vector<AddonInfoPtr>& incompatible) const
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ void CAddonSystemSettings::OnSettingAction(const std::shared_ptr<const CSetting>
|
|||
using namespace KODI::MESSAGING::HELPERS;
|
||||
|
||||
const auto removedItems = CAddonInstaller::GetInstance().RemoveOrphanedDepsRecursively();
|
||||
if (removedItems.size() > 0)
|
||||
if (!removedItems.empty())
|
||||
{
|
||||
const auto message =
|
||||
StringUtils::Format(g_localizeStrings.Get(36641), StringUtils::Join(removedItems, ", "));
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ void CSkinInfo::Start()
|
|||
if (!LoadUserSettings())
|
||||
CLog::Log(LOGWARNING, "CSkinInfo: failed to load skin settings");
|
||||
|
||||
if (!m_resolutions.size())
|
||||
if (m_resolutions.empty())
|
||||
{ // try falling back to whatever resolutions exist in the directory
|
||||
CFileItemList items;
|
||||
CDirectory::GetDirectory(Path(), items, "", DIR_FLAG_NO_FILE_DIRS);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void CAppParamParser::ParseArg(const std::string &arg)
|
|||
m_params->SetTestMode(true);
|
||||
else if (arg.substr(0, 11) == "--settings=")
|
||||
m_params->SetSettingsFile(arg.substr(11));
|
||||
else if (arg.length() != 0 && arg[0] != '-')
|
||||
else if (!arg.empty() && arg[0] != '-')
|
||||
{
|
||||
const CFileItemPtr item = std::make_shared<CFileItem>(arg);
|
||||
item->SetPath(arg);
|
||||
|
|
|
|||
|
|
@ -1526,7 +1526,7 @@ void CApplication::OnApplicationMessage(ThreadMessage* pMsg)
|
|||
case TMSG_START_ANDROID_ACTIVITY:
|
||||
{
|
||||
#if defined(TARGET_ANDROID)
|
||||
if (pMsg->params.size())
|
||||
if (!pMsg->params.empty())
|
||||
{
|
||||
CXBMCApp::StartActivity(pMsg->params[0], pMsg->params.size() > 1 ? pMsg->params[1] : "",
|
||||
pMsg->params.size() > 2 ? pMsg->params[2] : "",
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ void CAESinkPipewire::EnumerateDevicesEx(AEDeviceInfoList& list, bool force)
|
|||
}
|
||||
|
||||
auto& channels = node->GetChannels();
|
||||
if (channels.size() < 1)
|
||||
if (channels.empty())
|
||||
continue;
|
||||
|
||||
for (const auto& channel : channels)
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ void CAEBitstreamPacker::PackEAC3(CAEStreamInfo &info, uint8_t* data, int size)
|
|||
{
|
||||
/* multiple frames needed to achieve 6 blocks as required by IEC 61937-3:2007 */
|
||||
|
||||
if (m_eac3.size() == 0)
|
||||
if (m_eac3.empty())
|
||||
m_eac3.resize(EAC3_MAX_BURST_PAYLOAD_SIZE);
|
||||
|
||||
unsigned int newsize = m_eac3Size + size;
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ void CAEELDParser::Parse(const uint8_t *data, size_t length, CAEDeviceInfo& info
|
|||
[](char c) { return !std::isspace(c); })
|
||||
.base(),
|
||||
header.monitor_name.end());
|
||||
if (header.monitor_name.length() > 0)
|
||||
if (!header.monitor_name.empty())
|
||||
{
|
||||
info.m_displayNameExtra.append(" ");
|
||||
info.m_displayNameExtra.append(header.monitor_name);
|
||||
|
|
|
|||
|
|
@ -549,7 +549,7 @@ bool CExternalPlayer::SetPlayerState(const std::string& state)
|
|||
bool CExternalPlayer::Initialize(TiXmlElement* pConfig)
|
||||
{
|
||||
XMLUtils::GetString(pConfig, "filename", m_filename);
|
||||
if (m_filename.length() > 0)
|
||||
if (!m_filename.empty())
|
||||
{
|
||||
CLog::Log(LOGINFO, "ExternalPlayer Filename: {}", m_filename);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ OverlayMessage CDVDOverlayCodecTX3G::Decode(DemuxPacket* pPacket)
|
|||
else if (boxType == BOX_TYPE_STYL)
|
||||
{
|
||||
// Parse the contained StyleRecords
|
||||
if (styleRecords.size() != 0)
|
||||
if (!styleRecords.empty())
|
||||
{
|
||||
CLog::Log(LOGDEBUG, "{} - Found additional TextStyleBox, skipping", __FUNCTION__);
|
||||
sampleData.SkipChars(boxSize - MP4_BOX_HEADER_SIZE);
|
||||
|
|
|
|||
|
|
@ -1707,9 +1707,8 @@ void CMixer::StateMachine(int signal, Protocol *port, Message *msg)
|
|||
m_state = M_TOP_CONFIGURED_STEP1;
|
||||
m_bStateMachineSelfTrigger = true;
|
||||
}
|
||||
else if (!m_outputSurfaces.empty() &&
|
||||
m_config.stats->IsDraining() &&
|
||||
m_mixerInput.size() >= 1)
|
||||
else if (!m_outputSurfaces.empty() && m_config.stats->IsDraining() &&
|
||||
!m_mixerInput.empty())
|
||||
{
|
||||
CVdpauDecodedPicture pic;
|
||||
pic.DVDPic.SetParams(m_mixerInput[0].DVDPic);
|
||||
|
|
@ -2664,8 +2663,7 @@ void CMixer::FiniCycle()
|
|||
// NVidia recommends num_ref + 5
|
||||
size_t surfToKeep = 5;
|
||||
|
||||
if (m_mixerInput.size() > 0 &&
|
||||
(m_mixerInput[0].videoSurface == VDP_INVALID_HANDLE))
|
||||
if (!m_mixerInput.empty() && (m_mixerInput[0].videoSurface == VDP_INVALID_HANDLE))
|
||||
surfToKeep = 1;
|
||||
|
||||
while (m_mixerInput.size() > surfToKeep)
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ bool CDVDDemuxFFmpeg::Open(const std::shared_ptr<CDVDInputStream>& pInput, bool
|
|||
m_pInput = pInput;
|
||||
strFile = m_pInput->GetFileName();
|
||||
|
||||
if (m_pInput->GetContent().length() > 0)
|
||||
if (!m_pInput->GetContent().empty())
|
||||
{
|
||||
std::string content = m_pInput->GetContent();
|
||||
StringUtils::ToLower(content);
|
||||
|
|
@ -798,7 +798,7 @@ AVDictionary* CDVDDemuxFFmpeg::GetFFMpegOptionsFromInput()
|
|||
}
|
||||
// Any other headers that need to be sent would be user defined and should be prefixed
|
||||
// by a `!`. We mask these values so we don't log anything we shouldn't
|
||||
else if (name.length() > 0 && name[0] == '!')
|
||||
else if (!name.empty() && name[0] == '!')
|
||||
{
|
||||
CLog::Log(LOGDEBUG,
|
||||
"CDVDDemuxFFmpeg::GetFFMpegOptionsFromInput() adding user custom header option "
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ bool CDVDDemuxVobsub::Open(const std::string& filename, int source, const std::s
|
|||
return false;
|
||||
|
||||
std::string vobsub = subfilename;
|
||||
if ( vobsub == "")
|
||||
if (vobsub.empty())
|
||||
{
|
||||
vobsub = filename;
|
||||
vobsub.erase(vobsub.rfind('.'), vobsub.size());
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ std::string CDVDInputStreamFFmpeg::GetFileName()
|
|||
url.IsProtocol("rtmps"))
|
||||
{
|
||||
std::vector<std::string> opts = StringUtils::Split(url.Get(), " ");
|
||||
if (opts.size() > 0)
|
||||
if (!opts.empty())
|
||||
{
|
||||
return opts.front();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ bool CDVDSubtitleParserSubrip::Open(CDVDStreamInfo& hints)
|
|||
{
|
||||
StringUtils::Trim(line);
|
||||
|
||||
if (line.length() > 0)
|
||||
if (!line.empty())
|
||||
{
|
||||
char sep;
|
||||
int hh1, mm1, ss1, ms1, hh2, mm2, ss2, ms2;
|
||||
|
|
@ -63,7 +63,7 @@ bool CDVDSubtitleParserSubrip::Open(CDVDStreamInfo& hints)
|
|||
if (line.empty())
|
||||
break;
|
||||
|
||||
if (convText.size() > 0)
|
||||
if (!convText.empty())
|
||||
convText += "\n";
|
||||
TagConv.ConvertLine(line);
|
||||
convText += line;
|
||||
|
|
|
|||
|
|
@ -5408,10 +5408,10 @@ void CVideoPlayer::GetVideoStreamInfo(int streamId, VideoStreamInfo& info) const
|
|||
}
|
||||
|
||||
const SelectionStream& s = m_content.m_selectionStreams.Get(STREAM_VIDEO, streamId);
|
||||
if (s.language.length() > 0)
|
||||
if (!s.language.empty())
|
||||
info.language = s.language;
|
||||
|
||||
if (s.name.length() > 0)
|
||||
if (!s.name.empty())
|
||||
info.name = s.name;
|
||||
|
||||
m_renderManager.GetVideoRect(info.SrcRect, info.DestRect, info.VideoRect);
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ bool CVideoPlayerSubtitle::OpenStream(CDVDStreamInfo &hints, std::string &filena
|
|||
m_streaminfo = hints;
|
||||
|
||||
// okey check if this is a filesubtitle
|
||||
if(filename.size() && filename != "dvd" )
|
||||
if (!filename.empty() && filename != "dvd")
|
||||
{
|
||||
m_pSubtitleFileParser.reset(CDVDFactorySubtitle::CreateParser(filename));
|
||||
if (!m_pSubtitleFileParser)
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ COverlayGlyphGL::~COverlayGlyphGL()
|
|||
|
||||
void COverlayGlyphGL::Render(SRenderState& state)
|
||||
{
|
||||
if ((m_texture == 0) || (m_vertex.size() == 0))
|
||||
if ((m_texture == 0) || (m_vertex.empty()))
|
||||
return;
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ COverlayGlyphGLES::~COverlayGlyphGLES()
|
|||
|
||||
void COverlayGlyphGLES::Render(SRenderState& state)
|
||||
{
|
||||
if ((m_texture == 0) || (m_vertex.size() == 0))
|
||||
if ((m_texture == 0) || (m_vertex.empty()))
|
||||
return;
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
|
|
|||
|
|
@ -257,11 +257,12 @@ void PAPlayer::UpdateCrossfadeTime(const CFileItem& file)
|
|||
|
||||
if (m_upcomingCrossfadeMS)
|
||||
{
|
||||
if (!m_currentStream || (file.HasMusicInfoTag() &&
|
||||
if (!m_currentStream ||
|
||||
(file.HasMusicInfoTag() &&
|
||||
!CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
|
||||
CSettings::SETTING_MUSICPLAYER_CROSSFADEALBUMTRACKS) &&
|
||||
m_currentStream->m_fileItem->HasMusicInfoTag() &&
|
||||
(m_currentStream->m_fileItem->GetMusicInfoTag()->GetAlbum() != "") &&
|
||||
(!m_currentStream->m_fileItem->GetMusicInfoTag()->GetAlbum().empty()) &&
|
||||
(m_currentStream->m_fileItem->GetMusicInfoTag()->GetAlbum() ==
|
||||
file.GetMusicInfoTag()->GetAlbum()) &&
|
||||
(m_currentStream->m_fileItem->GetMusicInfoTag()->GetDiscNumber() ==
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ std::string CPlayerCoreFactory::GetDefaultPlayer(const CFileItem& item) const
|
|||
std::string CPlayerCoreFactory::SelectPlayerDialog(const std::vector<std::string>&players, float posX, float posY) const
|
||||
{
|
||||
CContextButtons choices;
|
||||
if (players.size())
|
||||
if (!players.empty())
|
||||
{
|
||||
//Add default player
|
||||
std::string strCaption = players[0];
|
||||
|
|
|
|||
|
|
@ -69,9 +69,8 @@ void CPlayerSelectionRule::Initialize(TiXmlElement* pRule)
|
|||
m_videoAspect = XMLUtils::GetAttribute(pRule, "videoaspect");
|
||||
m_hdrType = XMLUtils::GetAttribute(pRule, "hdrtype");
|
||||
|
||||
m_bStreamDetails = m_audioCodec.length() > 0 || m_audioChannels.length() > 0 ||
|
||||
m_videoCodec.length() > 0 || m_videoResolution.length() > 0 ||
|
||||
m_videoAspect.length() > 0 || m_hdrType.length() > 0;
|
||||
m_bStreamDetails = !m_audioCodec.empty() || !m_audioChannels.empty() || !m_videoCodec.empty() ||
|
||||
!m_videoResolution.empty() || !m_videoAspect.empty() || !m_hdrType.empty();
|
||||
|
||||
if (m_bStreamDetails && !CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_MYVIDEOS_EXTRACTFLAGS))
|
||||
{
|
||||
|
|
@ -174,7 +173,7 @@ void CPlayerSelectionRule::GetPlayers(const CFileItem& item, std::vector<std::st
|
|||
return;
|
||||
|
||||
std::string hdrType{streamDetails.GetVideoHdrType()};
|
||||
if (hdrType.length() == 0)
|
||||
if (hdrType.empty())
|
||||
hdrType = "none";
|
||||
|
||||
if (CompileRegExp(m_hdrType, regExp) && !MatchesRegExp(hdrType, regExp))
|
||||
|
|
|
|||
|
|
@ -1760,7 +1760,7 @@ void MysqlDataset::fill_fields()
|
|||
(result.records.size() < (unsigned int)frecno))
|
||||
return;
|
||||
|
||||
if (fields_object->size() == 0) // Filling columns name
|
||||
if (fields_object->empty()) // Filling columns name
|
||||
{
|
||||
const unsigned int ncols = result.record_header.size();
|
||||
fields_object->resize(ncols);
|
||||
|
|
@ -1773,7 +1773,7 @@ void MysqlDataset::fill_fields()
|
|||
}
|
||||
|
||||
//Filling result
|
||||
if (result.records.size() != 0)
|
||||
if (!result.records.empty())
|
||||
{
|
||||
const sql_record* row = result.records[frecno];
|
||||
if (row)
|
||||
|
|
@ -2015,7 +2015,7 @@ void MysqlDataset::open(const std::string& sql)
|
|||
|
||||
void MysqlDataset::open()
|
||||
{
|
||||
if (select_sql.size())
|
||||
if (!select_sql.empty())
|
||||
{
|
||||
query(select_sql);
|
||||
}
|
||||
|
|
@ -2039,7 +2039,7 @@ void MysqlDataset::cancel()
|
|||
{
|
||||
if ((ds_state == dsInsert) || (ds_state == dsEdit))
|
||||
{
|
||||
if (result.record_header.size())
|
||||
if (!result.record_header.empty())
|
||||
ds_state = dsSelect;
|
||||
else
|
||||
ds_state = dsInactive;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ int callback(void* res_ptr, int ncol, char** result, char** cols)
|
|||
{
|
||||
result_set* r = static_cast<result_set*>(res_ptr);
|
||||
|
||||
if (!r->record_header.size())
|
||||
if (r->record_header.empty())
|
||||
{
|
||||
r->record_header.reserve(ncol);
|
||||
for (int i = 0; i < ncol; i++)
|
||||
|
|
@ -380,7 +380,7 @@ bool SqliteDatabase::exists(void)
|
|||
snprintf(sqlcmd, sizeof(sqlcmd), "SELECT * FROM sqlite_master");
|
||||
if ((last_err = sqlite3_exec(getHandle(), sqlcmd, &callback, &res, NULL)) == SQLITE_OK)
|
||||
{
|
||||
bRet = (res.records.size() > 0);
|
||||
bRet = (!res.records.empty());
|
||||
}
|
||||
|
||||
return bRet;
|
||||
|
|
@ -794,7 +794,7 @@ void SqliteDataset::fill_fields()
|
|||
(result.records.size() < (unsigned int)frecno))
|
||||
return;
|
||||
|
||||
if (fields_object->size() == 0) // Filling columns name
|
||||
if (fields_object->empty()) // Filling columns name
|
||||
{
|
||||
const unsigned int ncols = result.record_header.size();
|
||||
fields_object->resize(ncols);
|
||||
|
|
@ -807,7 +807,7 @@ void SqliteDataset::fill_fields()
|
|||
}
|
||||
|
||||
//Filling result
|
||||
if (result.records.size() != 0)
|
||||
if (!result.records.empty())
|
||||
{
|
||||
const sql_record* row = result.records[frecno];
|
||||
if (row)
|
||||
|
|
@ -998,7 +998,7 @@ void SqliteDataset::open(const std::string& sql)
|
|||
|
||||
void SqliteDataset::open()
|
||||
{
|
||||
if (select_sql.size())
|
||||
if (!select_sql.empty())
|
||||
{
|
||||
query(select_sql);
|
||||
}
|
||||
|
|
@ -1022,7 +1022,7 @@ void SqliteDataset::cancel()
|
|||
{
|
||||
if ((ds_state == dsInsert) || (ds_state == dsEdit))
|
||||
{
|
||||
if (result.record_header.size())
|
||||
if (!result.record_header.empty())
|
||||
ds_state = dsSelect;
|
||||
else
|
||||
ds_state = dsInactive;
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ void CGUIDialogContextMenu::OnInitWindow()
|
|||
|
||||
void CGUIDialogContextMenu::SetupButtons()
|
||||
{
|
||||
if (!m_buttons.size())
|
||||
if (m_buttons.empty())
|
||||
return;
|
||||
|
||||
// disable the template button control
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ void CGUIDialogExtendedProgressBar::UpdateState(unsigned int currentTime)
|
|||
}
|
||||
}
|
||||
|
||||
if (!m_handles.size())
|
||||
if (m_handles.empty())
|
||||
{
|
||||
Close(false, 0, true, false);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ void CGUIDialogFileBrowser::Update(const std::string &strDirectory)
|
|||
|
||||
std::string strPath2 = m_Directory->GetPath();
|
||||
URIUtils::RemoveSlashAtEnd(strPath2);
|
||||
strSelectedItem = m_history.GetSelectedItem(strPath2==""?"empty":strPath2);
|
||||
strSelectedItem = m_history.GetSelectedItem(strPath2.empty() ? "empty" : strPath2);
|
||||
|
||||
bool bSelectedFound = false;
|
||||
for (int i = 0; i < m_vecItems->Size(); ++i)
|
||||
|
|
@ -822,7 +822,7 @@ bool CGUIDialogFileBrowser::ShowAndGetFileList(const std::vector<CMediaSource>&
|
|||
bool confirmed(browser->IsConfirmed());
|
||||
if (confirmed)
|
||||
{
|
||||
if (browser->m_markedPath.size())
|
||||
if (!browser->m_markedPath.empty())
|
||||
path = browser->m_markedPath;
|
||||
else
|
||||
path.push_back(browser->m_selectedPath);
|
||||
|
|
@ -910,7 +910,7 @@ bool CGUIDialogFileBrowser::ShowAndGetSource(
|
|||
void CGUIDialogFileBrowser::SetSources(const std::vector<CMediaSource>& shares)
|
||||
{
|
||||
m_shares = shares;
|
||||
if (!m_shares.size() && m_addSourceType.empty())
|
||||
if (m_shares.empty() && m_addSourceType.empty())
|
||||
CServiceBroker::GetMediaManager().GetLocalDrives(m_shares);
|
||||
m_rootDir.SetSources(m_shares);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ void CGUIDialogKeyboardGeneric::NormalCharacter(const std::string &ch)
|
|||
|
||||
void CGUIDialogKeyboardGeneric::Backspace()
|
||||
{
|
||||
if (m_codingtable && m_hzcode.length() > 0)
|
||||
if (m_codingtable && !m_hzcode.empty())
|
||||
{
|
||||
std::wstring tmp;
|
||||
g_charsetConverter.utf8ToW(m_hzcode, tmp);
|
||||
|
|
@ -579,7 +579,7 @@ void CGUIDialogKeyboardGeneric::OnDeinitWindow(int nextWindowID)
|
|||
|
||||
void CGUIDialogKeyboardGeneric::MoveCursor(int iAmount)
|
||||
{
|
||||
if (m_codingtable && m_words.size())
|
||||
if (m_codingtable && !m_words.empty())
|
||||
ChangeWordList(iAmount);
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -291,7 +291,10 @@ void CGUIDialogMediaSource::OnPathBrowse(int item)
|
|||
extraShares.push_back(share1);
|
||||
}
|
||||
|
||||
if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_AUDIOCDS_RECORDINGPATH) != "")
|
||||
if (!CServiceBroker::GetSettingsComponent()
|
||||
->GetSettings()
|
||||
->GetString(CSettings::SETTING_AUDIOCDS_RECORDINGPATH)
|
||||
.empty())
|
||||
{
|
||||
share1.strPath = "special://recordings/";
|
||||
share1.strName = g_localizeStrings.Get(21883);
|
||||
|
|
@ -391,7 +394,10 @@ void CGUIDialogMediaSource::OnPathBrowse(int item)
|
|||
#endif
|
||||
|
||||
share1.m_ignore = true;
|
||||
if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_DEBUG_SCREENSHOTPATH) != "")
|
||||
if (!CServiceBroker::GetSettingsComponent()
|
||||
->GetSettings()
|
||||
->GetString(CSettings::SETTING_DEBUG_SCREENSHOTPATH)
|
||||
.empty())
|
||||
{
|
||||
share1.strPath = "special://screenshots/";
|
||||
share1.strName = g_localizeStrings.Get(20008);
|
||||
|
|
@ -406,7 +412,8 @@ void CGUIDialogMediaSource::OnPathBrowse(int item)
|
|||
{
|
||||
// nothing to add
|
||||
}
|
||||
if (CGUIDialogFileBrowser::ShowAndGetSource(path, allowNetworkShares, extraShares.size() == 0 ? NULL : &extraShares))
|
||||
if (CGUIDialogFileBrowser::ShowAndGetSource(path, allowNetworkShares,
|
||||
extraShares.empty() ? NULL : &extraShares))
|
||||
{
|
||||
if (item < m_paths->Size()) // if the skin does funky things, m_paths may have been cleared
|
||||
m_paths->Get(item)->SetPath(path);
|
||||
|
|
@ -506,7 +513,7 @@ void CGUIDialogMediaSource::SetShare(const CMediaSource &share)
|
|||
CFileItemPtr item(new CFileItem(share.vecPaths[i], true));
|
||||
m_paths->Add(item);
|
||||
}
|
||||
if (0 == share.vecPaths.size())
|
||||
if (share.vecPaths.empty())
|
||||
{
|
||||
CFileItemPtr item(new CFileItem("", true));
|
||||
m_paths->Add(item);
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ void CGUIDialogSelect::SetItems(const CFileItemList& pList)
|
|||
|
||||
int CGUIDialogSelect::GetSelectedItem() const
|
||||
{
|
||||
return m_selectedItems.size() > 0 ? m_selectedItems[0] : -1;
|
||||
return !m_selectedItems.empty() ? m_selectedItems[0] : -1;
|
||||
}
|
||||
|
||||
const CFileItemPtr CGUIDialogSelect::GetSelectedFileItem() const
|
||||
|
|
|
|||
|
|
@ -502,7 +502,7 @@ void CGUIDialogSmartPlaylistEditor::OnInitWindow()
|
|||
if (type == allowedType)
|
||||
allowed = true;
|
||||
}
|
||||
if (!allowed && allowedTypes.size())
|
||||
if (!allowed && !allowedTypes.empty())
|
||||
m_playlist.SetType(ConvertType(allowedTypes[0]));
|
||||
|
||||
UpdateButtons();
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ void CCurlFile::SetCommonOptions(CReadState* state, bool failOnError /* = true *
|
|||
}
|
||||
|
||||
// allow passive mode for ftp
|
||||
if( m_ftpport.length() > 0 )
|
||||
if (!m_ftpport.empty())
|
||||
g_curlInterface.easy_setopt(h, CURLOPT_FTPPORT, m_ftpport.c_str());
|
||||
else
|
||||
g_curlInterface.easy_setopt(h, CURLOPT_FTPPORT, NULL);
|
||||
|
|
@ -612,13 +612,13 @@ void CCurlFile::SetCommonOptions(CReadState* state, bool failOnError /* = true *
|
|||
g_curlInterface.easy_setopt(h, CURLOPT_FTP_SKIP_PASV_IP, 1);
|
||||
|
||||
// setup Accept-Encoding if requested
|
||||
if (m_acceptencoding.length() > 0)
|
||||
if (!m_acceptencoding.empty())
|
||||
g_curlInterface.easy_setopt(h, CURLOPT_ACCEPT_ENCODING, m_acceptencoding == "all" ? "" : m_acceptencoding.c_str());
|
||||
|
||||
if (!m_acceptCharset.empty())
|
||||
SetRequestHeader("Accept-Charset", m_acceptCharset);
|
||||
|
||||
if (m_userAgent.length() > 0)
|
||||
if (!m_userAgent.empty())
|
||||
g_curlInterface.easy_setopt(h, CURLOPT_USERAGENT, m_userAgent.c_str());
|
||||
else /* set some default agent as shoutcast doesn't return proper stuff otherwise */
|
||||
g_curlInterface.easy_setopt(h, CURLOPT_USERAGENT, CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_userAgent.c_str());
|
||||
|
|
@ -641,7 +641,7 @@ void CCurlFile::SetCommonOptions(CReadState* state, bool failOnError /* = true *
|
|||
if (!userpass.empty())
|
||||
g_curlInterface.easy_setopt(h, CURLOPT_PROXYUSERPWD, userpass.c_str());
|
||||
}
|
||||
if (m_customrequest.length() > 0)
|
||||
if (!m_customrequest.empty())
|
||||
{
|
||||
g_curlInterface.easy_setopt(h, CURLOPT_CUSTOMREQUEST, m_customrequest.c_str());
|
||||
if (StringUtils::CompareNoCase(m_customrequest, "HEAD") == 0)
|
||||
|
|
@ -927,7 +927,7 @@ void CCurlFile::ParseAndCorrectUrl(CURL &url2)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (name.length() > 0 && name[0] == '!')
|
||||
if (!name.empty() && name[0] == '!')
|
||||
{
|
||||
SetRequestHeader(it.first.substr(1), value);
|
||||
CLog::LogFC(LOGDEBUG, LOGCURL, "<{}> Adding custom header option '{}: ***********'",
|
||||
|
|
@ -951,7 +951,7 @@ void CCurlFile::ParseAndCorrectUrl(CURL &url2)
|
|||
// Unset the protocol options to have an url without protocol options
|
||||
url2.SetProtocolOptions("");
|
||||
|
||||
if (m_username.length() > 0 && m_password.length() > 0)
|
||||
if (!m_username.empty() && !m_password.empty())
|
||||
m_url = url2.GetWithoutUserDetails();
|
||||
else
|
||||
m_url = url2.Get();
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ bool CFTPDirectory::GetDirectory(const CURL& url2, CFileItemList &items)
|
|||
CFTPParse parse;
|
||||
if (parse.FTPParse(strBuffer))
|
||||
{
|
||||
if( parse.getName().length() == 0 )
|
||||
if (parse.getName().empty())
|
||||
continue;
|
||||
|
||||
if( parse.getFlagtrycwd() == 0 && parse.getFlagtryretr() == 0 )
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ void CFTPParse::setTime(const std::string& str)
|
|||
time_struct.tm_min = std::stol(minute);
|
||||
|
||||
/* set the second if given*/
|
||||
if (second.length() > 0)
|
||||
if (!second.empty())
|
||||
time_struct.tm_sec = std::stol(second);
|
||||
}
|
||||
// Regex to read MSDOS time format
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ bool CHTTPDirectory::GetDirectory(const CURL& url, CFileItemList &items)
|
|||
|
||||
/* read response from server into string buffer */
|
||||
std::string strBuffer;
|
||||
if (http.ReadData(strBuffer) && strBuffer.length() > 0)
|
||||
if (http.ReadData(strBuffer) && !strBuffer.empty())
|
||||
{
|
||||
/* if Content-Length is found and its not text/html, URL is pointing to file so don't treat URL as HTTPDirectory */
|
||||
if (!http.GetHttpHeader().GetValue("Content-Length").empty() &&
|
||||
|
|
@ -179,7 +179,7 @@ bool CHTTPDirectory::GetDirectory(const CURL& url, CFileItemList &items)
|
|||
|
||||
// we detect http directory items by its display name and its stripped link
|
||||
// if same, we consider it as a valid item.
|
||||
if (strLinkTemp != ".." && strLinkTemp != "" && NameMatchesLink(strNameTemp, strLinkTemp))
|
||||
if (strLinkTemp != ".." && !strLinkTemp.empty() && NameMatchesLink(strNameTemp, strLinkTemp))
|
||||
{
|
||||
CFileItemPtr pItem(new CFileItem(strNameTemp));
|
||||
pItem->SetProperty("IsHTTPDirectory", true);
|
||||
|
|
@ -244,10 +244,10 @@ bool CHTTPDirectory::GetDirectory(const CURL& url, CFileItemList &items)
|
|||
minute = reDateTime.GetMatch(5);
|
||||
}
|
||||
|
||||
if (month.length() > 0)
|
||||
if (!month.empty())
|
||||
monthNum = CDateTime::MonthStringToMonthNum(month);
|
||||
|
||||
if (day.length() > 0 && monthNum > 0 && year.length() > 0)
|
||||
if (!day.empty() && monthNum > 0 && !year.empty())
|
||||
{
|
||||
pItem->m_dateTime = CDateTime(atoi(year.c_str()), monthNum, atoi(day.c_str()), atoi(hour.c_str()), atoi(minute.c_str()), 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ void IDirectory::SetMask(const std::string& strMask)
|
|||
m_strFileMask = strMask;
|
||||
// ensure it's completed with a | so that filtering is easy.
|
||||
StringUtils::ToLower(m_strFileMask);
|
||||
if (m_strFileMask.size() && m_strFileMask[m_strFileMask.size() - 1] != '|')
|
||||
if (!m_strFileMask.empty() && m_strFileMask[m_strFileMask.size() - 1] != '|')
|
||||
m_strFileMask += '|';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ VideoDbContentType CVideoDatabaseFile::GetType(const CURL& url)
|
|||
return VideoDbContentType::UNKNOWN;
|
||||
|
||||
std::vector<std::string> pathElem = StringUtils::Split(strPath, "/");
|
||||
if (pathElem.size() == 0)
|
||||
if (pathElem.empty())
|
||||
return VideoDbContentType::UNKNOWN;
|
||||
|
||||
const std::string& itemType = pathElem.at(2);
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ void CVirtualDirectory::GetSources(std::vector<CMediaSource>& shares) const
|
|||
{
|
||||
share.strStatus = CServiceBroker::GetMediaManager().GetDiskLabel(share.strPath);
|
||||
share.strDiskUniqueId = CServiceBroker::GetMediaManager().GetDiskUniqueId(share.strPath);
|
||||
if (!share.strPath.length()) // unmounted CD
|
||||
if (share.strPath.empty()) // unmounted CD
|
||||
{
|
||||
if (CServiceBroker::GetMediaManager().GetDiscPath() == "iso9660://")
|
||||
share.strPath = "iso9660://";
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace XFILE
|
|||
{
|
||||
std::vector<SZipEntry> items;
|
||||
g_ZipManager.GetZipList(url, items);
|
||||
if (items.size())
|
||||
if (!items.empty())
|
||||
{
|
||||
if (items.size() > 1)
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ bool CGUIAction::HasActionsMeetingCondition() const
|
|||
|
||||
bool CGUIAction::HasAnyActions() const
|
||||
{
|
||||
return m_actions.size() > 0;
|
||||
return !m_actions.empty();
|
||||
}
|
||||
|
||||
size_t CGUIAction::GetActionCount() const
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ void CGUIBaseContainer::Process(unsigned int currentTime, CDirtyRegionList &dirt
|
|||
end += cacheAfter * m_layout->Size(m_orientation);
|
||||
|
||||
int current = offset - cacheBefore;
|
||||
while (pos < end && m_items.size())
|
||||
while (pos < end && !m_items.empty())
|
||||
{
|
||||
int itemNo = CorrectOffset(current, 0);
|
||||
if (itemNo >= (int)m_items.size())
|
||||
|
|
@ -288,7 +288,7 @@ void CGUIBaseContainer::Render()
|
|||
int current = offset - cacheBefore;
|
||||
|
||||
std::vector<RENDERITEM> renderitems;
|
||||
while (pos < end && m_items.size())
|
||||
while (pos < end && !m_items.empty())
|
||||
{
|
||||
int itemNo = CorrectOffset(current, 0);
|
||||
if (itemNo >= (int)m_items.size())
|
||||
|
|
@ -467,7 +467,7 @@ bool CGUIBaseContainer::OnAction(const CAction &action)
|
|||
return true;
|
||||
|
||||
case ACTION_LAST_PAGE:
|
||||
if (m_items.size())
|
||||
if (!m_items.empty())
|
||||
SelectItem(m_items.size() - 1);
|
||||
return true;
|
||||
|
||||
|
|
@ -644,7 +644,7 @@ void CGUIBaseContainer::OnNextLetter()
|
|||
void CGUIBaseContainer::OnPrevLetter()
|
||||
{
|
||||
int offset = CorrectOffset(GetOffset(), GetCursor());
|
||||
if (!m_letterOffsets.size())
|
||||
if (m_letterOffsets.empty())
|
||||
return;
|
||||
for (int i = (int)m_letterOffsets.size() - 1; i >= 0; i--)
|
||||
{
|
||||
|
|
@ -666,7 +666,7 @@ void CGUIBaseContainer::OnJumpLetter(const std::string& letter, bool skip /*=fal
|
|||
m_matchTimer.StartZero();
|
||||
|
||||
// we can't jump through letters if we have none
|
||||
if (0 == m_letterOffsets.size())
|
||||
if (m_letterOffsets.empty())
|
||||
return;
|
||||
|
||||
// find the current letter we're focused on
|
||||
|
|
@ -701,7 +701,7 @@ void CGUIBaseContainer::OnJumpSMS(int letter)
|
|||
static const char letterMap[8][6] = { "ABC2", "DEF3", "GHI4", "JKL5", "MNO6", "PQRS7", "TUV8", "WXYZ9" };
|
||||
|
||||
// only 2..9 supported
|
||||
if (letter < 2 || letter > 9 || !m_letterOffsets.size())
|
||||
if (letter < 2 || letter > 9 || m_letterOffsets.empty())
|
||||
return;
|
||||
|
||||
const std::string letters = letterMap[letter - 2];
|
||||
|
|
@ -757,7 +757,7 @@ int CGUIBaseContainer::GetSelectedItem() const
|
|||
|
||||
std::shared_ptr<CGUIListItem> CGUIBaseContainer::GetListItem(int offset, unsigned int flag) const
|
||||
{
|
||||
if (!m_items.size() || !m_layout)
|
||||
if (m_items.empty() || !m_layout)
|
||||
return std::shared_ptr<CGUIListItem>();
|
||||
int item = GetSelectedItem() + offset;
|
||||
if (flag & INFOFLAG_LISTITEM_POSITION) // use offset from the first item displayed, taking into account scrolling
|
||||
|
|
@ -1405,7 +1405,8 @@ bool CGUIBaseContainer::GetCondition(int condition, int data) const
|
|||
case CONTAINER_HAS_PREVIOUS:
|
||||
return (HasPreviousPage());
|
||||
case CONTAINER_HAS_PARENT_ITEM:
|
||||
return (m_items.size() && m_items[0]->IsFileItem() && (std::static_pointer_cast<CFileItem>(m_items[0]))->IsParentFolder());
|
||||
return (!m_items.empty() && m_items[0]->IsFileItem() &&
|
||||
(std::static_pointer_cast<CFileItem>(m_items[0]))->IsParentFolder());
|
||||
case CONTAINER_SUBITEM:
|
||||
{
|
||||
CGUIListItemLayout *layout = GetFocusedLayout();
|
||||
|
|
@ -1473,7 +1474,8 @@ std::string CGUIBaseContainer::GetLabel(int info) const
|
|||
break;
|
||||
case CONTAINER_CURRENT_ITEM:
|
||||
{
|
||||
if (m_items.size() && m_items[0]->IsFileItem() && (std::static_pointer_cast<CFileItem>(m_items[0]))->IsParentFolder())
|
||||
if (!m_items.empty() && m_items[0]->IsFileItem() &&
|
||||
(std::static_pointer_cast<CFileItem>(m_items[0]))->IsParentFolder())
|
||||
label = std::to_string(GetSelectedItem());
|
||||
else
|
||||
label = std::to_string(GetSelectedItem() + 1);
|
||||
|
|
|
|||
|
|
@ -491,7 +491,7 @@ bool CGUIControlFactory::GetConditionalVisibility(const TiXmlNode* control,
|
|||
conditions.emplace_back(node->FirstChild()->Value());
|
||||
node = node->NextSiblingElement("visible");
|
||||
}
|
||||
if (!conditions.size())
|
||||
if (conditions.empty())
|
||||
return false;
|
||||
if (conditions.size() == 1)
|
||||
condition = conditions[0];
|
||||
|
|
@ -643,7 +643,7 @@ void CGUIControlFactory::GetInfoLabel(const TiXmlNode* pControlNode,
|
|||
{
|
||||
std::vector<GUIINFO::CGUIInfoLabel> labels;
|
||||
GetInfoLabels(pControlNode, labelTag, labels, parentID);
|
||||
if (labels.size())
|
||||
if (!labels.empty())
|
||||
infoLabel = labels[0];
|
||||
}
|
||||
|
||||
|
|
@ -698,7 +698,7 @@ void CGUIControlFactory::GetInfoLabels(const TiXmlNode* pControlNode,
|
|||
if (infoNode)
|
||||
{ // <info> nodes override <label>'s (backward compatibility)
|
||||
std::string fallback;
|
||||
if (infoLabels.size())
|
||||
if (!infoLabels.empty())
|
||||
fallback = infoLabels[0].GetLabel(0);
|
||||
infoLabels.clear();
|
||||
while (infoNode)
|
||||
|
|
@ -1618,7 +1618,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID,
|
|||
CGUITextBox* tcontrol = static_cast<CGUITextBox*>(control);
|
||||
|
||||
tcontrol->SetPageControl(pageControl);
|
||||
if (infoLabels.size())
|
||||
if (!infoLabels.empty())
|
||||
tcontrol->SetInfo(infoLabels[0]);
|
||||
tcontrol->SetAutoScrolling(pControlNode);
|
||||
tcontrol->SetMinHeight(minHeight);
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ bool CGUIControlGroup::CanFocus() const
|
|||
void CGUIControlGroup::AssignDepth()
|
||||
{
|
||||
CGUIControl* focusedControl = nullptr;
|
||||
if (m_children.size())
|
||||
if (!m_children.empty())
|
||||
{
|
||||
for (auto* control : m_children)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ void CGUIControlGroupList::AddControl(CGUIControl *control, int position /*= -1*
|
|||
{ // set the navigation of items so that they form a list
|
||||
CGUIAction beforeAction = GetAction((m_orientation == VERTICAL) ? ACTION_MOVE_UP : ACTION_MOVE_LEFT);
|
||||
CGUIAction afterAction = GetAction((m_orientation == VERTICAL) ? ACTION_MOVE_DOWN : ACTION_MOVE_RIGHT);
|
||||
if (m_children.size())
|
||||
if (!m_children.empty())
|
||||
{
|
||||
// we're inserting at the given position, so grab the items above and below and alter
|
||||
// their navigation accordingly
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ void CGUIControlProfilerItem::SaveToXML(TiXmlElement *parent)
|
|||
elem->LinkEndChild(text);
|
||||
}
|
||||
|
||||
if (m_vecChildren.size())
|
||||
if (!m_vecChildren.empty())
|
||||
{
|
||||
TiXmlElement *xmlChilds = new TiXmlElement("children");
|
||||
xmlControl->LinkEndChild(xmlChilds);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ void CGUIDialog::OnWindowLoaded()
|
|||
CGUIWindow::OnWindowLoaded();
|
||||
|
||||
// Clip labels to extents
|
||||
if (m_children.size())
|
||||
if (!m_children.empty())
|
||||
{
|
||||
CGUIControl* pBase = m_children[0];
|
||||
|
||||
|
|
|
|||
|
|
@ -742,7 +742,7 @@ void CGUIEditControl::OnPasteClipboard()
|
|||
g_charsetConverter.utf8ToW(utf8_text, unicode_text, false);
|
||||
|
||||
// Insert the pasted text at the current cursor position.
|
||||
if (unicode_text.length() > 0)
|
||||
if (!unicode_text.empty())
|
||||
{
|
||||
std::wstring left_end = m_text2.substr(0, m_cursorPos);
|
||||
std::wstring right_end = m_text2.substr(m_cursorPos);
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ void CGUIFixedListContainer::GetCursorRange(int &minCursor, int &maxCursor) cons
|
|||
minCursor = std::max(m_fixedCursor - m_cursorRange, 0);
|
||||
maxCursor = std::min(m_fixedCursor + m_cursorRange, m_itemsPerPage);
|
||||
|
||||
if (!m_items.size())
|
||||
if (m_items.empty())
|
||||
{
|
||||
minCursor = m_fixedCursor;
|
||||
maxCursor = m_fixedCursor;
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ void CGUIFont::DrawScrollingText(float x,
|
|||
if (!shadowColor)
|
||||
shadowColor = m_shadowColor;
|
||||
|
||||
if (!text.size() || ClippedRegionIsEmpty(context, x, y, maxWidth, alignment))
|
||||
if (text.empty() || ClippedRegionIsEmpty(context, x, y, maxWidth, alignment))
|
||||
return; // nothing to render
|
||||
|
||||
if (!scrollInfo.m_widthValid)
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ bool CGUIKeyboardFactory::ShowAndVerifyNewPassword(std::string& newPassword, uns
|
|||
int CGUIKeyboardFactory::ShowAndVerifyPassword(std::string& strPassword, const std::string& strHeading, int iRetries, unsigned int autoCloseMs /* = 0 */)
|
||||
{
|
||||
std::string strHeadingTemp;
|
||||
if (1 > iRetries && strHeading.size())
|
||||
if (1 > iRetries && !strHeading.empty())
|
||||
strHeadingTemp = strHeading;
|
||||
else
|
||||
strHeadingTemp =
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ void CGUIMessage::SetLabel(int iString)
|
|||
void CGUIMessage::SetStringParam(const std::string& strParam)
|
||||
{
|
||||
m_params.clear();
|
||||
if (strParam.size())
|
||||
if (!strParam.empty())
|
||||
m_params.push_back(strParam);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ void CGUIPanelContainer::Process(unsigned int currentTime, CDirtyRegionList &dir
|
|||
|
||||
int current = (offset - cacheBefore) * m_itemsPerRow;
|
||||
int col = 0;
|
||||
while (pos < end && m_items.size())
|
||||
while (pos < end && !m_items.empty())
|
||||
{
|
||||
if (current >= (int)m_items.size())
|
||||
break;
|
||||
|
|
@ -115,7 +115,7 @@ void CGUIPanelContainer::Render()
|
|||
int current = (offset - cacheBefore) * m_itemsPerRow;
|
||||
int col = 0;
|
||||
std::vector<RENDERITEM> renderitems;
|
||||
while (pos < end && m_items.size())
|
||||
while (pos < end && !m_items.empty())
|
||||
{
|
||||
if (current >= (int)m_items.size())
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ void CGUIRSSControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyre
|
|||
}
|
||||
else
|
||||
{
|
||||
if (m_strRSSTags != "")
|
||||
if (!m_strRSSTags.empty())
|
||||
{
|
||||
std::vector<std::string> tags = StringUtils::Split(m_strRSSTags, ",");
|
||||
for (const std::string& i : tags)
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ void CGUITextBox::Render()
|
|||
int current = offset;
|
||||
|
||||
// set the main text color
|
||||
if (m_colors.size())
|
||||
if (!m_colors.empty())
|
||||
m_colors[0] = m_label.textColor;
|
||||
|
||||
while (posY < m_posY + m_renderHeight && current < (int)m_lines.size())
|
||||
|
|
@ -246,7 +246,7 @@ void CGUITextBox::Render()
|
|||
const CGUIString& lineString = m_lines[current];
|
||||
uint32_t align = alignment;
|
||||
|
||||
if (lineString.m_text.size() && lineString.m_carriageReturn)
|
||||
if (!lineString.m_text.empty() && lineString.m_carriageReturn)
|
||||
align &= ~XBFONT_JUSTIFIED; // last line of a paragraph shouldn't be justified
|
||||
|
||||
m_font->DrawText(posX, posY, m_colors, m_label.shadowColor, lineString.m_text, align,
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void CGUITextLayout::Render(float x,
|
|||
return;
|
||||
|
||||
// set the main text color
|
||||
if (m_colors.size())
|
||||
if (!m_colors.empty())
|
||||
m_colors[0] = color;
|
||||
|
||||
// render the text at the required location, angle, and size
|
||||
|
|
@ -117,7 +117,7 @@ void CGUITextLayout::RenderScrolling(float x,
|
|||
return;
|
||||
|
||||
// set the main text color
|
||||
if (m_colors.size())
|
||||
if (!m_colors.empty())
|
||||
m_colors[0] = color;
|
||||
|
||||
// render the text at the required location, angle, and size
|
||||
|
|
@ -161,7 +161,7 @@ void CGUITextLayout::RenderOutline(float x,
|
|||
|
||||
// set the outline color
|
||||
std::vector<KODI::UTILS::COLOR::Color> outlineColors;
|
||||
if (m_colors.size())
|
||||
if (!m_colors.empty())
|
||||
outlineColors.push_back(outlineColor);
|
||||
|
||||
// center our text vertically
|
||||
|
|
@ -202,7 +202,7 @@ void CGUITextLayout::RenderOutline(float x,
|
|||
}
|
||||
|
||||
// set the main text color
|
||||
if (m_colors.size())
|
||||
if (!m_colors.empty())
|
||||
m_colors[0] = color;
|
||||
|
||||
m_font->Begin();
|
||||
|
|
@ -701,7 +701,7 @@ unsigned int CGUITextLayout::GetTextLength() const
|
|||
void CGUITextLayout::GetFirstText(vecText &text) const
|
||||
{
|
||||
text.clear();
|
||||
if (m_lines.size())
|
||||
if (!m_lines.empty())
|
||||
text = m_lines[0].m_text;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ void CGUITextureGL::Begin(KODI::UTILS::COLOR::Color color)
|
|||
|
||||
void CGUITextureGL::End()
|
||||
{
|
||||
if (m_packedVertices.size())
|
||||
if (!m_packedVertices.empty())
|
||||
{
|
||||
GLint posLoc = m_renderSystem->ShaderGetPos();
|
||||
GLint tex0Loc = m_renderSystem->ShaderGetCoord0();
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ void CGUITextureGLES::Begin(KODI::UTILS::COLOR::Color color)
|
|||
|
||||
void CGUITextureGLES::End()
|
||||
{
|
||||
if (m_packedVertices.size())
|
||||
if (!m_packedVertices.empty())
|
||||
{
|
||||
GLint posLoc = m_renderSystem->GUIShaderGetPos();
|
||||
GLint tex0Loc = m_renderSystem->GUIShaderGetCoord0();
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ void CGUIToggleButtonControl::SetLabel(const std::string &label)
|
|||
|
||||
void CGUIToggleButtonControl::SetAltLabel(const std::string &label)
|
||||
{
|
||||
if (label.size())
|
||||
if (!label.empty())
|
||||
m_selectButton.SetLabel(label);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -758,7 +758,7 @@ void CGUIWindow::AllocResources(bool forceLoad /*= false */)
|
|||
if (forceLoad)
|
||||
{
|
||||
std::string xmlFile = GetProperty("xmlfile").asString();
|
||||
if (xmlFile.size())
|
||||
if (!xmlFile.empty())
|
||||
{
|
||||
bool bHasPath =
|
||||
xmlFile.find('\\') != std::string::npos || xmlFile.find('/') != std::string::npos;
|
||||
|
|
|
|||
|
|
@ -862,7 +862,7 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const std::vector
|
|||
if (!pNewWindow->IsDialogRunning())
|
||||
{
|
||||
CSingleExit exitit(CServiceBroker::GetWinSystem()->GetGfxContext());
|
||||
static_cast<CGUIDialog *>(pNewWindow)->Open(params.size() > 0 ? params[0] : "");
|
||||
static_cast<CGUIDialog*>(pNewWindow)->Open(!params.empty() ? params[0] : "");
|
||||
// Invalidate underlying windows after closing a modal dialog
|
||||
MarkDirty();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ void CGUIWrappingListContainer::ValidateOffset()
|
|||
// no need to check the range here, but we need to check we have
|
||||
// more items than slots.
|
||||
ResetExtraItems();
|
||||
if (m_items.size())
|
||||
if (!m_items.empty())
|
||||
{
|
||||
size_t numItems = m_items.size();
|
||||
while (m_items.size() < minItems)
|
||||
|
|
@ -140,7 +140,7 @@ void CGUIWrappingListContainer::ValidateOffset()
|
|||
|
||||
int CGUIWrappingListContainer::CorrectOffset(int offset, int cursor) const
|
||||
{
|
||||
if (m_items.size())
|
||||
if (!m_items.empty())
|
||||
{
|
||||
int correctOffset = (offset + cursor) % (int)m_items.size();
|
||||
if (correctOffset < 0) correctOffset += m_items.size();
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ bool CGLSLPixelShader::Compile()
|
|||
Free();
|
||||
|
||||
// Pixel shaders are not mandatory.
|
||||
if (m_source.length()==0)
|
||||
if (m_source.empty())
|
||||
{
|
||||
CLog::Log(LOGINFO, "GL: No pixel shader, fixed pipeline in use");
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ CTextureMap::~CTextureMap()
|
|||
|
||||
bool CTextureMap::Release()
|
||||
{
|
||||
if (!m_texture.m_textures.size())
|
||||
if (m_texture.m_textures.empty())
|
||||
return true;
|
||||
if (!m_referenceCount)
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ bool CInputManager::ProcessEventServer(int windowId, float frameTime)
|
|||
|
||||
if (wKeyID)
|
||||
{
|
||||
if (strMapName.length() > 0)
|
||||
if (!strMapName.empty())
|
||||
{
|
||||
// joysticks are not supported via eventserver
|
||||
if (isJoystick)
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ static int EnableAddon(const std::vector<std::string>& params)
|
|||
*/
|
||||
static int RunPlugin(const std::vector<std::string>& params)
|
||||
{
|
||||
if (params.size())
|
||||
if (!params.empty())
|
||||
{
|
||||
CFileItem item(params[0]);
|
||||
if (!item.m_bIsFolder)
|
||||
|
|
@ -115,7 +115,7 @@ static int RunPlugin(const std::vector<std::string>& params)
|
|||
*/
|
||||
static int RunAddon(const std::vector<std::string>& params)
|
||||
{
|
||||
if (params.size())
|
||||
if (!params.empty())
|
||||
{
|
||||
const std::string& addonid = params[0];
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ static int ActivateWindow(const std::vector<std::string>& params2)
|
|||
std::vector<std::string> params(params2);
|
||||
// get the parameters
|
||||
std::string strWindow;
|
||||
if (params.size())
|
||||
if (!params.empty())
|
||||
{
|
||||
strWindow = params[0];
|
||||
params.erase(params.begin());
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ static int CleanLibrary(const std::vector<std::string>& params)
|
|||
bool userInitiated = true;
|
||||
if (params.size() > 1)
|
||||
userInitiated = StringUtils::EqualsNoCase(params[1], "true");
|
||||
if (!params.size() || StringUtils::EqualsNoCase(params[0], "video")
|
||||
|| StringUtils::EqualsNoCase(params[0], "movies")
|
||||
|| StringUtils::EqualsNoCase(params[0], "tvshows")
|
||||
|| StringUtils::EqualsNoCase(params[0], "musicvideos"))
|
||||
if (params.empty() || StringUtils::EqualsNoCase(params[0], "video") ||
|
||||
StringUtils::EqualsNoCase(params[0], "movies") ||
|
||||
StringUtils::EqualsNoCase(params[0], "tvshows") ||
|
||||
StringUtils::EqualsNoCase(params[0], "musicvideos"))
|
||||
{
|
||||
if (!CVideoLibraryQueue::GetInstance().IsScanningLibrary())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ std::string CJSONRPC::MethodCall(const std::string &inputString, ITransportLayer
|
|||
{
|
||||
if (inputroot.isArray())
|
||||
{
|
||||
if (inputroot.size() <= 0)
|
||||
if (inputroot.empty())
|
||||
{
|
||||
CLog::Log(LOGERROR, "JSONRPC: Empty batch call");
|
||||
BuildResponse(inputroot, InvalidRequest, CVariant(), outputroot);
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ bool JSONSchemaTypeDefinition::Parse(const CVariant &value, bool isParameter /*
|
|||
std::string refType = value["$ref"].asString();
|
||||
// Check if the referenced type exists
|
||||
JSONSchemaTypeDefinitionPtr referencedTypeDef = CJSONServiceDescription::GetType(refType);
|
||||
if (refType.length() <= 0 || referencedTypeDef.get() == NULL)
|
||||
if (refType.empty() || referencedTypeDef.get() == NULL)
|
||||
{
|
||||
CLog::Log(LOGDEBUG, "JSONRPC: JSON schema type {} references an unknown type {}", name,
|
||||
refType);
|
||||
|
|
@ -322,7 +322,7 @@ bool JSONSchemaTypeDefinition::Parse(const CVariant &value, bool isParameter /*
|
|||
if (value.isMember("default") && IsType(value["default"], type))
|
||||
{
|
||||
bool ok = false;
|
||||
if (enums.size() <= 0)
|
||||
if (enums.empty())
|
||||
ok = true;
|
||||
// If the type has an enum definition we must make
|
||||
// sure that the default value is a valid enum value
|
||||
|
|
@ -406,7 +406,7 @@ bool JSONSchemaTypeDefinition::Parse(const CVariant &value, bool isParameter /*
|
|||
|
||||
// Only read the "type" attribute if it's
|
||||
// not an extending type
|
||||
if (extends.size() <= 0)
|
||||
if (extends.empty())
|
||||
{
|
||||
// Get the defined type of the parameter
|
||||
if (!CJSONServiceDescription::parseJSONSchemaType(value["type"], unionTypes, type, missingReference))
|
||||
|
|
@ -621,7 +621,7 @@ bool JSONSchemaTypeDefinition::Parse(const CVariant &value, bool isParameter /*
|
|||
bool ok = false;
|
||||
if (value.isMember("default") && IsType(value["default"], type))
|
||||
{
|
||||
if (enums.size() <= 0)
|
||||
if (enums.empty())
|
||||
ok = true;
|
||||
// If the type has an enum definition we must make
|
||||
// sure that the default value is a valid enum value
|
||||
|
|
@ -649,7 +649,7 @@ bool JSONSchemaTypeDefinition::Parse(const CVariant &value, bool isParameter /*
|
|||
|
||||
// If the type contains an "enum" we need to get the
|
||||
// default value from the first enum value
|
||||
if (enums.size() > 0)
|
||||
if (!enums.empty())
|
||||
defaultValue = enums.at(0);
|
||||
// otherwise set a default value instead
|
||||
else
|
||||
|
|
@ -683,7 +683,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant& value,
|
|||
}
|
||||
|
||||
// Let's check if we have to handle a union type
|
||||
if (unionTypes.size() > 0)
|
||||
if (!unionTypes.empty())
|
||||
{
|
||||
bool ok = false;
|
||||
for (unsigned int unionIndex = 0; unionIndex < unionTypes.size(); unionIndex++)
|
||||
|
|
@ -708,7 +708,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant& value,
|
|||
// First we need to check if this type extends another
|
||||
// type and if so we need to check against the extended
|
||||
// type first
|
||||
if (extends.size() > 0)
|
||||
if (!extends.empty())
|
||||
{
|
||||
for (unsigned int extendsIndex = 0; extendsIndex < extends.size(); extendsIndex++)
|
||||
{
|
||||
|
|
@ -752,7 +752,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant& value,
|
|||
return InvalidParams;
|
||||
}
|
||||
|
||||
if (items.size() == 0)
|
||||
if (items.empty())
|
||||
outputValue = value;
|
||||
else if (items.size() == 1)
|
||||
{
|
||||
|
|
@ -786,7 +786,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant& value,
|
|||
// does not match the number of elements in the
|
||||
// "items" array and additional items are not
|
||||
// allowed there is no need to check every element
|
||||
if (value.size() < items.size() || (value.size() != items.size() && additionalItems.size() == 0))
|
||||
if (value.size() < items.size() || (value.size() != items.size() && additionalItems.empty()))
|
||||
{
|
||||
CLog::Log(LOGDEBUG, "JSONRPC: One of the array elements does not match in type {}", name);
|
||||
errorMessage = StringUtils::Format("{0} array elements expected but {1} received", items.size(), value.size());
|
||||
|
|
@ -811,7 +811,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant& value,
|
|||
}
|
||||
}
|
||||
|
||||
if (additionalItems.size() > 0)
|
||||
if (!additionalItems.empty())
|
||||
{
|
||||
// Loop through the rest of the elements
|
||||
// in the array and check them against the
|
||||
|
|
@ -948,7 +948,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant& value,
|
|||
|
||||
// If it can only take certain values ("enum")
|
||||
// we need to check against those
|
||||
if (enums.size() > 0)
|
||||
if (!enums.empty())
|
||||
{
|
||||
bool valid = false;
|
||||
for (const auto& enumItr : enums)
|
||||
|
|
@ -1075,7 +1075,7 @@ void JSONSchemaTypeDefinition::Print(bool isParameter, bool isGlobal, bool print
|
|||
for (unsigned int extendsIndex = 0; extendsIndex < extends.size(); extendsIndex++)
|
||||
output["extends"].append(extends.at(extendsIndex)->ID);
|
||||
}
|
||||
else if (unionTypes.size() > 0)
|
||||
else if (!unionTypes.empty())
|
||||
{
|
||||
output["type"] = CVariant(CVariant::VariantTypeArray);
|
||||
for (unsigned int unionIndex = 0; unionIndex < unionTypes.size(); unionIndex++)
|
||||
|
|
@ -1089,7 +1089,7 @@ void JSONSchemaTypeDefinition::Print(bool isParameter, bool isGlobal, bool print
|
|||
CJSONUtils::SchemaValueTypeToJson(type, output["type"]);
|
||||
|
||||
// Printing enum field
|
||||
if (enums.size() > 0)
|
||||
if (!enums.empty())
|
||||
{
|
||||
output["enums"] = CVariant(CVariant::VariantTypeArray);
|
||||
for (unsigned int enumIndex = 0; enumIndex < enums.size(); enumIndex++)
|
||||
|
|
@ -1706,7 +1706,7 @@ bool CJSONServiceDescription::AddNotification(const std::string &jsonNotificatio
|
|||
|
||||
bool CJSONServiceDescription::AddEnum(const std::string &name, const std::vector<CVariant> &values, CVariant::VariantType type /* = CVariant::VariantTypeNull */, const CVariant &defaultValue /* = CVariant::ConstNullVariant */)
|
||||
{
|
||||
if (name.empty() || m_types.contains(name) || values.size() == 0)
|
||||
if (name.empty() || m_types.contains(name) || values.empty())
|
||||
return false;
|
||||
|
||||
JSONSchemaTypeDefinitionPtr definition = std::make_shared<JSONSchemaTypeDefinition>();
|
||||
|
|
@ -1814,7 +1814,7 @@ JSONRPC_STATUS CJSONServiceDescription::Print(CVariant &result, ITransportLayer
|
|||
int clientPermissions = client->GetPermissionFlags();
|
||||
int transportCapabilities = transport->GetCapabilities();
|
||||
|
||||
if (filterByName.size() > 0)
|
||||
if (!filterByName.empty())
|
||||
{
|
||||
std::string name = filterByName;
|
||||
|
||||
|
|
@ -2085,7 +2085,7 @@ void CJSONServiceDescription::getReferencedTypes(const JSONSchemaTypeDefinitionP
|
|||
std::vector<std::string>& referencedTypes)
|
||||
{
|
||||
// If the current type is a referenceable object, we can add it to the list
|
||||
if (type->ID.size() > 0)
|
||||
if (!type->ID.empty())
|
||||
{
|
||||
for (unsigned int index = 0; index < referencedTypes.size(); index++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ namespace XBMCAddon
|
|||
SubtitleStreamInfo info;
|
||||
getAppPlayerMut()->GetSubtitleStreamInfo(CURRENT_STREAM, info);
|
||||
|
||||
if (info.language.length() > 0)
|
||||
if (!info.language.empty())
|
||||
return info.language;
|
||||
else
|
||||
return info.name;
|
||||
|
|
@ -526,7 +526,7 @@ namespace XBMCAddon
|
|||
SubtitleStreamInfo info;
|
||||
getAppPlayer()->GetSubtitleStreamInfo(iStream, info);
|
||||
|
||||
if (info.language.length() > 0)
|
||||
if (!info.language.empty())
|
||||
ret[iStream] = info.language;
|
||||
else
|
||||
ret[iStream] = info.name;
|
||||
|
|
@ -561,7 +561,7 @@ namespace XBMCAddon
|
|||
AudioStreamInfo info;
|
||||
getAppPlayerMut()->GetAudioStreamInfo(iStream, info);
|
||||
|
||||
if (info.language.length() > 0)
|
||||
if (!info.language.empty())
|
||||
ret[iStream] = info.language;
|
||||
else
|
||||
ret[iStream] = info.name;
|
||||
|
|
@ -591,7 +591,7 @@ namespace XBMCAddon
|
|||
VideoStreamInfo info;
|
||||
getAppPlayer()->GetVideoStreamInfo(iStream, info);
|
||||
|
||||
if (info.language.length() > 0)
|
||||
if (!info.language.empty())
|
||||
ret[iStream] = info.language;
|
||||
else
|
||||
ret[iStream] = info.name;
|
||||
|
|
|
|||
|
|
@ -4812,7 +4812,7 @@ bool CMusicDatabase::LookupCDDBInfo(bool bRequery /*=false*/)
|
|||
while (true)
|
||||
{
|
||||
std::string strTitle = cddb.getInexactTitle(i);
|
||||
if (strTitle == "")
|
||||
if (strTitle.empty())
|
||||
break;
|
||||
|
||||
const std::string& strArtist = cddb.getInexactArtist(i);
|
||||
|
|
@ -9978,7 +9978,7 @@ int CMusicDatabase::AddSource(const std::string& strName,
|
|||
|
||||
// Find albums by song path, building WHERE for multiple source paths
|
||||
// (providing source has a path)
|
||||
if (vecPaths.size() > 0)
|
||||
if (!vecPaths.empty())
|
||||
{
|
||||
std::vector<int> albumIds;
|
||||
Filter extFilter;
|
||||
|
|
@ -13972,7 +13972,7 @@ std::vector<std::string> CMusicDatabase::GetUsedImages(
|
|||
if (!m_pDB || !m_pDS)
|
||||
return imagesToCheck;
|
||||
|
||||
if (!imagesToCheck.size())
|
||||
if (imagesToCheck.empty())
|
||||
return {};
|
||||
|
||||
int artworkLevel = CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(
|
||||
|
|
|
|||
|
|
@ -117,8 +117,7 @@ void CSong::SetArtistCredits(const std::vector<std::string>& names, const std::v
|
|||
musicbrainz id so ignore them but raise warning.
|
||||
*/
|
||||
// Do hints exist yet mismatch
|
||||
if (artistHints.size() > 0 &&
|
||||
artistHints.size() != mbids.size())
|
||||
if (!artistHints.empty() && artistHints.size() != mbids.size())
|
||||
{
|
||||
if (names.size() == mbids.size())
|
||||
// Artist name count matches, use that as hints
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ void CMusicInfoScanner::Process()
|
|||
bool scancomplete = DoScan(it);
|
||||
if (scancomplete)
|
||||
{
|
||||
if (m_albumsAdded.size() > 0)
|
||||
if (!m_albumsAdded.empty())
|
||||
{
|
||||
// Set local art for added album disc sets and primary album artists
|
||||
if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(
|
||||
|
|
@ -1639,7 +1639,7 @@ CInfoScanner::InfoRet CMusicInfoScanner::DownloadAlbumInfo(const CAlbum& album,
|
|||
std::string strNewAlbum = album.strAlbum;
|
||||
if (!CGUIKeyboardFactory::ShowAndGetInput(strNewAlbum, CVariant{g_localizeStrings.Get(16011)}, false))
|
||||
return InfoRet::CANCELLED;
|
||||
if (strNewAlbum == "")
|
||||
if (strNewAlbum.empty())
|
||||
return InfoRet::CANCELLED;
|
||||
|
||||
std::string strNewArtist = album.GetAlbumArtistString();
|
||||
|
|
@ -2010,7 +2010,7 @@ bool CMusicInfoScanner::AddArtistArtwork(CArtist& artist, const std::string& art
|
|||
if (ret.second)
|
||||
m_musicDatabase.SetArtForItem(artist.idArtist, MediaTypeArtist, it.first, it.second);
|
||||
}
|
||||
return addedart.size() > 0;
|
||||
return !addedart.empty();
|
||||
}
|
||||
|
||||
bool CMusicInfoScanner::AddAlbumArtwork(CAlbum& album)
|
||||
|
|
@ -2133,7 +2133,7 @@ bool CMusicInfoScanner::AddAlbumArtwork(CAlbum& album)
|
|||
if (ret.second)
|
||||
m_musicDatabase.SetArtForItem(album.idAlbum, MediaTypeAlbum, it.first, it.second);
|
||||
}
|
||||
return addedart.size() > 0;
|
||||
return !addedart.empty();
|
||||
}
|
||||
|
||||
std::vector<CVariant> CMusicInfoScanner::GetArtWhitelist(const MediaType& mediaType, int iArtLevel)
|
||||
|
|
@ -2252,7 +2252,7 @@ bool CMusicInfoScanner::AddLocalArtwork(std::map<std::string, std::string>& art,
|
|||
}
|
||||
}
|
||||
|
||||
return art.size() > 0;
|
||||
return !art.empty();
|
||||
}
|
||||
|
||||
bool CMusicInfoScanner::AddRemoteArtwork(std::map<std::string, std::string>& art,
|
||||
|
|
@ -2298,7 +2298,7 @@ bool CMusicInfoScanner::AddRemoteArtwork(std::map<std::string, std::string>& art
|
|||
}
|
||||
}
|
||||
|
||||
return art.size() > 0;
|
||||
return !art.empty();
|
||||
}
|
||||
|
||||
// This function is the Run() function of the IRunnable
|
||||
|
|
|
|||
|
|
@ -152,13 +152,13 @@ void CMusicInfoScraper::Process()
|
|||
{
|
||||
try
|
||||
{
|
||||
if (m_strAlbum.size())
|
||||
if (!m_strAlbum.empty())
|
||||
{
|
||||
FindAlbumInfo();
|
||||
m_strAlbum.clear();
|
||||
m_strArtist.clear();
|
||||
}
|
||||
else if (m_strArtist.size())
|
||||
else if (!m_strArtist.empty())
|
||||
{
|
||||
FindArtistInfo();
|
||||
m_strArtist.clear();
|
||||
|
|
|
|||
|
|
@ -615,7 +615,7 @@ bool CTagLoaderTagLib::ParseTag(APE::Tag *ape, EmbeddedArt *art, CMusicInfoTag&
|
|||
mime = "image/gif";
|
||||
else if (bv.startsWith("\x42\x4D"))
|
||||
mime = "image/bmp";
|
||||
if ((offset > 0) && (offset <= tdata.size()) && (mime.size() > 0))
|
||||
if ((offset > 0) && (offset <= tdata.size()) && (!mime.empty()))
|
||||
{
|
||||
tag.SetCoverArtInfo(bv.size(), mime);
|
||||
if (art)
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ bool CGUIWindowMusicNav::OnMessage(CGUIMessage& message)
|
|||
if (!CGUIWindowMusicBase::OnMessage(message))
|
||||
return false;
|
||||
|
||||
if (message.GetStringParam(0) != "")
|
||||
if (!message.GetStringParam(0).empty())
|
||||
{
|
||||
CURL url(message.GetStringParam(0));
|
||||
|
||||
|
|
|
|||
|
|
@ -507,7 +507,7 @@ void CGUIWindowMusicPlayList::OnItemLoaded(CFileItem* pItem)
|
|||
if (nDuration > 0)
|
||||
pItem->SetLabel2(StringUtils::SecondsToTimeString(nDuration));
|
||||
}
|
||||
else if (pItem->GetLabel() == "") // pls labels come in preformatted
|
||||
else if (pItem->GetLabel().empty()) // pls labels come in preformatted
|
||||
{
|
||||
// FIXME: get the position of the item in the playlist
|
||||
// currently it is hacked into m_iprogramCount
|
||||
|
|
|
|||
|
|
@ -1078,11 +1078,11 @@ int CAirPlayServer::CTCPClient::ProcessRequest( std::string& responseHeader,
|
|||
else if (photoAction == "displayCached")
|
||||
{
|
||||
receivePhoto = false;
|
||||
if (photoCacheId.length())
|
||||
if (!photoCacheId.empty())
|
||||
CLog::Log(LOGDEBUG, "AIRPLAY: Trying to show from cache asset: {}", photoCacheId);
|
||||
}
|
||||
|
||||
if (photoCacheId.length())
|
||||
if (!photoCacheId.empty())
|
||||
tmpFileName += photoCacheId;
|
||||
else
|
||||
tmpFileName += "airplay_photo";
|
||||
|
|
@ -1107,7 +1107,7 @@ int CAirPlayServer::CTCPClient::ProcessRequest( std::string& responseHeader,
|
|||
writtenBytes = tmpFile.Write(m_httpParser->getBody(), m_httpParser->getContentLength());
|
||||
tmpFile.Close();
|
||||
}
|
||||
if (photoCacheId.length())
|
||||
if (!photoCacheId.empty())
|
||||
CLog::Log(LOGDEBUG, "AIRPLAY: Cached asset: {}", photoCacheId);
|
||||
}
|
||||
|
||||
|
|
@ -1118,7 +1118,7 @@ int CAirPlayServer::CTCPClient::ProcessRequest( std::string& responseHeader,
|
|||
if (!receivePhoto && !XFILE::CFile::Exists(tmpFileName))
|
||||
{
|
||||
status = AIRPLAY_STATUS_PRECONDITION_FAILED; //image not found in the cache
|
||||
if (photoCacheId.length())
|
||||
if (!photoCacheId.empty())
|
||||
CLog::Log(LOGWARNING, "AIRPLAY: Asset {} not found in our cache.", photoCacheId);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -122,11 +122,11 @@ void CAirTunesServer::RefreshMetadata()
|
|||
CGUIInfoManager& infoMgr = CServiceBroker::GetGUI()->GetInfoManager();
|
||||
if (infoMgr.GetCurrentSongTag())
|
||||
tag = *infoMgr.GetCurrentSongTag();
|
||||
if (m_metadata[0].length())
|
||||
if (!m_metadata[0].empty())
|
||||
tag.SetAlbum(m_metadata[0]);//album
|
||||
if (m_metadata[1].length())
|
||||
if (!m_metadata[1].empty())
|
||||
tag.SetTitle(m_metadata[1]);//title
|
||||
if (m_metadata[2].length())
|
||||
if (!m_metadata[2].empty())
|
||||
tag.SetArtist(m_metadata[2]);//artist
|
||||
|
||||
CServiceBroker::GetAppMessenger()->PostMsg(TMSG_UPDATE_CURRENT_ITEM, 1, -1,
|
||||
|
|
@ -158,11 +158,11 @@ void CAirTunesServer::SetMetadataFromBuffer(const char *buffer, unsigned int siz
|
|||
std::map<std::string, std::string> metadata = decodeDMAP(buffer, size);
|
||||
std::unique_lock lock(m_metadataLock);
|
||||
|
||||
if(metadata["asal"].length())
|
||||
if (!metadata["asal"].empty())
|
||||
m_metadata[0] = metadata["asal"];//album
|
||||
if(metadata["minm"].length())
|
||||
if (!metadata["minm"].empty())
|
||||
m_metadata[1] = metadata["minm"];//title
|
||||
if(metadata["asar"].length())
|
||||
if (!metadata["asar"].empty())
|
||||
m_metadata[2] = metadata["asar"];//artist
|
||||
|
||||
RefreshMetadata();
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ void CEventButtonState::Load()
|
|||
{
|
||||
if ( m_iKeyCode == 0 )
|
||||
{
|
||||
if ( (m_mapName.length() > 0) && (m_buttonName.length() > 0) )
|
||||
if ((!m_mapName.empty()) && (!m_buttonName.empty()))
|
||||
{
|
||||
m_iKeyCode = KEYMAP::CButtonTranslator::TranslateString(m_mapName, m_buttonName);
|
||||
if (m_iKeyCode == 0)
|
||||
|
|
@ -691,7 +691,7 @@ unsigned int CEventClient::GetButtonCode(std::string& strMapName, bool& isAxis,
|
|||
bcode = m_currentButton.KeyCode();
|
||||
strMapName = m_currentButton.JoystickName();
|
||||
isJoystick = true;
|
||||
if (strMapName.length() == 0)
|
||||
if (strMapName.empty())
|
||||
{
|
||||
strMapName = m_currentButton.CustomControllerName();
|
||||
isJoystick = false;
|
||||
|
|
@ -722,7 +722,7 @@ unsigned int CEventClient::GetButtonCode(std::string& strMapName, bool& isAxis,
|
|||
strMapName = it->JoystickName();
|
||||
isJoystick = true;
|
||||
|
||||
if (strMapName.length() == 0)
|
||||
if (strMapName.empty())
|
||||
{
|
||||
strMapName = it->CustomControllerName();
|
||||
isJoystick = false;
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ bool CNetworkBase::HasInterfaceForIP(unsigned long address)
|
|||
bool CNetworkBase::IsAvailable(void)
|
||||
{
|
||||
const std::vector<CNetworkInterface*>& ifaces = GetInterfaceList();
|
||||
return (ifaces.size() != 0);
|
||||
return (!ifaces.empty());
|
||||
}
|
||||
|
||||
bool CNetworkBase::IsConnected()
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ void CSocketListener::AddSocket(CBaseSocket *sock)
|
|||
|
||||
bool CSocketListener::Listen(int timeout)
|
||||
{
|
||||
if (m_sockets.size()==0)
|
||||
if (m_sockets.empty())
|
||||
{
|
||||
CLog::Log(LOGERROR, "SOCK: No sockets to listen for");
|
||||
throw LISTENEMPTY;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ void CTCPServer::Process()
|
|||
}
|
||||
}
|
||||
|
||||
if (response.size() <= 0)
|
||||
if (response.empty())
|
||||
m_connections[i]->PushBuffer(this, buffer, nread);
|
||||
|
||||
close = m_connections[i]->Closing();
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ bool CUdpClient::DispatchNextCommand()
|
|||
{
|
||||
std::unique_lock lock(critical_section);
|
||||
|
||||
if (commands.size() <= 0)
|
||||
if (commands.empty())
|
||||
return false;
|
||||
|
||||
COMMANDITERATOR it = commands.begin();
|
||||
|
|
|
|||
|
|
@ -750,7 +750,7 @@ void CUPnP::StopController()
|
|||
CUPnPServer* CUPnP::CreateServer(int port /* = 0 */)
|
||||
{
|
||||
CUPnPServer* device = new CUPnPServer(CSysInfo::GetDeviceName().c_str(),
|
||||
CUPnPSettings::GetInstance().GetServerUUID().length()
|
||||
!CUPnPSettings::GetInstance().GetServerUUID().empty()
|
||||
? CUPnPSettings::GetInstance().GetServerUUID().c_str()
|
||||
: NULL,
|
||||
port);
|
||||
|
|
@ -847,7 +847,7 @@ CUPnPRenderer* CUPnP::CreateRenderer(int port /* = 0 */)
|
|||
{
|
||||
CUPnPRenderer* device =
|
||||
new CUPnPRenderer(CSysInfo::GetDeviceName().c_str(), false,
|
||||
(CUPnPSettings::GetInstance().GetRendererUUID().length()
|
||||
(!CUPnPSettings::GetInstance().GetRendererUUID().empty()
|
||||
? CUPnPSettings::GetInstance().GetRendererUUID().c_str()
|
||||
: NULL),
|
||||
port);
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ bool CUPnPPlayer::OpenFile(const CFileItem& file, const CPlayerOptions& options)
|
|||
XbmcThreads::EndTime<> timeout(10s);
|
||||
|
||||
/* if no path we want to attach to a already playing player */
|
||||
if (file.GetPath() == "")
|
||||
if (file.GetPath().empty())
|
||||
{
|
||||
NPT_CHECK_LABEL_SEVERE(
|
||||
m_control->GetTransportInfo(m_delegate->m_device, m_delegate->m_instance, m_delegate.get()),
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ void CUPnPRenderer::UpdateState()
|
|||
// get duration
|
||||
buffer = StringUtils::SecondsToTimeString(std::lrint(g_application.GetTotalTime()),
|
||||
TIME_FORMAT_HH_MM_SS);
|
||||
if (buffer.length() > 0)
|
||||
if (!buffer.empty())
|
||||
{
|
||||
avt->SetStateVariable("CurrentTrackDuration", buffer.c_str());
|
||||
avt->SetStateVariable("CurrentMediaDuration", buffer.c_str());
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ void CPeripheral::GetSubdevices(PeripheralVector& subDevices) const
|
|||
|
||||
bool CPeripheral::IsMultiFunctional(void) const
|
||||
{
|
||||
return m_subDevices.size() > 0;
|
||||
return !m_subDevices.empty();
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<CSetting>> CPeripheral::GetSettings(void) const
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ void CGUIWindowSlideShow::StartSlideShow()
|
|||
{
|
||||
m_bSlideShow = true;
|
||||
m_iDirection = 1;
|
||||
if (m_slides.size())
|
||||
if (!m_slides.empty())
|
||||
AnnouncePlayerPlay(m_slides.at(m_iCurrentSlide));
|
||||
}
|
||||
|
||||
|
|
@ -867,7 +867,7 @@ bool CGUIWindowSlideShow::OnAction(const CAction &action)
|
|||
break;
|
||||
case ACTION_STOP:
|
||||
{
|
||||
if (m_slides.size())
|
||||
if (!m_slides.empty())
|
||||
AnnouncePlayerStop(m_slides.at(m_iCurrentSlide));
|
||||
auto& components = CServiceBroker::GetAppComponents();
|
||||
const auto appPlayer = components.GetComponent<CApplicationPlayer>();
|
||||
|
|
@ -909,7 +909,7 @@ bool CGUIWindowSlideShow::OnAction(const CAction &action)
|
|||
|
||||
case ACTION_PAUSE:
|
||||
case ACTION_PLAYER_PLAY:
|
||||
if (m_slides.size() == 0)
|
||||
if (m_slides.empty())
|
||||
break;
|
||||
if (IsVideo(*m_slides.at(m_iCurrentSlide)))
|
||||
{
|
||||
|
|
@ -1301,7 +1301,7 @@ void CGUIWindowSlideShow::AddFromPath(const std::string &strPath,
|
|||
SortBy method, SortOrder order, SortAttribute sortAttributes,
|
||||
const std::string &strExtensions)
|
||||
{
|
||||
if (strPath!="")
|
||||
if (!strPath.empty())
|
||||
{
|
||||
// reset the slideshow
|
||||
Reset();
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ bool CPicture::CacheTexture(uint8_t *pixels, uint32_t width, uint32_t height, ui
|
|||
|
||||
std::unique_ptr<CTexture> CPicture::CreateTiledThumb(const std::vector<std::string>& files)
|
||||
{
|
||||
if (!files.size())
|
||||
if (files.empty())
|
||||
return {};
|
||||
|
||||
unsigned int num_across =
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue