Skip to content

Commit

Permalink
Silence warnings about throw() deprecation
Browse files Browse the repository at this point in the history
Silence narrow cast warnings in swig modules

Fix a bunch more narrowing warnings
  • Loading branch information
Paxxi committed Jan 26, 2018
1 parent 0644d5a commit 0abf691
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ namespace addon
entries[i].properties = nullptr;
}
*retEntries = entries;
*num_entries = addonEntries.size();
*num_entries = static_cast<int>(addonEntries.size());
}
return ret;
}
Expand Down Expand Up @@ -586,7 +586,7 @@ namespace addon
strncpy(rootpath, cppRootPath.c_str(), ADDON_STANDARD_STRING_LENGTH);

VFSDirEntry* entries = static_cast<VFSDirEntry*>(malloc(sizeof(VFSDirEntry) * addonEntries.size()));
for (unsigned int i = 0; i < addonEntries.size(); ++i)
for (size_t i = 0; i < addonEntries.size(); ++i)
{
entries[i].label = strdup(addonEntries[i].Label().c_str());
entries[i].title = strdup(addonEntries[i].Title().c_str());
Expand All @@ -610,7 +610,7 @@ namespace addon
entries[i].properties = nullptr;
}
*retEntries = entries;
*num_entries = addonEntries.size();
*num_entries = static_cast<int>(addonEntries.size());
}
return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ namespace addon
addon->toAddon.addonInstance->m_instanceData->toKodi.transfer_preset(addon->toKodi.kodiInstance, it.c_str());
}

return presets.size();
return static_cast<unsigned int>(presets.size());
}

inline static int ADDON_GetActivePreset(const AddonInstance_Visualization* addon)
Expand Down
2 changes: 1 addition & 1 deletion xbmc/commons/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ namespace XbmcCommons
size_t mcapacity;
size_t mlimit;

