[SCM] kodi-pvr-vdr-vnsi/master: requestpacket: use size_t instead of uint32_t for memory sizes
tiber-guest at users.alioth.debian.org
tiber-guest at users.alioth.debian.org
Sun Feb 28 15:46:48 UTC 2016
The following commit has been merged in the master branch:
commit 4c23794709e2cfdd53f233aa22723dc4829299c2
Author: Max Kellermann <max at duempel.org>
Date: Thu Nov 5 11:17:54 2015 +0100
requestpacket: use size_t instead of uint32_t for memory sizes
diff --git a/src/requestpacket.cpp b/src/requestpacket.cpp
index 05f5314..841beba 100644
--- a/src/requestpacket.cpp
+++ b/src/requestpacket.cpp
@@ -45,7 +45,7 @@ cRequestPacket::~cRequestPacket()
free(buffer);
}
-bool cRequestPacket::init(uint32_t topcode, bool stream, bool setUserDataLength, uint32_t userDataLength)
+bool cRequestPacket::init(uint32_t topcode, bool stream, bool setUserDataLength, size_t userDataLength)
{
if (buffer) return false;
@@ -86,7 +86,7 @@ bool cRequestPacket::init(uint32_t topcode, bool stream, bool setUserDataLength,
bool cRequestPacket::add_String(const char* string)
{
- uint32_t len = strlen(string) + 1;
+ size_t len = strlen(string) + 1;
if (!checkExtend(len)) return false;
memcpy(buffer + bufUsed, string, len);
bufUsed += len;
@@ -167,7 +167,7 @@ bool cRequestPacket::add_S64(int64_t ll)
return true;
}
-bool cRequestPacket::checkExtend(uint32_t by)
+bool cRequestPacket::checkExtend(size_t by)
{
if (lengthSet) return true;
if ((bufUsed + by) <= bufSize) return true;
diff --git a/src/requestpacket.h b/src/requestpacket.h
index 7d67c11..499f679 100644
--- a/src/requestpacket.h
+++ b/src/requestpacket.h
@@ -21,6 +21,7 @@
*/
#include <stdint.h>
+#include <stddef.h>
class cRequestPacket
{
@@ -28,7 +29,7 @@ class cRequestPacket
cRequestPacket();
~cRequestPacket();
- bool init(uint32_t opcode, bool stream = false, bool setUserDataLength = false, uint32_t userDataLength = 0);
+ bool init(uint32_t opcode, bool stream = false, bool setUserDataLength = false, size_t userDataLength = 0);
bool add_String(const char* string);
bool add_U8(uint8_t c);
bool add_U32(uint32_t ul);
@@ -37,7 +38,7 @@ class cRequestPacket
bool add_S64(int64_t ll);
uint8_t* getPtr() { return buffer; }
- uint32_t getLen() { return bufUsed; }
+ size_t getLen() { return bufUsed; }
uint32_t getChannel() { return channel; }
uint32_t getSerial() { return serialNumber; }
@@ -47,8 +48,8 @@ class cRequestPacket
static uint32_t serialNumberCounter;
uint8_t* buffer;
- uint32_t bufSize;
- uint32_t bufUsed;
+ size_t bufSize;
+ size_t bufUsed;
bool lengthSet;
uint32_t channel;
@@ -56,8 +57,8 @@ class cRequestPacket
uint32_t opcode;
- bool checkExtend(uint32_t by);
+ bool checkExtend(size_t by);
- const static uint32_t headerLength = 16;
- const static uint32_t userDataLenPos = 12;
+ const static size_t headerLength = 16;
+ const static size_t userDataLenPos = 12;
};
--
kodi-pvr-vdr-vnsi packaging
More information about the pkg-multimedia-commits
mailing list