summaryrefslogtreecommitdiff
path: root/multimedia/kodi/patches
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2015-12-23 12:43:25 +0000
committerjoerg <joerg@pkgsrc.org>2015-12-23 12:43:25 +0000
commit5d64a651f46c5e17ba8c09632293092e080c5dc3 (patch)
tree6622ce45b5b21d750b46089fc078feb359607627 /multimedia/kodi/patches
parentc702113336b8d2b6a836d8bdef1bd0d1ca7240f0 (diff)
downloadpkgsrc-5d64a651f46c5e17ba8c09632293092e080c5dc3.tar.gz
Fix missing cstdlib / locale.h includes. Avoid UB by not passing non-POD
types to variadic functions. It's silly to force the construction of a std::string as potential copy when just the C string is used anyway.
Diffstat (limited to 'multimedia/kodi/patches')
-rw-r--r--multimedia/kodi/patches/patch-xbmc_TextureDatabase.cpp13
-rw-r--r--multimedia/kodi/patches/patch-xbmc_cores_dvdplayer_DVDDemuxSPU.cpp12
-rw-r--r--multimedia/kodi/patches/patch-xbmc_dbwrappers_Database.cpp22
-rw-r--r--multimedia/kodi/patches/patch-xbmc_dbwrappers_Database.h15
-rw-r--r--multimedia/kodi/patches/patch-xbmc_dialogs_GUIDialogGamepad.cpp12
-rw-r--r--multimedia/kodi/patches/patch-xbmc_dialogs_GUIDialogMediaFilter.cpp13
-rw-r--r--multimedia/kodi/patches/patch-xbmc_dialogs_GUIDialogNumeric.cpp12
-rw-r--r--multimedia/kodi/patches/patch-xbmc_guilib_GUIAction.cpp12
-rw-r--r--multimedia/kodi/patches/patch-xbmc_guilib_GUISpinControl.cpp12
-rw-r--r--multimedia/kodi/patches/patch-xbmc_interfaces_legacy_Dialog.cpp12
-rw-r--r--multimedia/kodi/patches/patch-xbmc_linux_XFileUtils.cpp20
-rw-r--r--multimedia/kodi/patches/patch-xbmc_main_main.cpp12
-rw-r--r--multimedia/kodi/patches/patch-xbmc_music_MusicDatabase.cpp86
-rw-r--r--multimedia/kodi/patches/patch-xbmc_pvr_PVRActionListener.cpp13
-rw-r--r--multimedia/kodi/patches/patch-xbmc_storage_linux_DeviceKitDisksProvider.cpp12
-rw-r--r--multimedia/kodi/patches/patch-xbmc_storage_linux_UDisksProvider.cpp12
-rw-r--r--multimedia/kodi/patches/patch-xbmc_video_VideoDatabase.cpp78
-rw-r--r--multimedia/kodi/patches/patch-xbmc_windowing_WinEventsX11.cpp13
18 files changed, 374 insertions, 7 deletions
diff --git a/multimedia/kodi/patches/patch-xbmc_TextureDatabase.cpp b/multimedia/kodi/patches/patch-xbmc_TextureDatabase.cpp
new file mode 100644
index 00000000000..9d007423962
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_TextureDatabase.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_TextureDatabase.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/TextureDatabase.cpp.orig 2015-12-22 18:18:09.000000000 +0000
++++ xbmc/TextureDatabase.cpp
+@@ -294,7 +294,7 @@ bool CTextureDatabase::GetTextures(CVari
+ if (!CDatabase::BuildSQL("", filter, sqlFilter))
+ return false;
+
+- sql = PrepareSQL(sql, !filter.fields.empty() ? filter.fields.c_str() : "*") + sqlFilter;
++ sql = PrepareSQL(sql.c_str(), !filter.fields.empty() ? filter.fields.c_str() : "*") + sqlFilter;
+ if (!m_pDS->query(sql.c_str()))
+ return false;
+
diff --git a/multimedia/kodi/patches/patch-xbmc_cores_dvdplayer_DVDDemuxSPU.cpp b/multimedia/kodi/patches/patch-xbmc_cores_dvdplayer_DVDDemuxSPU.cpp
new file mode 100644
index 00000000000..14146613113
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_cores_dvdplayer_DVDDemuxSPU.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-xbmc_cores_dvdplayer_DVDDemuxSPU.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/cores/dvdplayer/DVDDemuxSPU.cpp.orig 2015-12-22 17:49:55.000000000 +0000
++++ xbmc/cores/dvdplayer/DVDDemuxSPU.cpp
+@@ -21,6 +21,7 @@
+ #include "DVDDemuxSPU.h"
+ #include "DVDClock.h"
+ #include "utils/log.h"
++#include <cstdlib>
+
+ #undef ALIGN
+ #define ALIGN(value, alignment) (((value)+((alignment)-1))&~((alignment)-1))
diff --git a/multimedia/kodi/patches/patch-xbmc_dbwrappers_Database.cpp b/multimedia/kodi/patches/patch-xbmc_dbwrappers_Database.cpp
new file mode 100644
index 00000000000..9b7ade1ad0e
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_dbwrappers_Database.cpp
@@ -0,0 +1,22 @@
+$NetBSD: patch-xbmc_dbwrappers_Database.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/dbwrappers/Database.cpp.orig 2015-12-22 17:53:05.000000000 +0000
++++ xbmc/dbwrappers/Database.cpp
+@@ -127,7 +127,7 @@ void CDatabase::Split(const std::string&
+ strFileName = strFileNameAndPath.substr(i);
+ }
+
+-std::string CDatabase::PrepareSQL(std::string strStmt, ...) const
++std::string CDatabase::PrepareSQL(const char *strStmt, ...) const
+ {
+ std::string strResult = "";
+
+@@ -135,7 +135,7 @@ std::string CDatabase::PrepareSQL(std::s
+ {
+ va_list args;
+ va_start(args, strStmt);
+- strResult = m_pDB->vprepare(strStmt.c_str(), args);
++ strResult = m_pDB->vprepare(strStmt, args);
+ va_end(args);
+ }
+
diff --git a/multimedia/kodi/patches/patch-xbmc_dbwrappers_Database.h b/multimedia/kodi/patches/patch-xbmc_dbwrappers_Database.h
new file mode 100644
index 00000000000..f8536fcc6cc
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_dbwrappers_Database.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-xbmc_dbwrappers_Database.h,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+Passing non-POD types to variadic functions is UB.
+
+--- xbmc/dbwrappers/Database.h.orig 2015-12-22 18:37:20.000000000 +0000
++++ xbmc/dbwrappers/Database.h
+@@ -71,7 +71,7 @@ public:
+ void RollbackTransaction();
+ bool InTransaction();
+
+- std::string PrepareSQL(std::string strStmt, ...) const;
++ std::string PrepareSQL(const char *strStmt, ...) const;
+
+ /*!
+ * @brief Get a single value from a table.
diff --git a/multimedia/kodi/patches/patch-xbmc_dialogs_GUIDialogGamepad.cpp b/multimedia/kodi/patches/patch-xbmc_dialogs_GUIDialogGamepad.cpp
new file mode 100644
index 00000000000..106179ab156
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_dialogs_GUIDialogGamepad.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-xbmc_dialogs_GUIDialogGamepad.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/dialogs/GUIDialogGamepad.cpp.orig 2015-12-22 17:55:50.000000000 +0000
++++ xbmc/dialogs/GUIDialogGamepad.cpp
+@@ -26,6 +26,7 @@
+ #include "GUIDialogOK.h"
+ #include "input/Key.h"
+ #include "guilib/LocalizeStrings.h"
++#include <cstdlib>
+
+ CGUIDialogGamepad::CGUIDialogGamepad(void)
+ : CGUIDialogBoxBase(WINDOW_DIALOG_GAMEPAD, "DialogGamepad.xml")
diff --git a/multimedia/kodi/patches/patch-xbmc_dialogs_GUIDialogMediaFilter.cpp b/multimedia/kodi/patches/patch-xbmc_dialogs_GUIDialogMediaFilter.cpp
new file mode 100644
index 00000000000..23e9b408564
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_dialogs_GUIDialogMediaFilter.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_dialogs_GUIDialogMediaFilter.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/dialogs/GUIDialogMediaFilter.cpp.orig 2015-12-22 17:56:43.000000000 +0000
++++ xbmc/dialogs/GUIDialogMediaFilter.cpp
+@@ -888,7 +888,7 @@ bool CGUIDialogMediaFilter::GetMinMax(co
+ return false;
+ }
+
+- std::string strSQL = "SELECT %s FROM %s ";
++ const char *strSQL = "SELECT %s FROM %s ";
+
+ min = static_cast<int>(strtol(db->GetSingleValue(db->PrepareSQL(strSQL, std::string("MIN(" + field + ")").c_str(), table.c_str()) + strSQLExtra).c_str(), NULL, 0));
+ max = static_cast<int>(strtol(db->GetSingleValue(db->PrepareSQL(strSQL, std::string("MAX(" + field + ")").c_str(), table.c_str()) + strSQLExtra).c_str(), NULL, 0));
diff --git a/multimedia/kodi/patches/patch-xbmc_dialogs_GUIDialogNumeric.cpp b/multimedia/kodi/patches/patch-xbmc_dialogs_GUIDialogNumeric.cpp
new file mode 100644
index 00000000000..98cdc923c46
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_dialogs_GUIDialogNumeric.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-xbmc_dialogs_GUIDialogNumeric.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/dialogs/GUIDialogNumeric.cpp.orig 2015-12-22 17:57:34.000000000 +0000
++++ xbmc/dialogs/GUIDialogNumeric.cpp
+@@ -28,6 +28,7 @@
+ #include "input/Key.h"
+ #include "guilib/LocalizeStrings.h"
+ #include "interfaces/AnnouncementManager.h"
++#include <cstdlib>
+
+ #define CONTROL_HEADING_LABEL 1
+ #define CONTROL_INPUT_LABEL 4
diff --git a/multimedia/kodi/patches/patch-xbmc_guilib_GUIAction.cpp b/multimedia/kodi/patches/patch-xbmc_guilib_GUIAction.cpp
new file mode 100644
index 00000000000..8ba0b0d3e90
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_guilib_GUIAction.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-xbmc_guilib_GUIAction.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/guilib/GUIAction.cpp.orig 2015-12-22 18:26:01.000000000 +0000
++++ xbmc/guilib/GUIAction.cpp
+@@ -23,6 +23,7 @@
+ #include "GUIWindowManager.h"
+ #include "GUIControl.h"
+ #include "GUIInfoManager.h"
++#include <cstdlib>
+
+ using namespace std;
+
diff --git a/multimedia/kodi/patches/patch-xbmc_guilib_GUISpinControl.cpp b/multimedia/kodi/patches/patch-xbmc_guilib_GUISpinControl.cpp
new file mode 100644
index 00000000000..0417a44a61c
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_guilib_GUISpinControl.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-xbmc_guilib_GUISpinControl.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/guilib/GUISpinControl.cpp.orig 2015-12-22 18:27:35.000000000 +0000
++++ xbmc/guilib/GUISpinControl.cpp
+@@ -22,6 +22,7 @@
+ #include "input/Key.h"
+ #include "utils/StringUtils.h"
+ #include <stdio.h>
++#include <cstdlib>
+
+ using namespace std;
+
diff --git a/multimedia/kodi/patches/patch-xbmc_interfaces_legacy_Dialog.cpp b/multimedia/kodi/patches/patch-xbmc_interfaces_legacy_Dialog.cpp
new file mode 100644
index 00000000000..8514de13c06
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_interfaces_legacy_Dialog.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-xbmc_interfaces_legacy_Dialog.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/interfaces/legacy/Dialog.cpp.orig 2015-12-22 18:00:09.000000000 +0000
++++ xbmc/interfaces/legacy/Dialog.cpp
+@@ -33,6 +33,7 @@
+ #include "WindowException.h"
+ #include "ApplicationMessenger.h"
+ #include "Dialog.h"
++#include <cstdlib>
+
+ #define ACTIVE_WINDOW g_windowManager.GetActiveWindow()
+
diff --git a/multimedia/kodi/patches/patch-xbmc_linux_XFileUtils.cpp b/multimedia/kodi/patches/patch-xbmc_linux_XFileUtils.cpp
index f41d1698a5e..6e28e020a43 100644
--- a/multimedia/kodi/patches/patch-xbmc_linux_XFileUtils.cpp
+++ b/multimedia/kodi/patches/patch-xbmc_linux_XFileUtils.cpp
@@ -1,8 +1,14 @@
-$NetBSD: patch-xbmc_linux_XFileUtils.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+$NetBSD: patch-xbmc_linux_XFileUtils.cpp,v 1.2 2015/12/23 12:43:25 joerg Exp $
--- xbmc/linux/XFileUtils.cpp.orig 2015-10-19 06:31:15.000000000 +0000
+++ xbmc/linux/XFileUtils.cpp
-@@ -29,7 +29,7 @@
+@@ -24,12 +24,13 @@
+ #include "XTimeUtils.h"
+ #include "filesystem/SpecialProtocol.h"
+ #include "utils/StringUtils.h"
++#include <cstdlib>
+
+ #ifdef TARGET_POSIX
#include "XHandle.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -11,7 +17,7 @@ $NetBSD: patch-xbmc_linux_XFileUtils.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp
#include <sys/vfs.h>
#else
#include <sys/param.h>
-@@ -68,7 +68,7 @@ HANDLE FindFirstFile(LPCSTR szPath,LPWIN
+@@ -68,7 +69,7 @@ HANDLE FindFirstFile(LPCSTR szPath,LPWIN
StringUtils::Replace(strPath, '\\','/');
// if the file name is a directory then we add a * to look for all files in this directory
@@ -20,7 +26,7 @@ $NetBSD: patch-xbmc_linux_XFileUtils.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp
DIR *testDir = opendir(strPath.c_str());
#else
DIR *testDir = opendir(szPath);
-@@ -289,7 +289,7 @@ HANDLE CreateFile(LPCTSTR lpFileName, DW
+@@ -289,7 +290,7 @@ HANDLE CreateFile(LPCTSTR lpFileName, DW
HANDLE result = new CXHandle(CXHandle::HND_FILE);
result->fd = fd;
@@ -29,7 +35,7 @@ $NetBSD: patch-xbmc_linux_XFileUtils.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp
// special case for opening the cdrom device
if (strcmp(lpFileName, MEDIA_DETECT::CLibcdio::GetInstance()->GetDeviceFileName())==0)
result->m_bCDROM = true;
-@@ -575,7 +575,7 @@ DWORD SetFilePointer(HANDLE hFile, int3
+@@ -575,7 +576,7 @@ DWORD SetFilePointer(HANDLE hFile, int3
nMode = SEEK_END;
off64_t currOff;
@@ -38,7 +44,7 @@ $NetBSD: patch-xbmc_linux_XFileUtils.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp
currOff = lseek(hFile->fd, offset, nMode);
#else
currOff = lseek64(hFile->fd, offset, nMode);
-@@ -645,7 +645,7 @@ BOOL SetEndOfFile(HANDLE hFile)
+@@ -645,7 +646,7 @@ BOOL SetEndOfFile(HANDLE hFile)
return false;
// get the current offset
@@ -47,7 +53,7 @@ $NetBSD: patch-xbmc_linux_XFileUtils.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp
off64_t currOff = lseek(hFile->fd, 0, SEEK_CUR);
#else
off64_t currOff = lseek64(hFile->fd, 0, SEEK_CUR);
-@@ -676,7 +676,7 @@ BOOL SetFilePointerEx( HANDLE hFile,
+@@ -676,7 +677,7 @@ BOOL SetFilePointerEx( HANDLE hFile,
off64_t toMove = liDistanceToMove.QuadPart;
diff --git a/multimedia/kodi/patches/patch-xbmc_main_main.cpp b/multimedia/kodi/patches/patch-xbmc_main_main.cpp
new file mode 100644
index 00000000000..047e387de3a
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_main_main.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-xbmc_main_main.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/main/main.cpp.orig 2015-12-22 18:28:15.000000000 +0000
++++ xbmc/main/main.cpp
+@@ -28,6 +28,7 @@
+ #ifdef TARGET_POSIX
+ #include <sys/resource.h>
+ #include <signal.h>
++#include <locale.h>
+ #endif
+ #if defined(TARGET_DARWIN_OSX)
+ #include "Util.h"
diff --git a/multimedia/kodi/patches/patch-xbmc_music_MusicDatabase.cpp b/multimedia/kodi/patches/patch-xbmc_music_MusicDatabase.cpp
new file mode 100644
index 00000000000..cb2249aa930
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_music_MusicDatabase.cpp
@@ -0,0 +1,86 @@
+$NetBSD: patch-xbmc_music_MusicDatabase.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/music/MusicDatabase.cpp.orig 2015-12-22 18:03:08.000000000 +0000
++++ xbmc/music/MusicDatabase.cpp
+@@ -1414,7 +1414,7 @@ bool CMusicDatabase::GetAlbumsByArtist(i
+ if (includeFeatured == false)
+ strPrepSQL += " AND boolFeatured = 0";
+
+- strSQL=PrepareSQL(strPrepSQL, idArtist);
++ strSQL=PrepareSQL(strPrepSQL.c_str(), idArtist);
+ if (!m_pDS->query(strSQL.c_str()))
+ return false;
+ if (m_pDS->num_rows() == 0)
+@@ -1448,7 +1448,7 @@ bool CMusicDatabase::GetArtistsByAlbum(i
+ if (includeFeatured == false)
+ strPrepSQL += " AND boolFeatured = 0";
+
+- strSQL=PrepareSQL(strPrepSQL, idAlbum);
++ strSQL=PrepareSQL(strPrepSQL.c_str(), idAlbum);
+ if (!m_pDS->query(strSQL.c_str()))
+ return false;
+ if (m_pDS->num_rows() == 0)
+@@ -1482,7 +1482,7 @@ bool CMusicDatabase::GetSongsByArtist(in
+ if (includeFeatured == false)
+ strPrepSQL += " AND boolFeatured = 0";
+
+- strSQL=PrepareSQL(strPrepSQL, idArtist);
++ strSQL=PrepareSQL(strPrepSQL.c_str(), idArtist);
+ if (!m_pDS->query(strSQL.c_str()))
+ return false;
+ if (m_pDS->num_rows() == 0)
+@@ -1516,7 +1516,7 @@ bool CMusicDatabase::GetArtistsBySong(in
+ if (includeFeatured == false)
+ strPrepSQL += " AND boolFeatured = 0";
+
+- strSQL=PrepareSQL(strPrepSQL, idSong);
++ strSQL=PrepareSQL(strPrepSQL.c_str(), idSong);
+ if (!m_pDS->query(strSQL.c_str()))
+ return false;
+ if (m_pDS->num_rows() == 0)
+@@ -3159,7 +3159,7 @@ bool CMusicDatabase::GetCommonNav(const
+ if (!BuildSQL(strBaseDir, strSQL, extFilter, strSQL, musicUrl))
+ return false;
+
+- strSQL = PrepareSQL(strSQL, !extFilter.fields.empty() ? extFilter.fields.c_str() : labelField.c_str());
++ strSQL = PrepareSQL(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : labelField.c_str());
+
+ // run query
+ CLog::Log(LOGDEBUG, "%s query: %s", __FUNCTION__, strSQL.c_str());
+@@ -3311,7 +3311,7 @@ bool CMusicDatabase::GetArtistsByWhere(c
+ sortDescription.sortBy == SortByNone &&
+ (sortDescription.limitStart > 0 || sortDescription.limitEnd > 0))
+ {
+- total = (int)strtol(GetSingleValue(PrepareSQL(strSQL, "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
++ total = (int)strtol(GetSingleValue(PrepareSQL(strSQL.c_str(), "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
+ strSQLExtra += DatabaseUtils::BuildLimitClause(sortDescription.limitEnd, sortDescription.limitStart);
+ }
+
+@@ -3470,11 +3470,11 @@ bool CMusicDatabase::GetAlbumsByWhere(co
+ sortDescription.sortBy == SortByNone &&
+ (sortDescription.limitStart > 0 || sortDescription.limitEnd > 0))
+ {
+- total = (int)strtol(GetSingleValue(PrepareSQL(strSQL, "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
++ total = (int)strtol(GetSingleValue(PrepareSQL(strSQL.c_str(), "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
+ strSQLExtra += DatabaseUtils::BuildLimitClause(sortDescription.limitEnd, sortDescription.limitStart);
+ }
+
+- strSQL = PrepareSQL(strSQL, !filter.fields.empty() && filter.fields.compare("*") != 0 ? filter.fields.c_str() : "albumview.*") + strSQLExtra;
++ strSQL = PrepareSQL(strSQL.c_str(), !filter.fields.empty() && filter.fields.compare("*") != 0 ? filter.fields.c_str() : "albumview.*") + strSQLExtra;
+
+ CLog::Log(LOGDEBUG, "%s query: %s", __FUNCTION__, strSQL.c_str());
+ // run query
+@@ -3583,11 +3583,11 @@ bool CMusicDatabase::GetSongsByWhere(con
+ sortDescription.sortBy == SortByNone &&
+ (sortDescription.limitStart > 0 || sortDescription.limitEnd > 0))
+ {
+- total = (int)strtol(GetSingleValue(PrepareSQL(strSQL, "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
++ total = (int)strtol(GetSingleValue(PrepareSQL(strSQL.c_str(), "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
+ strSQLExtra += DatabaseUtils::BuildLimitClause(sortDescription.limitEnd, sortDescription.limitStart);
+ }
+
+- strSQL = PrepareSQL(strSQL, !filter.fields.empty() && filter.fields.compare("*") != 0 ? filter.fields.c_str() : "songview.*") + strSQLExtra;
++ strSQL = PrepareSQL(strSQL.c_str(), !filter.fields.empty() && filter.fields.compare("*") != 0 ? filter.fields.c_str() : "songview.*") + strSQLExtra;
+
+ CLog::Log(LOGDEBUG, "%s query = %s", __FUNCTION__, strSQL.c_str());
+ // run query
diff --git a/multimedia/kodi/patches/patch-xbmc_pvr_PVRActionListener.cpp b/multimedia/kodi/patches/patch-xbmc_pvr_PVRActionListener.cpp
new file mode 100644
index 00000000000..6921fa6b88f
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_pvr_PVRActionListener.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_pvr_PVRActionListener.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/pvr/PVRActionListener.cpp.orig 2015-12-22 18:44:41.000000000 +0000
++++ xbmc/pvr/PVRActionListener.cpp
+@@ -34,6 +34,8 @@
+ #include "pvr/PVRManager.h"
+ #include "pvr/channels/PVRChannelGroupsContainer.h"
+
++#include <cstdlib>
++
+ using namespace PVR;
+
+ CPVRActionListener::CPVRActionListener()
diff --git a/multimedia/kodi/patches/patch-xbmc_storage_linux_DeviceKitDisksProvider.cpp b/multimedia/kodi/patches/patch-xbmc_storage_linux_DeviceKitDisksProvider.cpp
new file mode 100644
index 00000000000..e2a07c65d5f
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_storage_linux_DeviceKitDisksProvider.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-xbmc_storage_linux_DeviceKitDisksProvider.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/storage/linux/DeviceKitDisksProvider.cpp.orig 2015-12-22 18:20:08.000000000 +0000
++++ xbmc/storage/linux/DeviceKitDisksProvider.cpp
+@@ -17,6 +17,7 @@
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
++#include <cstdlib>
+ #include "DeviceKitDisksProvider.h"
+ #ifdef HAS_DBUS
+ #include "settings/AdvancedSettings.h"
diff --git a/multimedia/kodi/patches/patch-xbmc_storage_linux_UDisksProvider.cpp b/multimedia/kodi/patches/patch-xbmc_storage_linux_UDisksProvider.cpp
new file mode 100644
index 00000000000..50defcdb7ce
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_storage_linux_UDisksProvider.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-xbmc_storage_linux_UDisksProvider.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/storage/linux/UDisksProvider.cpp.orig 2015-12-22 18:21:00.000000000 +0000
++++ xbmc/storage/linux/UDisksProvider.cpp
+@@ -17,6 +17,7 @@
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
++#include <cstdlib>
+ #include "UDisksProvider.h"
+ #ifdef HAS_DBUS
+ #include "settings/AdvancedSettings.h"
diff --git a/multimedia/kodi/patches/patch-xbmc_video_VideoDatabase.cpp b/multimedia/kodi/patches/patch-xbmc_video_VideoDatabase.cpp
new file mode 100644
index 00000000000..50123da2c9c
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_video_VideoDatabase.cpp
@@ -0,0 +1,78 @@
+$NetBSD: patch-xbmc_video_VideoDatabase.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/video/VideoDatabase.cpp.orig 2015-12-22 18:22:01.000000000 +0000
++++ xbmc/video/VideoDatabase.cpp
+@@ -6194,11 +6194,11 @@ bool CVideoDatabase::GetMoviesByWhere(co
+ sorting.sortBy == SortByNone &&
+ (sorting.limitStart > 0 || sorting.limitEnd > 0))
+ {
+- total = (int)strtol(GetSingleValue(PrepareSQL(strSQL, "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
++ total = (int)strtol(GetSingleValue(PrepareSQL(strSQL.c_str(), "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
+ strSQLExtra += DatabaseUtils::BuildLimitClause(sorting.limitEnd, sorting.limitStart);
+ }
+
+- strSQL = PrepareSQL(strSQL, !extFilter.fields.empty() ? extFilter.fields.c_str() : "*") + strSQLExtra;
++ strSQL = PrepareSQL(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*") + strSQLExtra;
+
+ int iRowsFound = RunQuery(strSQL);
+ if (iRowsFound <= 0)
+@@ -6300,11 +6300,11 @@ bool CVideoDatabase::GetTvShowsByWhere(c
+ sorting.sortBy == SortByNone &&
+ (sorting.limitStart > 0 || sorting.limitEnd > 0))
+ {
+- total = (int)strtol(GetSingleValue(PrepareSQL(strSQL, "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
++ total = (int)strtol(GetSingleValue(PrepareSQL(strSQL.c_str(), "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
+ strSQLExtra += DatabaseUtils::BuildLimitClause(sorting.limitEnd, sorting.limitStart);
+ }
+
+- strSQL = PrepareSQL(strSQL, !extFilter.fields.empty() ? extFilter.fields.c_str() : "*") + strSQLExtra;
++ strSQL = PrepareSQL(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*") + strSQLExtra;
+
+ int iRowsFound = RunQuery(strSQL);
+ if (iRowsFound <= 0)
+@@ -6427,11 +6427,11 @@ bool CVideoDatabase::GetEpisodesByWhere(
+ sorting.sortBy == SortByNone &&
+ (sorting.limitStart > 0 || sorting.limitEnd > 0))
+ {
+- total = (int)strtol(GetSingleValue(PrepareSQL(strSQL, "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
++ total = (int)strtol(GetSingleValue(PrepareSQL(strSQL.c_str(), "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
+ strSQLExtra += DatabaseUtils::BuildLimitClause(sorting.limitEnd, sorting.limitStart);
+ }
+
+- strSQL = PrepareSQL(strSQL, !extFilter.fields.empty() ? extFilter.fields.c_str() : "*") + strSQLExtra;
++ strSQL = PrepareSQL(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*") + strSQLExtra;
+
+ int iRowsFound = RunQuery(strSQL);
+ if (iRowsFound <= 0)
+@@ -7074,10 +7074,13 @@ void CVideoDatabase::GetMusicVideoArtist
+ std::string strLike;
+ if (!strSearch.empty())
+ strLike = "and actor.name like '%%%s%%'";
+- if (CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
+- strSQL=PrepareSQL("SELECT actor.actor_id, actor.name, path.strPath FROM actor INNER JOIN actor_link ON actor_link.actor_id=actor.actor_id INNER JOIN musicvideo ON actor_link.media_id=musicvideo.idMVideo INNER JOIN files ON files.idFile=musicvideo.idFile INNER JOIN path ON path.idPath=files.idPath WHERE actor_link.media_type='musicvideo' "+strLike, strSearch.c_str());
+- else
+- strSQL=PrepareSQL("SELECT DISTINCT actor.actor_id, actor.name from actor INNER JOIN actor_link ON actor_link.actor_id=actor.actor_id WHERE actor_link.media_type='musicvideo' "+strLike,strSearch.c_str());
++ if (CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser) {
++ std::string full_query = "SELECT actor.actor_id, actor.name, path.strPath FROM actor INNER JOIN actor_link ON actor_link.actor_id=actor.actor_id INNER JOIN musicvideo ON actor_link.media_id=musicvideo.idMVideo INNER JOIN files ON files.idFile=musicvideo.idFile INNER JOIN path ON path.idPath=files.idPath WHERE actor_link.media_type='musicvideo' "+strLike;
++ strSQL=PrepareSQL(full_query.c_str(), strSearch.c_str());
++ } else {
++ std::string full_query = "SELECT DISTINCT actor.actor_id, actor.name from actor INNER JOIN actor_link ON actor_link.actor_id=actor.actor_id WHERE actor_link.media_type='musicvideo' "+strLike;
++ strSQL=PrepareSQL(full_query.c_str(),strSearch.c_str());
++ }
+ m_pDS->query( strSQL.c_str() );
+
+ while (!m_pDS->eof())
+@@ -7262,11 +7265,11 @@ bool CVideoDatabase::GetMusicVideosByWhe
+ sorting.sortBy == SortByNone &&
+ (sorting.limitStart > 0 || sorting.limitEnd > 0))
+ {
+- total = (int)strtol(GetSingleValue(PrepareSQL(strSQL, "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
++ total = (int)strtol(GetSingleValue(PrepareSQL(strSQL.c_str(), "COUNT(1)") + strSQLExtra, m_pDS).c_str(), NULL, 10);
+ strSQLExtra += DatabaseUtils::BuildLimitClause(sorting.limitEnd, sorting.limitStart);
+ }
+
+- strSQL = PrepareSQL(strSQL, !extFilter.fields.empty() ? extFilter.fields.c_str() : "*") + strSQLExtra;
++ strSQL = PrepareSQL(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*") + strSQLExtra;
+
+ int iRowsFound = RunQuery(strSQL);
+ if (iRowsFound <= 0)
diff --git a/multimedia/kodi/patches/patch-xbmc_windowing_WinEventsX11.cpp b/multimedia/kodi/patches/patch-xbmc_windowing_WinEventsX11.cpp
new file mode 100644
index 00000000000..a8d6b353c18
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_windowing_WinEventsX11.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_windowing_WinEventsX11.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/windowing/WinEventsX11.cpp.orig 2015-12-22 18:16:12.000000000 +0000
++++ xbmc/windowing/WinEventsX11.cpp
+@@ -19,6 +19,8 @@
+ *
+ */
+
++#include <locale.h>
++#include <cstdlib>
+ #include "system.h"
+
+ #ifdef HAS_X11_WIN_EVENTS