inline void check(int count) const
inline void check(size_t count) const
{
if ((mposition + count) > mlimit)
throw BufferException("Buffer buffer overflow: Cannot add more data to the Buffer's buffer.");
Expand Down
2 changes: 1 addition & 1 deletion xbmc/dialogs/GUIDialogContextMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ enum CONTEXT_BUTTON { CONTEXT_BUTTON_CANCELLED = 0,
CONTEXT_BUTTON_ACTIVE_ADSP_SETTINGS,
};

class CContextButtons : public std::vector< std::pair<unsigned int, std::string> >
class CContextButtons : public std::vector< std::pair<size_t, std::string> >
{
public:
void Add(unsigned int, const std::string &label);
Expand Down
6 changes: 3 additions & 3 deletions xbmc/filesystem/NFSDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ bool CNFSDirectory::ResolveSymlink( const std::string &dirName, struct nfsdirent
dirent->inode = tmpBuffer.st_ino;
dirent->mode = tmpBuffer.st_mode;
dirent->size = tmpBuffer.st_size;
dirent->atime.tv_sec = tmpBuffer.st_atime;
dirent->mtime.tv_sec = tmpBuffer.st_mtime;
dirent->ctime.tv_sec = tmpBuffer.st_ctime;
dirent->atime.tv_sec = static_cast<long>(tmpBuffer.st_atime);
dirent->mtime.tv_sec = static_cast<long>(tmpBuffer.st_mtime);
dirent->ctime.tv_sec = static_cast<long>(tmpBuffer.st_ctime);

//map stat mode to nf3type
if(S_ISBLK(tmpBuffer.st_mode)){ dirent->type = NF3BLK; }
Expand Down
4 changes: 2 additions & 2 deletions xbmc/filesystem/NFSFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ namespace XFILE

//implement iocontrol for seek_possible for preventing the stat in File class for
//getting this info ...
int IoControl(EIoControl request, void* param) override{ if(request == IOCTRL_SEEK_POSSIBLE) return 1;return -1;};
int GetChunkSize() override {return gNfsConnection.GetMaxReadChunkSize();}
int IoControl(EIoControl request, void* param) override{ return request == IOCTRL_SEEK_POSSIBLE ? 1 : -1; };
int GetChunkSize() override {return static_cast<int>(gNfsConnection.GetMaxReadChunkSize());}

bool OpenForWrite(const CURL& url, bool bOverWrite = false) override;
bool Delete(const CURL& url) override;
Expand Down
2 changes: 1 addition & 1 deletion xbmc/filesystem/VirtualDirectory.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace XFILE
void SetSources(const VECSOURCES& vecSources);
inline unsigned int GetNumberOfSources()
{
return m_vecSources.size();
return static_cast<uint32_t>(m_vecSources.size());
}

bool IsSource(const std::string& strPath, VECSOURCES *sources = NULL, std::string *name = NULL) const;
Expand Down
16 changes: 8 additions & 8 deletions xbmc/interfaces/legacy/Addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace XBMCAddon
return pAddon->GetSetting(id);
}

bool Addon::getSettingBool(const char* id) throw(XBMCAddon::WrongTypeException)
bool Addon::getSettingBool(const char* id)
{
bool value = false;
if (!pAddon->GetSettingBool(id, value))
Expand All @@ -102,7 +102,7 @@ namespace XBMCAddon
return value;
}

int Addon::getSettingInt(const char* id) throw(XBMCAddon::WrongTypeException)
int Addon::getSettingInt(const char* id)
{
int value = 0;
if (!pAddon->GetSettingInt(id, value))
Expand All @@ -111,7 +111,7 @@ namespace XBMCAddon
return value;
}

double Addon::getSettingNumber(const char* id) throw(XBMCAddon::WrongTypeException)
double Addon::getSettingNumber(const char* id)
{
double value = 0.0;
if (!pAddon->GetSettingNumber(id, value))
Expand All @@ -120,7 +120,7 @@ namespace XBMCAddon
return value;
}

String Addon::getSettingString(const char* id) throw(XBMCAddon::WrongTypeException)
String Addon::getSettingString(const char* id)
{
std::string value;
if (!pAddon->GetSettingString(id, value))
Expand All @@ -140,7 +140,7 @@ namespace XBMCAddon
}
}

bool Addon::setSettingBool(const char* id, bool value) throw(XBMCAddon::WrongTypeException)
bool Addon::setSettingBool(const char* id, bool value)
{
DelayedCallGuard dcguard(languageHook);
ADDON::AddonPtr addon(pAddon);
Expand All @@ -155,7 +155,7 @@ namespace XBMCAddon
return true;
}

bool Addon::setSettingInt(const char* id, int value) throw(XBMCAddon::WrongTypeException)
bool Addon::setSettingInt(const char* id, int value)
{
DelayedCallGuard dcguard(languageHook);
ADDON::AddonPtr addon(pAddon);
Expand All @@ -170,7 +170,7 @@ namespace XBMCAddon
return true;
}

bool Addon::setSettingNumber(const char* id, double value) throw(XBMCAddon::WrongTypeException)
bool Addon::setSettingNumber(const char* id, double value)
{
DelayedCallGuard dcguard(languageHook);
ADDON::AddonPtr addon(pAddon);
Expand All @@ -185,7 +185,7 @@ namespace XBMCAddon
return true;
}

bool Addon::setSettingString(const char* id, const String& value) throw(XBMCAddon::WrongTypeException)
bool Addon::setSettingString(const char* id, const String& value)
{
DelayedCallGuard dcguard(languageHook);
ADDON::AddonPtr addon(pAddon);
Expand Down
16 changes: 8 additions & 8 deletions xbmc/interfaces/legacy/Addon.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ namespace XBMCAddon
///
getSettingBool(...);
#else
bool getSettingBool(const char* id) throw(XBMCAddon::WrongTypeException);
bool getSettingBool(const char* id);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
Expand Down Expand Up @@ -195,7 +195,7 @@ namespace XBMCAddon
///
getSettingInt(...);
#else
int getSettingInt(const char* id) throw(XBMCAddon::WrongTypeException);
int getSettingInt(const char* id);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
Expand Down Expand Up @@ -224,7 +224,7 @@ namespace XBMCAddon
///
getSettingNumber(...);
#else
double getSettingNumber(const char* id) throw(XBMCAddon::WrongTypeException);
double getSettingNumber(const char* id);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
Expand Down Expand Up @@ -253,7 +253,7 @@ namespace XBMCAddon
///
getSettingString(...);
#else
String getSettingString(const char* id) throw(XBMCAddon::WrongTypeException);
String getSettingString(const char* id);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
Expand Down Expand Up @@ -316,7 +316,7 @@ namespace XBMCAddon
///
setSettingBool(...);
#else
bool setSettingBool(const char* id, bool value) throw(XBMCAddon::WrongTypeException);
bool setSettingBool(const char* id, bool value);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
Expand Down Expand Up @@ -348,7 +348,7 @@ namespace XBMCAddon
///
setSettingInt(...);
#else
bool setSettingInt(const char* id, int value) throw(XBMCAddon::WrongTypeException);
bool setSettingInt(const char* id, int value);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
Expand Down Expand Up @@ -380,7 +380,7 @@ namespace XBMCAddon
///
setSettingNumber(...);
#else
bool setSettingNumber(const char* id, double value) throw(XBMCAddon::WrongTypeException);
bool setSettingNumber(const char* id, double value);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
Expand Down Expand Up @@ -412,7 +412,7 @@ namespace XBMCAddon
///
setSettingString(...);
#else
bool setSettingString(const char* id, const String& value) throw(XBMCAddon::WrongTypeException);
bool setSettingString(const char* id, const String& value);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/legacy/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ namespace XBMCAddon
g_windowManager.SendMessage(msg);
}

InfoTagRadioRDS* Player::getRadioRDSInfoTag() throw (PlayerException)
InfoTagRadioRDS* Player::getRadioRDSInfoTag()
{
XBMC_TRACE;
if (g_application.GetAppPlayer().IsPlayingVideo() || !g_application.GetAppPlayer().IsPlayingRDS())
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/legacy/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ namespace XBMCAddon
///
getRadioRDSInfoTag();
#else
InfoTagRadioRDS* getRadioRDSInfoTag() throw (PlayerException);
InfoTagRadioRDS* getRadioRDSInfoTag();
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/python/typemaps/python.Tuple.intm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
bool isTuple = PyObject_TypeCheck(${slarg},&PyTuple_Type);
if (!isTuple && !PyObject_TypeCheck(${slarg},&PyList_Type))
throw WrongTypeException("The parameter \"${api}\" must be either a Tuple or a List.");
int vecSize = (isTuple ? PyTuple_Size(${slarg}) : PyList_Size(${slarg}));
auto vecSize = (isTuple ? PyTuple_Size(${slarg}) : PyList_Size(${slarg}));
<%
types.eachWithIndex { curType, entryIndex ->
%>
Expand Down
4 changes: 2 additions & 2 deletions xbmc/interfaces/python/typemaps/python.vector.intm
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

<% if (ispointer) print("${api} = new std::vector<${swigTypeParser.SwigType_str(vectype)}>();") %>
PyObject *pyentry${seq} = NULL;
int vecSize = (isTuple ? PyTuple_Size(${slarg}) : PyList_Size(${slarg}));
for(int i = 0; i < vecSize; i++)
auto vecSize = (isTuple ? PyTuple_Size(${slarg}) : PyList_Size(${slarg}));
for(Py_ssize_t i = 0; i < vecSize; i++)
{
pyentry${seq} = (isTuple ? PyTuple_GetItem(${slarg}, i) : PyList_GetItem(${slarg}, i));
${swigTypeParser.SwigType_str(swigTypeParser.SwigType_ltype(vectype))} entry${seq};
Expand Down
16 changes: 8 additions & 8 deletions xbmc/windows/GUIMediaWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ void CGUIMediaWindow::SetupShares()

bool CGUIMediaWindow::OnPopupMenu(int itemIdx)
{
auto InRange = [](int i, std::pair<int, int> range){ return i >= range.first && i < range.second; };
auto InRange = [](size_t i, std::pair<size_t, size_t> range){ return i >= range.first && i < range.second; };

if (itemIdx < 0 || itemIdx >= m_vecItems->Size())
return false;
Expand All @@ -1650,28 +1650,28 @@ bool CGUIMediaWindow::OnPopupMenu(int itemIdx)
int i = 0;
while (item->HasProperty(StringUtils::Format("contextmenulabel(%i)", i)))
{
buttons.emplace_back(-buttons.size(), item->GetProperty(StringUtils::Format("contextmenulabel(%i)", i)).asString());
buttons.emplace_back(~buttons.size(), item->GetProperty(StringUtils::Format("contextmenulabel(%i)", i)).asString());
++i;
}
}
auto pluginMenuRange = std::make_pair(0, buttons.size());
auto pluginMenuRange = std::make_pair(static_cast<size_t>(0), buttons.size());

//Add the global menu
auto globalMenu = CContextMenuManager::GetInstance().GetItems(*item, CContextMenuManager::MAIN);
auto globalMenuRange = std::make_pair(buttons.size(), buttons.size() + globalMenu.size());
for (const auto& menu : globalMenu)
buttons.emplace_back(-buttons.size(), menu->GetLabel(*item));
buttons.emplace_back(~buttons.size(), menu->GetLabel(*item));

//Add legacy items from windows
auto windowMenuRange = std::make_pair(buttons.size(), -1);
auto buttonsSize = buttons.size();
GetContextButtons(itemIdx, buttons);
windowMenuRange.second = buttons.size();
auto windowMenuRange = std::make_pair(buttonsSize, buttons.size());

//Add addon menus
auto addonMenu = CContextMenuManager::GetInstance().GetAddonItems(*item, CContextMenuManager::MAIN);
auto addonMenuRange = std::make_pair(buttons.size(), buttons.size() + addonMenu.size());
for (const auto& menu : addonMenu)
buttons.emplace_back(-buttons.size(), menu->GetLabel(*item));
buttons.emplace_back(~buttons.size(), menu->GetLabel(*item));

if (buttons.empty())
return true;
Expand All @@ -1680,7 +1680,7 @@ bool CGUIMediaWindow::OnPopupMenu(int itemIdx)
if (idx < 0 || idx >= static_cast<int>(buttons.size()))
return false;

if (InRange(idx, pluginMenuRange))
if (InRange(static_cast<size_t>(idx), pluginMenuRange))
{
CApplicationMessenger::GetInstance().SendMsg(TMSG_EXECUTE_BUILT_IN, -1, -1, nullptr,
item->GetProperty(StringUtils::Format("contextmenuaction(%i)", idx - pluginMenuRange.first)).asString());
Expand Down

0 comments on commit 0abf691

Please sign in to comment.