From ae960b294839541bac30f7fbc29b82680ffad119 Mon Sep 17 00:00:00 2001 From: Dobroslaw Kijowski Date: Fri, 17 Mar 2023 22:40:11 +0100 Subject: [PATCH] [guilib] Allow to send int64_t in CGUIMessage * This is needed for implementing a new message GUI_MSG_PLAYBACK_SEEKED containing two 64-bit integers. --- xbmc/guilib/GUIMessage.cpp | 27 +++++++++++++++++++++------ xbmc/guilib/GUIMessage.h | 22 +++++++++++++++------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/xbmc/guilib/GUIMessage.cpp b/xbmc/guilib/GUIMessage.cpp index fb6513f3126ad..c8700993962ce 100644 --- a/xbmc/guilib/GUIMessage.cpp +++ b/xbmc/guilib/GUIMessage.cpp @@ -12,7 +12,7 @@ std::string CGUIMessage::empty_string; -CGUIMessage::CGUIMessage(int msg, int senderID, int controlID, int param1, int param2) +CGUIMessage::CGUIMessage(int msg, int senderID, int controlID, int64_t param1, int64_t param2) { m_message = msg; m_senderID = senderID; @@ -22,7 +22,8 @@ CGUIMessage::CGUIMessage(int msg, int senderID, int controlID, int param1, int p m_pointer = NULL; } -CGUIMessage::CGUIMessage(int msg, int senderID, int controlID, int param1, int param2, CFileItemList *item) +CGUIMessage::CGUIMessage( + int msg, int senderID, int controlID, int64_t param1, int64_t param2, CFileItemList* item) { m_message = msg; m_senderID = senderID; @@ -32,8 +33,12 @@ CGUIMessage::CGUIMessage(int msg, int senderID, int controlID, int param1, int p m_pointer = item; } -CGUIMessage::CGUIMessage( - int msg, int senderID, int controlID, int param1, int param2, const CGUIListItemPtr& item) +CGUIMessage::CGUIMessage(int msg, + int senderID, + int controlID, + int64_t param1, + int64_t param2, + const CGUIListItemPtr& item) : m_item(item) { m_message = msg; @@ -70,11 +75,21 @@ CGUIListItemPtr CGUIMessage::GetItem() const } int CGUIMessage::GetParam1() const +{ + return static_cast(m_param1); +} + +int64_t CGUIMessage::GetParam1AsI64() const { return m_param1; } int CGUIMessage::GetParam2() const +{ + return static_cast(m_param2); +} + +int64_t CGUIMessage::GetParam2AsI64() const { return m_param2; } @@ -86,12 +101,12 @@ int CGUIMessage::GetSenderId() const CGUIMessage& CGUIMessage::operator = (const CGUIMessage& msg) = default; -void CGUIMessage::SetParam1(int param1) +void CGUIMessage::SetParam1(int64_t param1) { m_param1 = param1; } -void CGUIMessage::SetParam2(int param2) +void CGUIMessage::SetParam2(int64_t param2) { m_param2 = param2; } diff --git a/xbmc/guilib/GUIMessage.h b/xbmc/guilib/GUIMessage.h index 2fc670224acfd..433d9d569f398 100644 --- a/xbmc/guilib/GUIMessage.h +++ b/xbmc/guilib/GUIMessage.h @@ -365,9 +365,15 @@ class CFileItemList; class CGUIMessage final { public: - CGUIMessage(int dwMsg, int senderID, int controlID, int param1 = 0, int param2 = 0); - CGUIMessage(int msg, int senderID, int controlID, int param1, int param2, CFileItemList* item); - CGUIMessage(int msg, int senderID, int controlID, int param1, int param2, const CGUIListItemPtr &item); + CGUIMessage(int dwMsg, int senderID, int controlID, int64_t param1 = 0, int64_t param2 = 0); + CGUIMessage( + int msg, int senderID, int controlID, int64_t param1, int64_t param2, CFileItemList* item); + CGUIMessage(int msg, + int senderID, + int controlID, + int64_t param1, + int64_t param2, + const CGUIListItemPtr& item); CGUIMessage(const CGUIMessage& msg); ~CGUIMessage(void); CGUIMessage& operator = (const CGUIMessage& msg); @@ -377,10 +383,12 @@ class CGUIMessage final void* GetPointer() const; CGUIListItemPtr GetItem() const; int GetParam1() const; + int64_t GetParam1AsI64() const; int GetParam2() const; + int64_t GetParam2AsI64() const; int GetSenderId() const; - void SetParam1(int param1); - void SetParam2(int param2); + void SetParam1(int64_t param1); + void SetParam2(int64_t param2); void SetPointer(void* pointer); void SetLabel(const std::string& strLabel); void SetLabel(int iString); // for convenience - looks up in strings.po @@ -398,8 +406,8 @@ class CGUIMessage final int m_controlID; int m_message; void* m_pointer; - int m_param1; - int m_param2; + int64_t m_param1; + int64_t m_param2; CGUIListItemPtr m_item; static std::string empty_string;