diff --git a/qrtplib/rtcpapppacket.cpp b/qrtplib/rtcpapppacket.cpp index 7aeb9abd3..07737797e 100644 --- a/qrtplib/rtcpapppacket.cpp +++ b/qrtplib/rtcpapppacket.cpp @@ -35,13 +35,13 @@ namespace qrtplib { -RTCPAPPPacket::RTCPAPPPacket(uint8_t *data, size_t datalength) : +RTCPAPPPacket::RTCPAPPPacket(uint8_t *data, std::size_t datalength) : RTCPPacket(APP, data, datalength) { knownformat = false; RTCPCommonHeader *hdr; - size_t len = datalength; + std::size_t len = datalength; hdr = (RTCPCommonHeader *) data; if (hdr->padding) @@ -49,9 +49,9 @@ RTCPAPPPacket::RTCPAPPPacket(uint8_t *data, size_t datalength) : uint8_t padcount = data[datalength - 1]; if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37) return; - if (((size_t) padcount) >= len) + if (((std::size_t) padcount) >= len) return; - len -= (size_t) padcount; + len -= (std::size_t) padcount; } if (len < (sizeof(RTCPCommonHeader) + sizeof(uint32_t) * 2)) diff --git a/qrtplib/rtcpapppacket.h b/qrtplib/rtcpapppacket.h index b2cd5579a..ab4839c18 100644 --- a/qrtplib/rtcpapppacket.h +++ b/qrtplib/rtcpapppacket.h @@ -57,7 +57,7 @@ public: * is referenced inside the class (no copy of the data is made) one must make sure that the memory it * points to is valid as long as the class instance exists. */ - RTCPAPPPacket(uint8_t *data, size_t datalen); + RTCPAPPPacket(uint8_t *data, std::size_t datalen); ~RTCPAPPPacket() { } @@ -77,10 +77,10 @@ public: uint8_t *GetAPPData(); /** Returns the length of the actual data. */ - size_t GetAPPDataLength() const; + std::size_t GetAPPDataLength() const; private: RTPEndian m_endian; - size_t appdatalen; + std::size_t appdatalen; }; inline uint8_t RTCPAPPPacket::GetSubType() const @@ -117,7 +117,7 @@ inline uint8_t *RTCPAPPPacket::GetAPPData() return (data + sizeof(RTCPCommonHeader) + sizeof(uint32_t) * 2); } -inline size_t RTCPAPPPacket::GetAPPDataLength() const +inline std::size_t RTCPAPPPacket::GetAPPDataLength() const { if (!knownformat) return 0; diff --git a/qrtplib/rtcpbyepacket.cpp b/qrtplib/rtcpbyepacket.cpp index 443f47797..23d1f5eec 100644 --- a/qrtplib/rtcpbyepacket.cpp +++ b/qrtplib/rtcpbyepacket.cpp @@ -35,14 +35,14 @@ namespace qrtplib { -RTCPBYEPacket::RTCPBYEPacket(uint8_t *data, size_t datalength) : +RTCPBYEPacket::RTCPBYEPacket(uint8_t *data, std::size_t datalength) : RTCPPacket(BYE, data, datalength) { knownformat = false; reasonoffset = 0; RTCPCommonHeader *hdr; - size_t len = datalength; + std::size_t len = datalength; hdr = (RTCPCommonHeader *) data; if (hdr->padding) @@ -50,18 +50,18 @@ RTCPBYEPacket::RTCPBYEPacket(uint8_t *data, size_t datalength) : uint8_t padcount = data[datalength - 1]; if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37) return; - if (((size_t) padcount) >= len) + if (((std::size_t) padcount) >= len) return; - len -= (size_t) padcount; + len -= (std::size_t) padcount; } - size_t ssrclen = ((size_t)(hdr->count)) * sizeof(uint32_t) + sizeof(RTCPCommonHeader); + std::size_t ssrclen = ((std::size_t)(hdr->count)) * sizeof(uint32_t) + sizeof(RTCPCommonHeader); if (ssrclen > len) return; if (ssrclen < len) // there's probably a reason for leaving { uint8_t *reasonlength = (data + ssrclen); - size_t reaslen = (size_t)(*reasonlength); + std::size_t reaslen = (std::size_t)(*reasonlength); if (reaslen > (len - ssrclen - 1)) return; reasonoffset = ssrclen; diff --git a/qrtplib/rtcpbyepacket.h b/qrtplib/rtcpbyepacket.h index 6619af851..993d40df4 100644 --- a/qrtplib/rtcpbyepacket.h +++ b/qrtplib/rtcpbyepacket.h @@ -57,7 +57,7 @@ public: * is referenced inside the class (no copy of the data is made) one must make sure that the memory it * points to is valid as long as the class instance exists. */ - RTCPBYEPacket(uint8_t *data, size_t datalen); + RTCPBYEPacket(uint8_t *data, std::size_t datalen); ~RTCPBYEPacket() { } @@ -74,14 +74,14 @@ public: bool HasReasonForLeaving() const; /** Returns the length of the string which describes why the source(s) left. */ - size_t GetReasonLength() const; + std::size_t GetReasonLength() const; /** Returns the actual reason for leaving data. */ uint8_t *GetReasonData(); private: RTPEndian m_endian; - size_t reasonoffset; + std::size_t reasonoffset; }; inline int RTCPBYEPacket::GetSSRCCount() const @@ -110,14 +110,14 @@ inline bool RTCPBYEPacket::HasReasonForLeaving() const return true; } -inline size_t RTCPBYEPacket::GetReasonLength() const +inline std::size_t RTCPBYEPacket::GetReasonLength() const { if (!knownformat) return 0; if (reasonoffset == 0) return 0; uint8_t *reasonlen = (data + reasonoffset); - return (size_t)(*reasonlen); + return (std::size_t)(*reasonlen); } inline uint8_t *RTCPBYEPacket::GetReasonData() diff --git a/qrtplib/rtcpcompoundpacket.cpp b/qrtplib/rtcpcompoundpacket.cpp index 4a0e1d228..959cd978d 100644 --- a/qrtplib/rtcpcompoundpacket.cpp +++ b/qrtplib/rtcpcompoundpacket.cpp @@ -58,7 +58,7 @@ RTCPCompoundPacket::RTCPCompoundPacket(RTPRawPacket &rawpack) } uint8_t *data = rawpack.GetData(); - size_t datalen = rawpack.GetDataLength(); + std::size_t datalen = rawpack.GetDataLength(); error = ParseData(data, datalen); if (error < 0) @@ -73,7 +73,7 @@ RTCPCompoundPacket::RTCPCompoundPacket(RTPRawPacket &rawpack) rtcppackit = rtcppacklist.begin(); } -RTCPCompoundPacket::RTCPCompoundPacket(uint8_t *packet, size_t packetlen, bool deletedata) +RTCPCompoundPacket::RTCPCompoundPacket(uint8_t *packet, std::size_t packetlen, bool deletedata) { compoundpacket = 0; compoundpacketlength = 0; @@ -97,7 +97,7 @@ RTCPCompoundPacket::RTCPCompoundPacket() deletepacket = true; } -int RTCPCompoundPacket::ParseData(uint8_t *data, size_t datalen) +int RTCPCompoundPacket::ParseData(uint8_t *data, std::size_t datalen) { bool first; @@ -109,7 +109,7 @@ int RTCPCompoundPacket::ParseData(uint8_t *data, size_t datalen) do { RTCPCommonHeader *rtcphdr; - size_t length; + std::size_t length; rtcphdr = (RTCPCommonHeader *) data; if (rtcphdr->version != RTP_VERSION) // check version @@ -129,7 +129,7 @@ int RTCPCompoundPacket::ParseData(uint8_t *data, size_t datalen) } } - length = (size_t) m_endian.qToHost(rtcphdr->length); + length = (std::size_t) m_endian.qToHost(rtcphdr->length); length++; length *= sizeof(uint32_t); @@ -182,7 +182,7 @@ int RTCPCompoundPacket::ParseData(uint8_t *data, size_t datalen) datalen -= length; data += length; - } while (datalen >= (size_t) sizeof(RTCPCommonHeader)); + } while (datalen >= (std::size_t) sizeof(RTCPCommonHeader)); if (datalen != 0) // some remaining bytes { diff --git a/qrtplib/rtcpcompoundpacket.h b/qrtplib/rtcpcompoundpacket.h index c5f59f5b7..e84b6aa70 100644 --- a/qrtplib/rtcpcompoundpacket.h +++ b/qrtplib/rtcpcompoundpacket.h @@ -61,7 +61,7 @@ public: * flag specifies if the data in \c packet should be deleted when the compound packet is destroyed. If * specified, a memory manager will be installed. */ - RTCPCompoundPacket(uint8_t *packet, size_t len, bool deletedata = true); + RTCPCompoundPacket(uint8_t *packet, std::size_t len, bool deletedata = true); protected: RTCPCompoundPacket(); // this is for the compoundpacket builder public: @@ -83,7 +83,7 @@ public: } /** Returns the size of the entire RTCP compound packet. */ - size_t GetCompoundPacketLength() + std::size_t GetCompoundPacketLength() { return compoundpacketlength; } @@ -109,13 +109,13 @@ public: protected: void ClearPacketList(); - int ParseData(uint8_t *packet, size_t len); + int ParseData(uint8_t *packet, std::size_t len); RTPEndian m_endian; int error; uint8_t *compoundpacket; - size_t compoundpacketlength; + std::size_t compoundpacketlength; bool deletepacket; std::list rtcppacklist; diff --git a/qrtplib/rtcpcompoundpacketbuilder.cpp b/qrtplib/rtcpcompoundpacketbuilder.cpp index b571254ac..7aeba2abc 100644 --- a/qrtplib/rtcpcompoundpacketbuilder.cpp +++ b/qrtplib/rtcpcompoundpacketbuilder.cpp @@ -80,7 +80,7 @@ void RTCPCompoundPacketBuilder::ClearBuildBuffers() appsize = 0; } -int RTCPCompoundPacketBuilder::InitBuild(size_t maxpacketsize) +int RTCPCompoundPacketBuilder::InitBuild(std::size_t maxpacketsize) { if (arebuilding) return ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYBUILDING; @@ -100,7 +100,7 @@ int RTCPCompoundPacketBuilder::InitBuild(size_t maxpacketsize) return 0; } -int RTCPCompoundPacketBuilder::InitBuild(void *externalbuffer, size_t buffersize) +int RTCPCompoundPacketBuilder::InitBuild(void *externalbuffer, std::size_t buffersize) { if (arebuilding) return ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYBUILDING; @@ -128,9 +128,9 @@ int RTCPCompoundPacketBuilder::StartSenderReport(uint32_t senderssrc, const RTPN if (report.headerlength != 0) return ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYGOTREPORT; - size_t totalsize = byesize + appsize + sdes.NeededBytes(); - size_t sizeleft = maximumpacketsize - totalsize; - size_t neededsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t) + sizeof(RTCPSenderReport); + std::size_t totalsize = byesize + appsize + sdes.NeededBytes(); + std::size_t sizeleft = maximumpacketsize - totalsize; + std::size_t neededsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t) + sizeof(RTCPSenderReport); if (neededsize > sizeleft) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; @@ -160,9 +160,9 @@ int RTCPCompoundPacketBuilder::StartReceiverReport(uint32_t senderssrc) if (report.headerlength != 0) return ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYGOTREPORT; - size_t totalsize = byesize + appsize + sdes.NeededBytes(); - size_t sizeleft = maximumpacketsize - totalsize; - size_t neededsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t); + std::size_t totalsize = byesize + appsize + sdes.NeededBytes(); + std::size_t sizeleft = maximumpacketsize - totalsize; + std::size_t neededsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t); if (neededsize > sizeleft) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; @@ -185,8 +185,8 @@ int RTCPCompoundPacketBuilder::AddReportBlock(uint32_t ssrc, uint8_t fractionlos if (report.headerlength == 0) return ERR_RTP_RTCPCOMPPACKBUILDER_REPORTNOTSTARTED; - size_t totalothersize = byesize + appsize + sdes.NeededBytes(); - size_t reportsizewithextrablock = report.NeededBytesWithExtraReportBlock(); + std::size_t totalothersize = byesize + appsize + sdes.NeededBytes(); + std::size_t reportsizewithextrablock = report.NeededBytesWithExtraReportBlock(); if ((totalothersize + reportsizewithextrablock) > maximumpacketsize) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; @@ -218,8 +218,8 @@ int RTCPCompoundPacketBuilder::AddSDESSource(uint32_t ssrc) if (!arebuilding) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING; - size_t totalotherbytes = byesize + appsize + report.NeededBytes(); - size_t sdessizewithextrasource = sdes.NeededBytesWithExtraSource(); + std::size_t totalotherbytes = byesize + appsize + report.NeededBytes(); + std::size_t sdessizewithextrasource = sdes.NeededBytesWithExtraSource(); if ((totalotherbytes + sdessizewithextrasource) > maximumpacketsize) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; @@ -267,26 +267,26 @@ int RTCPCompoundPacketBuilder::AddSDESNormalItem(RTCPSDESPacket::ItemType t, con return ERR_RTP_RTCPCOMPPACKBUILDER_INVALIDITEMTYPE; } - size_t totalotherbytes = byesize + appsize + report.NeededBytes(); - size_t sdessizewithextraitem = sdes.NeededBytesWithExtraItem(itemlength); + std::size_t totalotherbytes = byesize + appsize + report.NeededBytes(); + std::size_t sdessizewithextraitem = sdes.NeededBytesWithExtraItem(itemlength); if ((sdessizewithextraitem + totalotherbytes) > maximumpacketsize) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; uint8_t *buf; - size_t len; + std::size_t len; - buf = new uint8_t[sizeof(RTCPSDESHeader) + (size_t) itemlength]; + buf = new uint8_t[sizeof(RTCPSDESHeader) + (std::size_t) itemlength]; if (buf == 0) return ERR_RTP_OUTOFMEM; - len = sizeof(RTCPSDESHeader) + (size_t) itemlength; + len = sizeof(RTCPSDESHeader) + (std::size_t) itemlength; RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *) (buf); sdeshdr->sdesid = itemid; sdeshdr->length = itemlength; if (itemlength != 0) - memcpy((buf + sizeof(RTCPSDESHeader)), itemdata, (size_t) itemlength); + memcpy((buf + sizeof(RTCPSDESHeader)), itemdata, (std::size_t) itemlength); sdes.AddItem(buf, len); return 0; @@ -300,23 +300,23 @@ int RTCPCompoundPacketBuilder::AddSDESPrivateItem(const void *prefixdata, uint8_ if (sdes.sdessources.empty()) return ERR_RTP_RTCPCOMPPACKBUILDER_NOCURRENTSOURCE; - size_t itemlength = ((size_t) prefixlength) + 1 + ((size_t) valuelength); + std::size_t itemlength = ((std::size_t) prefixlength) + 1 + ((std::size_t) valuelength); if (itemlength > 255) return ERR_RTP_RTCPCOMPPACKBUILDER_TOTALITEMLENGTHTOOBIG; - size_t totalotherbytes = byesize + appsize + report.NeededBytes(); - size_t sdessizewithextraitem = sdes.NeededBytesWithExtraItem(itemlength); + std::size_t totalotherbytes = byesize + appsize + report.NeededBytes(); + std::size_t sdessizewithextraitem = sdes.NeededBytesWithExtraItem(itemlength); if ((sdessizewithextraitem + totalotherbytes) > maximumpacketsize) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; uint8_t *buf; - size_t len; + std::size_t len; buf = new uint8_t[sizeof(RTCPSDESHeader) + itemlength]; if (buf == 0) return ERR_RTP_OUTOFMEM; - len = sizeof(RTCPSDESHeader) + (size_t) itemlength; + len = sizeof(RTCPSDESHeader) + (std::size_t) itemlength; RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *) (buf); @@ -325,9 +325,9 @@ int RTCPCompoundPacketBuilder::AddSDESPrivateItem(const void *prefixdata, uint8_ buf[sizeof(RTCPSDESHeader)] = prefixlength; if (prefixlength != 0) - memcpy((buf + sizeof(RTCPSDESHeader) + 1), prefixdata, (size_t) prefixlength); + memcpy((buf + sizeof(RTCPSDESHeader) + 1), prefixdata, (std::size_t) prefixlength); if (valuelength != 0) - memcpy((buf + sizeof(RTCPSDESHeader) + 1 + (size_t) prefixlength), valuedata, (size_t) valuelength); + memcpy((buf + sizeof(RTCPSDESHeader) + 1 + (std::size_t) prefixlength), valuedata, (std::size_t) valuelength); sdes.AddItem(buf, len); return 0; @@ -342,15 +342,15 @@ int RTCPCompoundPacketBuilder::AddBYEPacket(uint32_t *ssrcs, uint8_t numssrcs, c if (numssrcs > 31) return ERR_RTP_RTCPCOMPPACKBUILDER_TOOMANYSSRCS; - size_t packsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t) * ((size_t) numssrcs); - size_t zerobytes = 0; + std::size_t packsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t) * ((std::size_t) numssrcs); + std::size_t zerobytes = 0; if (reasonlength > 0) { packsize += 1; // 1 byte for the length; - packsize += (size_t) reasonlength; + packsize += (std::size_t) reasonlength; - size_t r = (packsize & 0x03); + std::size_t r = (packsize & 0x03); if (r != 0) { zerobytes = 4 - r; @@ -358,13 +358,13 @@ int RTCPCompoundPacketBuilder::AddBYEPacket(uint32_t *ssrcs, uint8_t numssrcs, c } } - size_t totalotherbytes = appsize + byesize + sdes.NeededBytes() + report.NeededBytes(); + std::size_t totalotherbytes = appsize + byesize + sdes.NeededBytes() + report.NeededBytes(); if ((totalotherbytes + packsize) > maximumpacketsize) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; uint8_t *buf; - size_t numwords; + std::size_t numwords; buf = new uint8_t[packsize]; if (buf == 0) @@ -388,11 +388,11 @@ int RTCPCompoundPacketBuilder::AddBYEPacket(uint32_t *ssrcs, uint8_t numssrcs, c if (reasonlength != 0) { - size_t offset = sizeof(RTCPCommonHeader) + ((size_t) numssrcs) * sizeof(uint32_t); + std::size_t offset = sizeof(RTCPCommonHeader) + ((std::size_t) numssrcs) * sizeof(uint32_t); buf[offset] = reasonlength; - memcpy((buf + offset + 1), reasondata, (size_t) reasonlength); - for (size_t i = 0; i < zerobytes; i++) + memcpy((buf + offset + 1), reasondata, (std::size_t) reasonlength); + for (std::size_t i = 0; i < zerobytes; i++) buf[packsize - 1 - i] = 0; } @@ -402,7 +402,7 @@ int RTCPCompoundPacketBuilder::AddBYEPacket(uint32_t *ssrcs, uint8_t numssrcs, c return 0; } -int RTCPCompoundPacketBuilder::AddAPPPacket(uint8_t subtype, uint32_t ssrc, const uint8_t name[4], const void *appdata, size_t appdatalen) +int RTCPCompoundPacketBuilder::AddAPPPacket(uint8_t subtype, uint32_t ssrc, const uint8_t name[4], const void *appdata, std::size_t appdatalen) { if (!arebuilding) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING; @@ -411,13 +411,13 @@ int RTCPCompoundPacketBuilder::AddAPPPacket(uint8_t subtype, uint32_t ssrc, cons if ((appdatalen % 4) != 0) return ERR_RTP_RTCPCOMPPACKBUILDER_ILLEGALAPPDATALENGTH; - size_t appdatawords = appdatalen / 4; + std::size_t appdatawords = appdatalen / 4; if ((appdatawords + 2) > 65535) return ERR_RTP_RTCPCOMPPACKBUILDER_APPDATALENTOOBIG; - size_t packsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t) * 2 + appdatalen; - size_t totalotherbytes = appsize + byesize + sdes.NeededBytes() + report.NeededBytes(); + std::size_t packsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t) * 2 + appdatalen; + std::size_t totalotherbytes = appsize + byesize + sdes.NeededBytes() + report.NeededBytes(); if ((totalotherbytes + packsize) > maximumpacketsize) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; @@ -462,7 +462,7 @@ int RTCPCompoundPacketBuilder::EndBuild() return ERR_RTP_RTCPCOMPPACKBUILDER_NOREPORTPRESENT; uint8_t *buf; - size_t len; + std::size_t len; len = appsize + byesize + report.NeededBytes() + sdes.NeededBytes(); @@ -487,7 +487,7 @@ int RTCPCompoundPacketBuilder::EndBuild() do { RTCPCommonHeader *hdr = (RTCPCommonHeader *) curbuf; - size_t offset; + std::size_t offset; hdr->version = 2; hdr->padding = 0; @@ -516,7 +516,7 @@ int RTCPCompoundPacketBuilder::EndBuild() it++; } - size_t numwords = offset / sizeof(uint32_t); + std::size_t numwords = offset / sizeof(uint32_t); hdr->length = qToBigEndian((uint16_t) (numwords - 1)); hdr->count = count; @@ -551,7 +551,7 @@ int RTCPCompoundPacketBuilder::EndBuild() do { RTCPCommonHeader *hdr = (RTCPCommonHeader *) curbuf; - size_t offset = sizeof(RTCPCommonHeader); + std::size_t offset = sizeof(RTCPCommonHeader); hdr->version = 2; hdr->padding = 0; @@ -579,11 +579,11 @@ int RTCPCompoundPacketBuilder::EndBuild() curbuf[offset] = 0; // end of item list; offset++; - size_t r = offset & 0x03; + std::size_t r = offset & 0x03; if (r != 0) // align to 32 bit boundary { - size_t num = 4 - r; - size_t i; + std::size_t num = 4 - r; + std::size_t i; for (i = 0; i < num; i++) curbuf[offset + i] = 0; @@ -594,7 +594,7 @@ int RTCPCompoundPacketBuilder::EndBuild() sourcecount++; } - size_t numwords = offset / 4; + std::size_t numwords = offset / 4; hdr->count = sourcecount; hdr->length = qToBigEndian((uint16_t) (numwords - 1)); diff --git a/qrtplib/rtcpcompoundpacketbuilder.h b/qrtplib/rtcpcompoundpacketbuilder.h index 7430d653e..4a1fccfd9 100644 --- a/qrtplib/rtcpcompoundpacketbuilder.h +++ b/qrtplib/rtcpcompoundpacketbuilder.h @@ -66,13 +66,13 @@ public: * Starts building an RTCP compound packet with maximum size \c maxpacketsize. New memory will be allocated * to store the packet. */ - int InitBuild(size_t maxpacketsize); + int InitBuild(std::size_t maxpacketsize); /** Starts building a RTCP compound packet. * Starts building a RTCP compound packet. Data will be stored in \c externalbuffer which * can contain \c buffersize bytes. */ - int InitBuild(void *externalbuffer, size_t buffersize); + int InitBuild(void *externalbuffer, std::size_t buffersize); /** Adds a sender report to the compound packet. * Tells the packet builder that the packet should start with a sender report which will contain @@ -118,7 +118,7 @@ public: * Adds the APP packet specified by the arguments to the compound packet. Note that \c appdatalen has to be * a multiple of four. */ - int AddAPPPacket(uint8_t subtype, uint32_t ssrc, const uint8_t name[4], const void *appdata, size_t appdatalen); + int AddAPPPacket(uint8_t subtype, uint32_t ssrc, const uint8_t name[4], const void *appdata, std::size_t appdatalen); /** Finishes building the compound packet. * Finishes building the compound packet. If successful, the RTCPCompoundPacket member functions @@ -134,13 +134,13 @@ private: packetdata(0), packetlength(0) { } - Buffer(uint8_t *data, size_t len) : + Buffer(uint8_t *data, std::size_t len) : packetdata(data), packetlength(len) { } uint8_t *packetdata; - size_t packetlength; + std::size_t packetlength; }; class Report @@ -170,9 +170,9 @@ private: headerlength = 0; } - size_t NeededBytes() + std::size_t NeededBytes() { - size_t x, n, d, r; + std::size_t x, n, d, r; n = reportblocks.size(); if (n == 0) { @@ -194,9 +194,9 @@ private: return x; } - size_t NeededBytesWithExtraReportBlock() + std::size_t NeededBytesWithExtraReportBlock() { - size_t x, n, d, r; + std::size_t x, n, d, r; n = reportblocks.size() + 1; // +1 for the extra block x = n * sizeof(RTCPReceiverReport); d = n / 31; // max 31 reportblocks per report @@ -213,7 +213,7 @@ private: uint8_t *headerdata; uint32_t headerdata32[(sizeof(uint32_t) + sizeof(RTCPSenderReport)) / sizeof(uint32_t)]; // either for ssrc and sender info or just ssrc - size_t headerlength; + std::size_t headerlength; std::list reportblocks; }; @@ -235,9 +235,9 @@ private: items.clear(); } - size_t NeededBytes() + std::size_t NeededBytes() { - size_t x, r; + std::size_t x, r; x = totalitemsize + 1; // +1 for the 0 byte which terminates the item list r = x % sizeof(uint32_t); if (r != 0) @@ -246,10 +246,10 @@ private: return x; } - size_t NeededBytesWithExtraItem(uint8_t itemdatalength) + std::size_t NeededBytesWithExtraItem(uint8_t itemdatalength) { - size_t x, r; - x = totalitemsize + sizeof(RTCPSDESHeader) + (size_t) itemdatalength + 1; + std::size_t x, r; + x = totalitemsize + sizeof(RTCPSDESHeader) + (std::size_t) itemdatalength + 1; r = x % sizeof(uint32_t); if (r != 0) x += (sizeof(uint32_t) - r); // make sure it ends on a 32 bit boundary @@ -257,7 +257,7 @@ private: return x; } - void AddItem(uint8_t *buf, size_t len) + void AddItem(uint8_t *buf, std::size_t len) { Buffer b(buf, len); totalitemsize += len; @@ -267,7 +267,7 @@ private: uint32_t ssrc; std::list items; private: - size_t totalitemsize; + std::size_t totalitemsize; }; class SDES @@ -302,7 +302,7 @@ private: return 0; } - int AddItem(uint8_t *buf, size_t len) + int AddItem(uint8_t *buf, std::size_t len) { if (sdessources.empty()) return ERR_RTP_RTCPCOMPPACKBUILDER_NOCURRENTSOURCE; @@ -310,11 +310,11 @@ private: return 0; } - size_t NeededBytes() + std::size_t NeededBytes() { std::list::const_iterator it; - size_t x = 0; - size_t n, d, r; + std::size_t x = 0; + std::size_t n, d, r; if (sdessources.empty()) return 0; @@ -330,11 +330,11 @@ private: return x; } - size_t NeededBytesWithExtraItem(uint8_t itemdatalength) + std::size_t NeededBytesWithExtraItem(uint8_t itemdatalength) { std::list::const_iterator it; - size_t x = 0; - size_t n, d, r; + std::size_t x = 0; + std::size_t n, d, r; if (sdessources.empty()) return 0; @@ -351,11 +351,11 @@ private: return x; } - size_t NeededBytesWithExtraSource() + std::size_t NeededBytesWithExtraSource() { std::list::const_iterator it; - size_t x = 0; - size_t n, d, r; + std::size_t x = 0; + std::size_t n, d, r; if (sdessources.empty()) return 0; @@ -381,7 +381,7 @@ private: }; RTPEndian m_endian; - size_t maximumpacketsize; + std::size_t maximumpacketsize; uint8_t *buffer; bool external; bool arebuilding; @@ -390,10 +390,10 @@ private: SDES sdes; std::list byepackets; - size_t byesize; + std::size_t byesize; std::list apppackets; - size_t appsize; + std::size_t appsize; void ClearBuildBuffers(); }; diff --git a/qrtplib/rtcppacket.h b/qrtplib/rtcppacket.h index e5dcb129e..84092e340 100644 --- a/qrtplib/rtcppacket.h +++ b/qrtplib/rtcppacket.h @@ -40,6 +40,7 @@ #include "rtpconfig.h" #include "rtptypes.h" +#include namespace qrtplib { @@ -61,7 +62,7 @@ public: Unknown /**< The type of RTCP packet was not recognized. */ }; protected: - RTCPPacket(PacketType t, uint8_t *d, size_t dlen) : + RTCPPacket(PacketType t, uint8_t *d, std::size_t dlen) : data(d), datalen(dlen), packettype(t) { knownformat = false; @@ -90,14 +91,14 @@ public: } /** Returns the length of this RTCP packet. */ - size_t GetPacketLength() const + std::size_t GetPacketLength() const { return datalen; } protected: uint8_t *data; - size_t datalen; + std::size_t datalen; bool knownformat; private: const PacketType packettype; diff --git a/qrtplib/rtcppacketbuilder.cpp b/qrtplib/rtcppacketbuilder.cpp index 8ebe26dcf..c4b2ff543 100644 --- a/qrtplib/rtcppacketbuilder.cpp +++ b/qrtplib/rtcppacketbuilder.cpp @@ -52,7 +52,7 @@ RTCPPacketBuilder::~RTCPPacketBuilder() Destroy(); } -int RTCPPacketBuilder::Init(size_t maxpacksize, double tsunit, const void *cname, size_t cnamelen) +int RTCPPacketBuilder::Init(std::size_t maxpacksize, double tsunit, const void *cname, std::size_t cnamelen) { if (init) return ERR_RTP_RTCPPACKETBUILDER_ALREADYINIT; @@ -163,7 +163,7 @@ int RTCPPacketBuilder::BuildNextPacket(RTCPCompoundPacket **pack) } uint8_t *owncname; - size_t owncnamelen; + std::size_t owncnamelen; owncname = ownsdesinfo.GetCNAME(&owncnamelen); @@ -506,7 +506,7 @@ int RTCPPacketBuilder::FillInSDES(RTCPCompoundPacketBuilder *rtcpcomppack, bool { int status; uint8_t *data; - size_t datalen; + std::size_t datalen; *full = false; *processedall = false; @@ -626,7 +626,7 @@ void RTCPPacketBuilder::ClearAllSDESFlags() ownsdesinfo.ClearFlags(); } -int RTCPPacketBuilder::BuildBYEPacket(RTCPCompoundPacket **pack, const void *reason, size_t reasonlength, bool useSRifpossible) +int RTCPPacketBuilder::BuildBYEPacket(RTCPCompoundPacket **pack, const void *reason, std::size_t reasonlength, bool useSRifpossible) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; @@ -697,7 +697,7 @@ int RTCPPacketBuilder::BuildBYEPacket(RTCPCompoundPacket **pack, const void *rea } uint8_t *owncname; - size_t owncnamelen; + std::size_t owncnamelen; owncname = ownsdesinfo.GetCNAME(&owncnamelen); diff --git a/qrtplib/rtcppacketbuilder.h b/qrtplib/rtcppacketbuilder.h index 37908ef00..cfd612fc2 100644 --- a/qrtplib/rtcppacketbuilder.h +++ b/qrtplib/rtcppacketbuilder.h @@ -76,7 +76,7 @@ public: * The timestamp unit is defined as a time interval divided by the timestamp interval corresponding to * that interval: for 8000 Hz audio this would be 1/8000. */ - int Init(size_t maxpacksize, double timestampunit, const void *cname, size_t cnamelen); + int Init(std::size_t maxpacksize, double timestampunit, const void *cname, std::size_t cnamelen); /** Cleans up the builder. */ void Destroy(); @@ -97,7 +97,7 @@ public: } /** Sets the maximum size allowed size of an RTCP compound packet to \c maxpacksize. */ - int SetMaximumPacketSize(size_t maxpacksize) + int SetMaximumPacketSize(std::size_t maxpacksize) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; @@ -129,7 +129,7 @@ public: * \c useSRifpossible is set to \c true, the RTCP compound packet will start with a sender report if * allowed. Otherwise, a receiver report is used. */ - int BuildBYEPacket(RTCPCompoundPacket **pack, const void *reason, size_t reasonlength, bool useSRifpossible = true); + int BuildBYEPacket(RTCPCompoundPacket **pack, const void *reason, std::size_t reasonlength, bool useSRifpossible = true); /** Sets the RTCP interval for the SDES name item. * After all possible sources in the source table have been processed, the class will check if other @@ -210,7 +210,7 @@ public: } /** Sets the SDES name item for the local participant to the value \c s with length \c len. */ - int SetLocalName(const void *s, size_t len) + int SetLocalName(const void *s, std::size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; @@ -218,7 +218,7 @@ public: } /** Sets the SDES e-mail item for the local participant to the value \c s with length \c len. */ - int SetLocalEMail(const void *s, size_t len) + int SetLocalEMail(const void *s, std::size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; @@ -226,7 +226,7 @@ public: } /** Sets the SDES location item for the local participant to the value \c s with length \c len. */ - int SetLocalLocation(const void *s, size_t len) + int SetLocalLocation(const void *s, std::size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; @@ -234,7 +234,7 @@ public: } /** Sets the SDES phone item for the local participant to the value \c s with length \c len. */ - int SetLocalPhone(const void *s, size_t len) + int SetLocalPhone(const void *s, std::size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; @@ -242,7 +242,7 @@ public: } /** Sets the SDES tool item for the local participant to the value \c s with length \c len. */ - int SetLocalTool(const void *s, size_t len) + int SetLocalTool(const void *s, std::size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; @@ -250,7 +250,7 @@ public: } /** Sets the SDES note item for the local participant to the value \c s with length \c len. */ - int SetLocalNote(const void *s, size_t len) + int SetLocalNote(const void *s, std::size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; @@ -258,7 +258,7 @@ public: } /** Returns the own CNAME item with length \c len */ - uint8_t *GetLocalCNAME(size_t *len) const + uint8_t *GetLocalCNAME(std::size_t *len) const { if (!init) return 0; @@ -274,7 +274,7 @@ private: RTPPacketBuilder &rtppacketbuilder; bool init; - size_t maxpacketsize; + std::size_t maxpacketsize; double timestampunit; bool firstpacket; RTPTime prevbuildtime, transmissiondelay; diff --git a/qrtplib/rtcprrpacket.cpp b/qrtplib/rtcprrpacket.cpp index 9368127ac..5c7ccf673 100644 --- a/qrtplib/rtcprrpacket.cpp +++ b/qrtplib/rtcprrpacket.cpp @@ -35,14 +35,14 @@ namespace qrtplib { -RTCPRRPacket::RTCPRRPacket(uint8_t *data, size_t datalength) : +RTCPRRPacket::RTCPRRPacket(uint8_t *data, std::size_t datalength) : RTCPPacket(RR, data, datalength) { knownformat = false; RTCPCommonHeader *hdr; - size_t len = datalength; - size_t expectedlength; + std::size_t len = datalength; + std::size_t expectedlength; hdr = (RTCPCommonHeader *) data; if (hdr->padding) @@ -50,9 +50,9 @@ RTCPRRPacket::RTCPRRPacket(uint8_t *data, size_t datalength) : uint8_t padcount = data[datalength - 1]; if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37) return; - if (((size_t) padcount) >= len) + if (((std::size_t) padcount) >= len) return; - len -= (size_t) padcount; + len -= (std::size_t) padcount; } expectedlength = sizeof(RTCPCommonHeader) + sizeof(uint32_t); diff --git a/qrtplib/rtcprrpacket.h b/qrtplib/rtcprrpacket.h index d6b4b1011..66d158bb1 100644 --- a/qrtplib/rtcprrpacket.h +++ b/qrtplib/rtcprrpacket.h @@ -57,7 +57,7 @@ public: * is referenced inside the class (no copy of the data is made) one must make sure that the memory it points * to is valid as long as the class instance exists. */ - RTCPRRPacket(uint8_t *data, size_t datalen); + RTCPRRPacket(uint8_t *data, std::size_t datalen); ~RTCPRRPacket() { } diff --git a/qrtplib/rtcpscheduler.cpp b/qrtplib/rtcpscheduler.cpp index 99a2589f1..31f7a8bb1 100644 --- a/qrtplib/rtcpscheduler.cpp +++ b/qrtplib/rtcpscheduler.cpp @@ -120,15 +120,15 @@ void RTCPScheduler::AnalyseIncoming(RTCPCompoundPacket &rtcpcomppack) if (!isbye) { - size_t packsize = headeroverhead + rtcpcomppack.GetCompoundPacketLength(); - avgrtcppacksize = (size_t)((1.0 / 16.0) * ((double) packsize) + (15.0 / 16.0) * ((double) avgrtcppacksize)); + std::size_t packsize = headeroverhead + rtcpcomppack.GetCompoundPacketLength(); + avgrtcppacksize = (std::size_t)((1.0 / 16.0) * ((double) packsize) + (15.0 / 16.0) * ((double) avgrtcppacksize)); } else { if (byescheduled) { - size_t packsize = headeroverhead + rtcpcomppack.GetCompoundPacketLength(); - avgbyepacketsize = (size_t)((1.0 / 16.0) * ((double) packsize) + (15.0 / 16.0) * ((double) avgbyepacketsize)); + std::size_t packsize = headeroverhead + rtcpcomppack.GetCompoundPacketLength(); + avgbyepacketsize = (std::size_t)((1.0 / 16.0) * ((double) packsize) + (15.0 / 16.0) * ((double) avgbyepacketsize)); byemembers++; } } @@ -148,8 +148,8 @@ void RTCPScheduler::AnalyseOutgoing(RTCPCompoundPacket &rtcpcomppack) if (!isbye) { - size_t packsize = headeroverhead + rtcpcomppack.GetCompoundPacketLength(); - avgrtcppacksize = (size_t)((1.0 / 16.0) * ((double) packsize) + (15.0 / 16.0) * ((double) avgrtcppacksize)); + std::size_t packsize = headeroverhead + rtcpcomppack.GetCompoundPacketLength(); + avgrtcppacksize = (std::size_t)((1.0 / 16.0) * ((double) packsize) + (15.0 / 16.0) * ((double) avgrtcppacksize)); } hassentrtcp = true; @@ -354,7 +354,7 @@ void RTCPScheduler::PerformReverseReconsideration() pmembers = members; } -void RTCPScheduler::ScheduleBYEPacket(size_t packetsize) +void RTCPScheduler::ScheduleBYEPacket(std::size_t packetsize) { if (byescheduled) return; diff --git a/qrtplib/rtcpscheduler.h b/qrtplib/rtcpscheduler.h index 0d0961f91..f7bc84a47 100644 --- a/qrtplib/rtcpscheduler.h +++ b/qrtplib/rtcpscheduler.h @@ -41,6 +41,7 @@ #include "rtpconfig.h" #include "rtptimeutilities.h" #include "rtprandom.h" +#include namespace qrtplib { @@ -148,13 +149,13 @@ public: } /** Sets the header overhead from underlying protocols (for example UDP and IP) to \c numbytes. */ - void SetHeaderOverhead(size_t numbytes) + void SetHeaderOverhead(std::size_t numbytes) { headeroverhead = numbytes; } /** Returns the currently used header overhead. */ - size_t GetHeaderOverhead() const + std::size_t GetHeaderOverhead() const { return headeroverhead; } @@ -171,7 +172,7 @@ public: /** Asks the scheduler to schedule an RTCP compound packet containing a BYE packetl; the compound packet * has size \c packetsize. */ - void ScheduleBYEPacket(size_t packetsize); + void ScheduleBYEPacket(std::size_t packetsize); /** Returns the delay after which an RTCP compound will possibly have to be sent. * Returns the delay after which an RTCP compound will possibly have to be sent. The IsTime member function @@ -199,8 +200,8 @@ private: RTPSources &sources; RTCPSchedulerParams schedparams; - size_t headeroverhead; - size_t avgrtcppacksize; + std::size_t headeroverhead; + std::size_t avgrtcppacksize; bool hassentrtcp; bool firstcall; RTPTime nextrtcptime; @@ -210,7 +211,7 @@ private: // for BYE packet scheduling bool byescheduled; int byemembers, pbyemembers; - size_t avgbyepacketsize; + std::size_t avgbyepacketsize; bool sendbyenow; RTPRandom &rtprand; diff --git a/qrtplib/rtcpsdesinfo.cpp b/qrtplib/rtcpsdesinfo.cpp index 1ed1895d1..735065061 100644 --- a/qrtplib/rtcpsdesinfo.cpp +++ b/qrtplib/rtcpsdesinfo.cpp @@ -47,7 +47,7 @@ void RTCPSDESInfo::Clear() } #ifdef RTP_SUPPORT_SDESPRIV -int RTCPSDESInfo::SetPrivateValue(const uint8_t *prefix, size_t prefixlen, const uint8_t *value, size_t valuelen) +int RTCPSDESInfo::SetPrivateValue(const uint8_t *prefix, std::size_t prefixlen, const uint8_t *value, std::size_t valuelen) { std::list::const_iterator it; bool found; @@ -57,7 +57,7 @@ int RTCPSDESInfo::SetPrivateValue(const uint8_t *prefix, size_t prefixlen, const while (!found && it != privitems.end()) { uint8_t *p; - size_t l; + std::size_t l; p = (*it)->GetPrefix(&l); if (l == prefixlen) @@ -97,7 +97,7 @@ int RTCPSDESInfo::SetPrivateValue(const uint8_t *prefix, size_t prefixlen, const return item->SetInfo(value, valuelen); } -int RTCPSDESInfo::DeletePrivatePrefix(const uint8_t *prefix, size_t prefixlen) +int RTCPSDESInfo::DeletePrivatePrefix(const uint8_t *prefix, std::size_t prefixlen) { std::list::iterator it; bool found; @@ -107,7 +107,7 @@ int RTCPSDESInfo::DeletePrivatePrefix(const uint8_t *prefix, size_t prefixlen) while (!found && it != privitems.end()) { uint8_t *p; - size_t l; + std::size_t l; p = (*it)->GetPrefix(&l); if (l == prefixlen) @@ -135,7 +135,7 @@ void RTCPSDESInfo::GotoFirstPrivateValue() curitem = privitems.begin(); } -bool RTCPSDESInfo::GetNextPrivateValue(uint8_t **prefix, size_t *prefixlen, uint8_t **value, size_t *valuelen) +bool RTCPSDESInfo::GetNextPrivateValue(uint8_t **prefix, std::size_t *prefixlen, uint8_t **value, std::size_t *valuelen) { if (curitem == privitems.end()) return false; @@ -145,7 +145,7 @@ bool RTCPSDESInfo::GetNextPrivateValue(uint8_t **prefix, size_t *prefixlen, uint return true; } -bool RTCPSDESInfo::GetPrivateValue(const uint8_t *prefix, size_t prefixlen, uint8_t **value, size_t *valuelen) const +bool RTCPSDESInfo::GetPrivateValue(const uint8_t *prefix, std::size_t prefixlen, uint8_t **value, std::size_t *valuelen) const { std::list::const_iterator it; bool found; @@ -155,7 +155,7 @@ bool RTCPSDESInfo::GetPrivateValue(const uint8_t *prefix, size_t prefixlen, uint while (!found && it != privitems.end()) { uint8_t *p; - size_t l; + std::size_t l; p = (*it)->GetPrefix(&l); if (l == prefixlen) diff --git a/qrtplib/rtcpsdesinfo.h b/qrtplib/rtcpsdesinfo.h index ab2e61568..34e169cc0 100644 --- a/qrtplib/rtcpsdesinfo.h +++ b/qrtplib/rtcpsdesinfo.h @@ -65,43 +65,43 @@ public: void Clear(); /** Sets the SDES CNAME item to \c s with length \c l. */ - int SetCNAME(const uint8_t *s, size_t l) + int SetCNAME(const uint8_t *s, std::size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_CNAME - 1, s, l); } /** Sets the SDES name item to \c s with length \c l. */ - int SetName(const uint8_t *s, size_t l) + int SetName(const uint8_t *s, std::size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_NAME - 1, s, l); } /** Sets the SDES e-mail item to \c s with length \c l. */ - int SetEMail(const uint8_t *s, size_t l) + int SetEMail(const uint8_t *s, std::size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_EMAIL - 1, s, l); } /** Sets the SDES phone item to \c s with length \c l. */ - int SetPhone(const uint8_t *s, size_t l) + int SetPhone(const uint8_t *s, std::size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_PHONE - 1, s, l); } /** Sets the SDES location item to \c s with length \c l. */ - int SetLocation(const uint8_t *s, size_t l) + int SetLocation(const uint8_t *s, std::size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_LOCATION - 1, s, l); } /** Sets the SDES tool item to \c s with length \c l. */ - int SetTool(const uint8_t *s, size_t l) + int SetTool(const uint8_t *s, std::size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_TOOL - 1, s, l); } /** Sets the SDES note item to \c s with length \c l. */ - int SetNote(const uint8_t *s, size_t l) + int SetNote(const uint8_t *s, std::size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_NOTE - 1, s, l); } @@ -111,50 +111,50 @@ public: * the value string specified by \c value with length \c valuelen (if the maximum allowed * number of prefixes was reached, the error code \c ERR_RTP_SDES_MAXPRIVITEMS is returned. */ - int SetPrivateValue(const uint8_t *prefix, size_t prefixlen, const uint8_t *value, size_t valuelen); + int SetPrivateValue(const uint8_t *prefix, std::size_t prefixlen, const uint8_t *value, std::size_t valuelen); /** Deletes the entry for the prefix specified by \c s with length \c len. */ - int DeletePrivatePrefix(const uint8_t *s, size_t len); + int DeletePrivatePrefix(const uint8_t *s, std::size_t len); #endif // RTP_SUPPORT_SDESPRIV /** Returns the SDES CNAME item and stores its length in \c len. */ - uint8_t *GetCNAME(size_t *len) const + uint8_t *GetCNAME(std::size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_CNAME - 1, len); } /** Returns the SDES name item and stores its length in \c len. */ - uint8_t *GetName(size_t *len) const + uint8_t *GetName(std::size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_NAME - 1, len); } /** Returns the SDES e-mail item and stores its length in \c len. */ - uint8_t *GetEMail(size_t *len) const + uint8_t *GetEMail(std::size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_EMAIL - 1, len); } /** Returns the SDES phone item and stores its length in \c len. */ - uint8_t *GetPhone(size_t *len) const + uint8_t *GetPhone(std::size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_PHONE - 1, len); } /** Returns the SDES location item and stores its length in \c len. */ - uint8_t *GetLocation(size_t *len) const + uint8_t *GetLocation(std::size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_LOCATION - 1, len); } /** Returns the SDES tool item and stores its length in \c len. */ - uint8_t *GetTool(size_t *len) const + uint8_t *GetTool(std::size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_TOOL - 1, len); } /** Returns the SDES note item and stores its length in \c len. */ - uint8_t *GetNote(size_t *len) const + uint8_t *GetNote(std::size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_NOTE - 1, len); } @@ -169,7 +169,7 @@ public: * then stored in \c value and \c valuelen. Otherwise, * it returns \c false. */ - bool GetNextPrivateValue(uint8_t **prefix, size_t *prefixlen, uint8_t **value, size_t *valuelen); + bool GetNextPrivateValue(uint8_t **prefix, std::size_t *prefixlen, uint8_t **value, std::size_t *valuelen); /** Returns SDES priv item information. * Looks for the entry which corresponds to the SDES private @@ -178,16 +178,16 @@ public: * value and its length in \c value and \c valuelen * respectively. */ - bool GetPrivateValue(const uint8_t *prefix, size_t prefixlen, uint8_t **value, size_t *valuelen) const; + bool GetPrivateValue(const uint8_t *prefix, std::size_t prefixlen, uint8_t **value, std::size_t *valuelen) const; #endif // RTP_SUPPORT_SDESPRIV private: - int SetNonPrivateItem(int itemno, const uint8_t *s, size_t l) + int SetNonPrivateItem(int itemno, const uint8_t *s, std::size_t l) { if (l > RTCP_SDES_MAXITEMLENGTH) return ERR_RTP_SDES_LENGTHTOOBIG; return nonprivateitems[itemno].SetInfo(s, l); } - uint8_t *GetNonPrivateItem(int itemno, size_t *len) const + uint8_t *GetNonPrivateItem(int itemno, std::size_t *len) const { return nonprivateitems[itemno].GetInfo(len); } @@ -205,17 +205,17 @@ private: if (str) delete[] str; } - uint8_t *GetInfo(size_t *len) const + uint8_t *GetInfo(std::size_t *len) const { *len = length; return str; } - int SetInfo(const uint8_t *s, size_t len) + int SetInfo(const uint8_t *s, std::size_t len) { return SetString(&str, &length, s, len); } protected: - int SetString(uint8_t **dest, size_t *destlen, const uint8_t *s, size_t len) + int SetString(uint8_t **dest, std::size_t *destlen, const uint8_t *s, std::size_t len) { if (len <= 0) { @@ -240,7 +240,7 @@ private: } private: uint8_t *str; - size_t length; + std::size_t length; }; SDESItem nonprivateitems[RTCP_SDES_NUMITEMS_NONPRIVATE]; @@ -259,18 +259,18 @@ private: if (prefix) delete[] prefix; } - uint8_t *GetPrefix(size_t *len) const + uint8_t *GetPrefix(std::size_t *len) const { *len = prefixlen; return prefix; } - int SetPrefix(const uint8_t *s, size_t len) + int SetPrefix(const uint8_t *s, std::size_t len) { return SetString(&prefix, &prefixlen, s, len); } private: uint8_t *prefix; - size_t prefixlen; + std::size_t prefixlen; }; std::list privitems; diff --git a/qrtplib/rtcpsdespacket.cpp b/qrtplib/rtcpsdespacket.cpp index 03663b18a..5c40d7f10 100644 --- a/qrtplib/rtcpsdespacket.cpp +++ b/qrtplib/rtcpsdespacket.cpp @@ -35,7 +35,7 @@ namespace qrtplib { -RTCPSDESPacket::RTCPSDESPacket(uint8_t *data, size_t datalength) : +RTCPSDESPacket::RTCPSDESPacket(uint8_t *data, std::size_t datalength) : RTCPPacket(SDES, data, datalength) { knownformat = false; @@ -44,16 +44,16 @@ RTCPSDESPacket::RTCPSDESPacket(uint8_t *data, size_t datalength) : curchunknum = 0; RTCPCommonHeader *hdr = (RTCPCommonHeader *) data; - size_t len = datalength; + std::size_t len = datalength; if (hdr->padding) { uint8_t padcount = data[datalength - 1]; if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37) return; - if (((size_t) padcount) >= len) + if (((std::size_t) padcount) >= len) return; - len -= (size_t) padcount; + len -= (std::size_t) padcount; } if (hdr->count == 0) @@ -93,10 +93,10 @@ RTCPSDESPacket::RTCPSDESPacket(uint8_t *data, size_t datalength) : len--; chunkoffset++; - size_t r = (chunkoffset & 0x03); + std::size_t r = (chunkoffset & 0x03); if (r != 0) { - size_t addoffset = 4 - r; + std::size_t addoffset = 4 - r; if (addoffset > len) return; @@ -113,7 +113,7 @@ RTCPSDESPacket::RTCPSDESPacket(uint8_t *data, size_t datalength) : len -= sizeof(RTCPSDESHeader); chunkoffset += sizeof(RTCPSDESHeader); - size_t itemlen = (size_t)(sdeshdr->length); + std::size_t itemlen = (std::size_t)(sdeshdr->length); if (itemlen > len) return; diff --git a/qrtplib/rtcpsdespacket.h b/qrtplib/rtcpsdespacket.h index 0cdf5639b..72cdb5b3c 100644 --- a/qrtplib/rtcpsdespacket.h +++ b/qrtplib/rtcpsdespacket.h @@ -73,7 +73,7 @@ public: * is referenced inside the class (no copy of the data is made) one must make sure that the memory it * points to is valid as long as the class instance exists. */ - RTCPSDESPacket(uint8_t *data, size_t datalen); + RTCPSDESPacket(uint8_t *data, std::size_t datalen); ~RTCPSDESPacket() { } @@ -115,7 +115,7 @@ public: ItemType GetItemType() const; /** Returns the item length of the current item in the current chunk. */ - size_t GetItemLength() const; + std::size_t GetItemLength() const; /** Returns the item data of the current item in the current chunk. */ uint8_t *GetItemData(); @@ -124,7 +124,7 @@ public: /** If the current item is an SDES PRIV item, this function returns the length of the * prefix string of the private item. */ - size_t GetPRIVPrefixLength() const; + std::size_t GetPRIVPrefixLength() const; /** If the current item is an SDES PRIV item, this function returns actual data of the * prefix string. @@ -134,7 +134,7 @@ public: /** If the current item is an SDES PRIV item, this function returns the length of the * value string of the private item. */ - size_t GetPRIVValueLength() const; + std::size_t GetPRIVValueLength() const; /** If the current item is an SDES PRIV item, this function returns actual value data of the * private item. @@ -146,7 +146,7 @@ private: RTPEndian m_endian; uint8_t *currentchunk; int curchunknum; - size_t itemoffset; + std::size_t itemoffset; }; inline int RTCPSDESPacket::GetChunkCount() const @@ -179,13 +179,13 @@ inline bool RTCPSDESPacket::GotoNextChunk() if (curchunknum == GetChunkCount()) return false; - size_t offset = sizeof(uint32_t); + std::size_t offset = sizeof(uint32_t); RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *) (currentchunk + sizeof(uint32_t)); while (sdeshdr->sdesid != 0) { offset += sizeof(RTCPSDESHeader); - offset += (size_t)(sdeshdr->length); + offset += (std::size_t)(sdeshdr->length); sdeshdr = (RTCPSDESHeader *) (currentchunk + offset); } offset++; // for the zero byte @@ -231,9 +231,9 @@ inline bool RTCPSDESPacket::GotoNextItem() if (sdeshdr->sdesid == 0) return false; - size_t offset = itemoffset; + std::size_t offset = itemoffset; offset += sizeof(RTCPSDESHeader); - offset += (size_t)(sdeshdr->length); + offset += (std::size_t)(sdeshdr->length); sdeshdr = (RTCPSDESHeader *) (currentchunk + offset); if (sdeshdr->sdesid == 0) return false; @@ -274,7 +274,7 @@ inline RTCPSDESPacket::ItemType RTCPSDESPacket::GetItemType() const return Unknown; } -inline size_t RTCPSDESPacket::GetItemLength() const +inline std::size_t RTCPSDESPacket::GetItemLength() const { if (!knownformat) return None; @@ -283,7 +283,7 @@ inline size_t RTCPSDESPacket::GetItemLength() const RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *) (currentchunk + itemoffset); if (sdeshdr->sdesid == 0) return 0; - return (size_t)(sdeshdr->length); + return (std::size_t)(sdeshdr->length); } inline uint8_t *RTCPSDESPacket::GetItemData() @@ -299,7 +299,7 @@ inline uint8_t *RTCPSDESPacket::GetItemData() } #ifdef RTP_SUPPORT_SDESPRIV -inline size_t RTCPSDESPacket::GetPRIVPrefixLength() const +inline std::size_t RTCPSDESPacket::GetPRIVPrefixLength() const { if (!knownformat) return 0; @@ -311,8 +311,8 @@ inline size_t RTCPSDESPacket::GetPRIVPrefixLength() const if (sdeshdr->length == 0) return 0; uint8_t *preflen = currentchunk + itemoffset + sizeof(RTCPSDESHeader); - size_t prefixlength = (size_t)(*preflen); - if (prefixlength > (size_t)((sdeshdr->length) - 1)) + std::size_t prefixlength = (std::size_t)(*preflen); + if (prefixlength > (std::size_t)((sdeshdr->length) - 1)) return 0; return prefixlength; } @@ -329,15 +329,15 @@ inline uint8_t *RTCPSDESPacket::GetPRIVPrefixData() if (sdeshdr->length == 0) return 0; uint8_t *preflen = currentchunk + itemoffset + sizeof(RTCPSDESHeader); - size_t prefixlength = (size_t)(*preflen); - if (prefixlength > (size_t)((sdeshdr->length) - 1)) + std::size_t prefixlength = (std::size_t)(*preflen); + if (prefixlength > (std::size_t)((sdeshdr->length) - 1)) return 0; if (prefixlength == 0) return 0; return (currentchunk + itemoffset + sizeof(RTCPSDESHeader) + 1); } -inline size_t RTCPSDESPacket::GetPRIVValueLength() const +inline std::size_t RTCPSDESPacket::GetPRIVValueLength() const { if (!knownformat) return 0; @@ -349,10 +349,10 @@ inline size_t RTCPSDESPacket::GetPRIVValueLength() const if (sdeshdr->length == 0) return 0; uint8_t *preflen = currentchunk + itemoffset + sizeof(RTCPSDESHeader); - size_t prefixlength = (size_t)(*preflen); - if (prefixlength > (size_t)((sdeshdr->length) - 1)) + std::size_t prefixlength = (std::size_t)(*preflen); + if (prefixlength > (std::size_t)((sdeshdr->length) - 1)) return 0; - return ((size_t)(sdeshdr->length)) - prefixlength - 1; + return ((std::size_t)(sdeshdr->length)) - prefixlength - 1; } inline uint8_t *RTCPSDESPacket::GetPRIVValueData() @@ -367,10 +367,10 @@ inline uint8_t *RTCPSDESPacket::GetPRIVValueData() if (sdeshdr->length == 0) return 0; uint8_t *preflen = currentchunk + itemoffset + sizeof(RTCPSDESHeader); - size_t prefixlength = (size_t)(*preflen); - if (prefixlength > (size_t)((sdeshdr->length) - 1)) + std::size_t prefixlength = (std::size_t)(*preflen); + if (prefixlength > (std::size_t)((sdeshdr->length) - 1)) return 0; - size_t valuelen = ((size_t)(sdeshdr->length)) - prefixlength - 1; + std::size_t valuelen = ((std::size_t)(sdeshdr->length)) - prefixlength - 1; if (valuelen == 0) return 0; return (currentchunk + itemoffset + sizeof(RTCPSDESHeader) + 1 + prefixlength); diff --git a/qrtplib/rtcpsrpacket.cpp b/qrtplib/rtcpsrpacket.cpp index 805699018..119bb102a 100644 --- a/qrtplib/rtcpsrpacket.cpp +++ b/qrtplib/rtcpsrpacket.cpp @@ -35,14 +35,14 @@ namespace qrtplib { -RTCPSRPacket::RTCPSRPacket(uint8_t *data, size_t datalength) : +RTCPSRPacket::RTCPSRPacket(uint8_t *data, std::size_t datalength) : RTCPPacket(SR, data, datalength) { knownformat = false; RTCPCommonHeader *hdr; - size_t len = datalength; - size_t expectedlength; + std::size_t len = datalength; + std::size_t expectedlength; hdr = (RTCPCommonHeader *) data; if (hdr->padding) @@ -50,9 +50,9 @@ RTCPSRPacket::RTCPSRPacket(uint8_t *data, size_t datalength) : uint8_t padcount = data[datalength - 1]; if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37) return; - if (((size_t) padcount) >= len) + if (((std::size_t) padcount) >= len) return; - len -= (size_t) padcount; + len -= (std::size_t) padcount; } expectedlength = sizeof(RTCPCommonHeader) + sizeof(uint32_t) + sizeof(RTCPSenderReport); diff --git a/qrtplib/rtcpsrpacket.h b/qrtplib/rtcpsrpacket.h index bbd968d73..cb6c6e29d 100644 --- a/qrtplib/rtcpsrpacket.h +++ b/qrtplib/rtcpsrpacket.h @@ -58,7 +58,7 @@ public: * is referenced inside the class (no copy of the data is made) one must make sure that the memory it * points to is valid as long as the class instance exists. */ - RTCPSRPacket(uint8_t *data, size_t datalength); + RTCPSRPacket(uint8_t *data, std::size_t datalength); ~RTCPSRPacket() { } diff --git a/qrtplib/rtcpunknownpacket.h b/qrtplib/rtcpunknownpacket.h index 6575cbd18..8bb3e3e4a 100644 --- a/qrtplib/rtcpunknownpacket.h +++ b/qrtplib/rtcpunknownpacket.h @@ -59,7 +59,7 @@ public: * is referenced inside the class (no copy of the data is made) one must make sure that the memory it * points to is valid as long as the class instance exists. */ - RTCPUnknownPacket(uint8_t *data, size_t datalen) : + RTCPUnknownPacket(uint8_t *data, std::size_t datalen) : RTCPPacket(Unknown, data, datalen) { // Since we don't expect a format, we'll trivially put knownformat = true diff --git a/qrtplib/rtpexternaltransmitter.cpp b/qrtplib/rtpexternaltransmitter.cpp index 1c909f4ad..83c6cec08 100644 --- a/qrtplib/rtpexternaltransmitter.cpp +++ b/qrtplib/rtpexternaltransmitter.cpp @@ -69,7 +69,7 @@ int RTPExternalTransmitter::Init(bool tsafe) return 0; } -int RTPExternalTransmitter::Create(size_t maximumpacketsize, const RTPTransmissionParams *transparams) +int RTPExternalTransmitter::Create(std::size_t maximumpacketsize, const RTPTransmissionParams *transparams) { const RTPExternalTransmissionParams *params; int status; @@ -163,7 +163,7 @@ void RTPExternalTransmitter::DeleteTransmissionInfo(RTPTransmissionInfo *i) delete i; } -int RTPExternalTransmitter::GetLocalHostName(uint8_t *buffer, size_t *bufferlength) +int RTPExternalTransmitter::GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength) { if (!init) return ERR_RTP_EXTERNALTRANS_NOTINIT; @@ -297,7 +297,7 @@ int RTPExternalTransmitter::AbortWait() return 0; } -int RTPExternalTransmitter::SendRTPData(const void *data, size_t len) +int RTPExternalTransmitter::SendRTPData(const void *data, std::size_t len) { if (!init) return ERR_RTP_EXTERNALTRANS_NOTINIT; @@ -322,7 +322,7 @@ int RTPExternalTransmitter::SendRTPData(const void *data, size_t len) return 0; } -int RTPExternalTransmitter::SendRTCPData(const void *data, size_t len) +int RTPExternalTransmitter::SendRTCPData(const void *data, std::size_t len) { if (!init) return ERR_RTP_EXTERNALTRANS_NOTINIT; @@ -424,7 +424,7 @@ void RTPExternalTransmitter::ClearAcceptList() { } -int RTPExternalTransmitter::SetMaximumPacketSize(size_t s) +int RTPExternalTransmitter::SetMaximumPacketSize(std::size_t s) { if (!init) return ERR_RTP_EXTERNALTRANS_NOTINIT; @@ -490,7 +490,7 @@ void RTPExternalTransmitter::FlushPackets() rawpacketlist.clear(); } -void RTPExternalTransmitter::InjectRTP(const void *data, size_t len, const RTPAddress &a) +void RTPExternalTransmitter::InjectRTP(const void *data, std::size_t len, const RTPAddress &a) { if (!init) return; @@ -534,7 +534,7 @@ void RTPExternalTransmitter::InjectRTP(const void *data, size_t len, const RTPAd } -void RTPExternalTransmitter::InjectRTCP(const void *data, size_t len, const RTPAddress &a) +void RTPExternalTransmitter::InjectRTCP(const void *data, std::size_t len, const RTPAddress &a) { if (!init) return; @@ -578,7 +578,7 @@ void RTPExternalTransmitter::InjectRTCP(const void *data, size_t len, const RTPA } -void RTPExternalTransmitter::InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a) +void RTPExternalTransmitter::InjectRTPorRTCP(const void *data, std::size_t len, const RTPAddress &a) { if (!init) return; diff --git a/qrtplib/rtpexternaltransmitter.h b/qrtplib/rtpexternaltransmitter.h index c43c122d7..9cfc82fdc 100644 --- a/qrtplib/rtpexternaltransmitter.h +++ b/qrtplib/rtpexternaltransmitter.h @@ -67,10 +67,10 @@ public: } /** This member function will be called when RTP data needs to be transmitted. */ - virtual bool SendRTP(const void *data, size_t len) = 0; + virtual bool SendRTP(const void *data, std::size_t len) = 0; /** This member function will be called when an RTCP packet needs to be transmitted. */ - virtual bool SendRTCP(const void *data, size_t len) = 0; + virtual bool SendRTCP(const void *data, std::size_t len) = 0; /** Used to identify if an RTPAddress instance originated from this sender (to be able to detect own packets). */ virtual bool ComesFromThisSender(const RTPAddress *a) = 0; @@ -95,13 +95,13 @@ public: } /** This function can be called to insert an RTP packet into the transmission component. */ - void InjectRTP(const void *data, size_t len, const RTPAddress &a); + void InjectRTP(const void *data, std::size_t len, const RTPAddress &a); /** This function can be called to insert an RTCP packet into the transmission component. */ - void InjectRTCP(const void *data, size_t len, const RTPAddress &a); + void InjectRTCP(const void *data, std::size_t len, const RTPAddress &a); /** Use this function to inject an RTP or RTCP packet and the transmitter will try to figure out which type of packet it is. */ - void InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a); + void InjectRTPorRTCP(const void *data, std::size_t len, const RTPAddress &a); private: RTPExternalTransmitter *transmitter; }; @@ -167,14 +167,14 @@ public: ~RTPExternalTransmitter(); int Init(bool treadsafe); - int Create(size_t maxpacksize, const RTPTransmissionParams *transparams); + int Create(std::size_t maxpacksize, const RTPTransmissionParams *transparams); void Destroy(); RTPTransmissionInfo *GetTransmissionInfo(); void DeleteTransmissionInfo(RTPTransmissionInfo *inf); - int GetLocalHostName(uint8_t *buffer, size_t *bufferlength); + int GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength); bool ComesFromThisTransmitter(const RTPAddress *addr); - size_t GetHeaderOverhead() + std::size_t GetHeaderOverhead() { return headersize; } @@ -183,8 +183,8 @@ public: int WaitForIncomingData(const RTPTime &delay, bool *dataavailable = 0); int AbortWait(); - int SendRTPData(const void *data, size_t len); - int SendRTCPData(const void *data, size_t len); + int SendRTPData(const void *data, std::size_t len); + int SendRTCPData(const void *data, std::size_t len); int AddDestination(const RTPAddress &addr); int DeleteDestination(const RTPAddress &addr); @@ -202,14 +202,14 @@ public: int AddToAcceptList(const RTPAddress &addr); int DeleteFromAcceptList(const RTPAddress &addr); void ClearAcceptList(); - int SetMaximumPacketSize(size_t s); + int SetMaximumPacketSize(std::size_t s); bool NewDataAvailable(); RTPRawPacket *GetNextPacket(); - void InjectRTP(const void *data, size_t len, const RTPAddress &a); - void InjectRTCP(const void *data, size_t len, const RTPAddress &a); - void InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a); + void InjectRTP(const void *data, std::size_t len, const RTPAddress &a); + void InjectRTCP(const void *data, std::size_t len, const RTPAddress &a); + void InjectRTPorRTCP(const void *data, std::size_t len, const RTPAddress &a); private: void FlushPackets(); @@ -222,26 +222,26 @@ private: std::list rawpacketlist; uint8_t *localhostname; - size_t localhostnamelength; + std::size_t localhostnamelength; - size_t maxpacksize; + std::size_t maxpacksize; int headersize; RTPAbortDescriptors m_abortDesc; int m_abortCount; }; -inline void RTPExternalPacketInjecter::InjectRTP(const void *data, size_t len, const RTPAddress &a) +inline void RTPExternalPacketInjecter::InjectRTP(const void *data, std::size_t len, const RTPAddress &a) { transmitter->InjectRTP(data, len, a); } -inline void RTPExternalPacketInjecter::InjectRTCP(const void *data, size_t len, const RTPAddress &a) +inline void RTPExternalPacketInjecter::InjectRTCP(const void *data, std::size_t len, const RTPAddress &a) { transmitter->InjectRTCP(data, len, a); } -inline void RTPExternalPacketInjecter::InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a) +inline void RTPExternalPacketInjecter::InjectRTPorRTCP(const void *data, std::size_t len, const RTPAddress &a) { transmitter->InjectRTPorRTCP(data, len, a); } diff --git a/qrtplib/rtpinternalsourcedata.cpp b/qrtplib/rtpinternalsourcedata.cpp index e13cffa5f..4995dd97f 100644 --- a/qrtplib/rtpinternalsourcedata.cpp +++ b/qrtplib/rtpinternalsourcedata.cpp @@ -147,7 +147,7 @@ int RTPInternalSourceData::ProcessRTPPacket(RTPPacket *rtppack, const RTPTime &r return 0; } -int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data, size_t itemlen, const RTPTime &receivetime, bool *cnamecollis) +int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data, std::size_t itemlen, const RTPTime &receivetime, bool *cnamecollis) { *cnamecollis = false; @@ -157,7 +157,7 @@ int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data, { case RTCP_SDES_ID_CNAME: { - size_t curlen; + std::size_t curlen; uint8_t *oldcname; // NOTE: we're going to make sure that the CNAME is only set once. @@ -182,7 +182,7 @@ int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data, break; case RTCP_SDES_ID_NAME: { - size_t oldlen; + std::size_t oldlen; SDESinf.GetName(&oldlen); if (oldlen == 0) // Name not set @@ -191,7 +191,7 @@ int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data, break; case RTCP_SDES_ID_EMAIL: { - size_t oldlen; + std::size_t oldlen; SDESinf.GetEMail(&oldlen); if (oldlen == 0) @@ -204,7 +204,7 @@ int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data, return SDESinf.SetLocation(data, itemlen); case RTCP_SDES_ID_TOOL: { - size_t oldlen; + std::size_t oldlen; SDESinf.GetTool(&oldlen); if (oldlen == 0) @@ -220,7 +220,7 @@ int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data, #ifdef RTP_SUPPORT_SDESPRIV -int RTPInternalSourceData::ProcessPrivateSDESItem(const uint8_t *prefix, size_t prefixlen, const uint8_t *value, size_t valuelen, const RTPTime &receivetime) +int RTPInternalSourceData::ProcessPrivateSDESItem(const uint8_t *prefix, std::size_t prefixlen, const uint8_t *value, std::size_t valuelen, const RTPTime &receivetime) { int status; @@ -233,7 +233,7 @@ int RTPInternalSourceData::ProcessPrivateSDESItem(const uint8_t *prefix, size_t #endif // RTP_SUPPORT_SDESPRIV -int RTPInternalSourceData::ProcessBYEPacket(const uint8_t *reason, size_t reasonlen, const RTPTime &receivetime) +int RTPInternalSourceData::ProcessBYEPacket(const uint8_t *reason, std::size_t reasonlen, const RTPTime &receivetime) { if (byereason) { diff --git a/qrtplib/rtpinternalsourcedata.h b/qrtplib/rtpinternalsourcedata.h index 9702d4fc7..120e903d6 100644 --- a/qrtplib/rtpinternalsourcedata.h +++ b/qrtplib/rtpinternalsourcedata.h @@ -70,11 +70,11 @@ public: { stats.SetLastMessageTime(receivetime); } - int ProcessSDESItem(uint8_t sdesid, const uint8_t *data, size_t itemlen, const RTPTime &receivetime, bool *cnamecollis); + int ProcessSDESItem(uint8_t sdesid, const uint8_t *data, std::size_t itemlen, const RTPTime &receivetime, bool *cnamecollis); #ifdef RTP_SUPPORT_SDESPRIV - int ProcessPrivateSDESItem(const uint8_t *prefix, size_t prefixlen, const uint8_t *value, size_t valuelen, const RTPTime &receivetime); + int ProcessPrivateSDESItem(const uint8_t *prefix, std::size_t prefixlen, const uint8_t *value, std::size_t valuelen, const RTPTime &receivetime); #endif // RTP_SUPPORT_SDESPRIV - int ProcessBYEPacket(const uint8_t *reason, size_t reasonlen, const RTPTime &receivetime); + int ProcessBYEPacket(const uint8_t *reason, std::size_t reasonlen, const RTPTime &receivetime); int SetRTPDataAddress(const RTPAddress *a); int SetRTCPDataAddress(const RTPAddress *a); diff --git a/qrtplib/rtppacket.cpp b/qrtplib/rtppacket.cpp index c6d39368a..08419ef8e 100644 --- a/qrtplib/rtppacket.cpp +++ b/qrtplib/rtppacket.cpp @@ -67,8 +67,8 @@ RTPPacket::RTPPacket(RTPRawPacket &rawpack) : error = ParseRawPacket(rawpack); } -RTPPacket::RTPPacket(uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, - const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, size_t maxpacksize) : +RTPPacket::RTPPacket(uint8_t payloadtype, const void *payloaddata, std::size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, + const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, std::size_t maxpacksize) : receivetime(0, 0) { Clear(); @@ -76,8 +76,8 @@ RTPPacket::RTPPacket(uint8_t payloadtype, const void *payloaddata, size_t payloa 0, maxpacksize); } -RTPPacket::RTPPacket(uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, - const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, size_t buffersize) : +RTPPacket::RTPPacket(uint8_t payloadtype, const void *payloaddata, std::size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, + const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, std::size_t buffersize) : receivetime(0, 0) { Clear(); @@ -93,7 +93,7 @@ RTPPacket::RTPPacket(uint8_t payloadtype, const void *payloaddata, size_t payloa int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack) { uint8_t *packetbytes; - size_t packetlen; + std::size_t packetlen; uint8_t payloadtype; RTPHeader *rtpheader; bool marker; @@ -209,8 +209,8 @@ uint32_t RTPPacket::GetCSRC(int num) const return csrcval_hbo; } -int RTPPacket::BuildPacket(uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, - const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, size_t maxsize) +int RTPPacket::BuildPacket(uint8_t payloadtype, const void *payloaddata, std::size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, + const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, std::size_t maxsize) { if (numcsrcs > RTP_MAXCSRCS) return ERR_RTP_PACKET_TOOMANYCSRCS; @@ -221,11 +221,11 @@ int RTPPacket::BuildPacket(uint8_t payloadtype, const void *payloaddata, size_t return ERR_RTP_PACKET_BADPAYLOADTYPE; packetlength = sizeof(RTPHeader); - packetlength += sizeof(uint32_t) * ((size_t) numcsrcs); + packetlength += sizeof(uint32_t) * ((std::size_t) numcsrcs); if (gotextension) { packetlength += sizeof(RTPExtensionHeader); - packetlength += sizeof(uint32_t) * ((size_t) extensionlen_numwords); + packetlength += sizeof(uint32_t) * ((std::size_t) extensionlen_numwords); } packetlength += payloadlen; @@ -264,7 +264,7 @@ int RTPPacket::BuildPacket(uint8_t payloadtype, const void *payloaddata, size_t RTPPacket::ssrc = ssrc; RTPPacket::payloadlength = payloadlen; RTPPacket::extid = extensionid; - RTPPacket::extensionlength = ((size_t) extensionlen_numwords) * sizeof(uint32_t); + RTPPacket::extensionlength = ((std::size_t) extensionlen_numwords) * sizeof(uint32_t); rtphdr = (RTPHeader *) packet; rtphdr->version = RTP_VERSION; @@ -290,7 +290,7 @@ int RTPPacket::BuildPacket(uint8_t payloadtype, const void *payloaddata, size_t for (i = 0; i < numcsrcs; i++, curcsrc++) *curcsrc = qToBigEndian(csrcs[i]); - payload = packet + sizeof(RTPHeader) + ((size_t) numcsrcs) * sizeof(uint32_t); + payload = packet + sizeof(RTPHeader) + ((std::size_t) numcsrcs) * sizeof(uint32_t); if (gotextension) { RTPExtensionHeader *rtpexthdr = (RTPExtensionHeader *) payload; diff --git a/qrtplib/rtppacket.h b/qrtplib/rtppacket.h index ccb93b704..8e8797d3f 100644 --- a/qrtplib/rtppacket.h +++ b/qrtplib/rtppacket.h @@ -68,13 +68,13 @@ public: * \c maxpacksize. The arguments of the constructor are self-explanatory. Note that the size of a header * extension is specified in a number of 32-bit words. A memory manager can be installed. */ - RTPPacket(uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, - const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, size_t maxpacksize); + RTPPacket(uint8_t payloadtype, const void *payloaddata, std::size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, + const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, std::size_t maxpacksize); /** This constructor is similar to the other constructor, but here data is stored in an external buffer * \c buffer with size \c buffersize. */ - RTPPacket(uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, - const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, size_t buffersize); + RTPPacket(uint8_t payloadtype, const void *payloaddata, std::size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, + const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, std::size_t buffersize); virtual ~RTPPacket() { @@ -163,13 +163,13 @@ public: } /** Returns the length of the entire packet. */ - size_t GetPacketLength() const + std::size_t GetPacketLength() const { return packetlength; } /** Returns the payload length. */ - size_t GetPayloadLength() const + std::size_t GetPayloadLength() const { return payloadlength; } @@ -187,7 +187,7 @@ public: } /** Returns the length of the header extension data. */ - size_t GetExtensionLength() const + std::size_t GetExtensionLength() const { return extensionlength; } @@ -204,8 +204,8 @@ public: private: void Clear(); int ParseRawPacket(RTPRawPacket &rawpack); - int BuildPacket(uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, - const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, size_t maxsize); + int BuildPacket(uint8_t payloadtype, const void *payloaddata, std::size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, + const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, std::size_t maxsize); RTPEndian m_endian; int error; @@ -216,11 +216,11 @@ private: uint8_t payloadtype; uint32_t extseqnr, timestamp, ssrc; uint8_t *packet, *payload; - size_t packetlength, payloadlength; + std::size_t packetlength, payloadlength; uint16_t extid; uint8_t *extension; - size_t extensionlength; + std::size_t extensionlength; bool externalbuffer; diff --git a/qrtplib/rtppacketbuilder.cpp b/qrtplib/rtppacketbuilder.cpp index 5df8c1e17..10f97e4f4 100644 --- a/qrtplib/rtppacketbuilder.cpp +++ b/qrtplib/rtppacketbuilder.cpp @@ -54,7 +54,7 @@ RTPPacketBuilder::~RTPPacketBuilder() Destroy(); } -int RTPPacketBuilder::Init(size_t max) +int RTPPacketBuilder::Init(std::size_t max) { if (init) return ERR_RTP_PACKBUILD_ALREADYINIT; @@ -87,7 +87,7 @@ void RTPPacketBuilder::Destroy() init = false; } -int RTPPacketBuilder::SetMaximumPacketSize(size_t max) +int RTPPacketBuilder::SetMaximumPacketSize(std::size_t max) { uint8_t *newbuf; @@ -186,7 +186,7 @@ uint32_t RTPPacketBuilder::CreateNewSSRC(RTPSources &sources) return ssrc; } -int RTPPacketBuilder::BuildPacket(const void *data, size_t len) +int RTPPacketBuilder::BuildPacket(const void *data, std::size_t len) { if (!init) return ERR_RTP_PACKBUILD_NOTINIT; @@ -199,14 +199,14 @@ int RTPPacketBuilder::BuildPacket(const void *data, size_t len) return PrivateBuildPacket(data, len, defaultpayloadtype, defaultmark, defaulttimestampinc, false); } -int RTPPacketBuilder::BuildPacket(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc) +int RTPPacketBuilder::BuildPacket(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc) { if (!init) return ERR_RTP_PACKBUILD_NOTINIT; return PrivateBuildPacket(data, len, pt, mark, timestampinc, false); } -int RTPPacketBuilder::BuildPacketEx(const void *data, size_t len, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords) +int RTPPacketBuilder::BuildPacketEx(const void *data, std::size_t len, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords) { if (!init) return ERR_RTP_PACKBUILD_NOTINIT; @@ -219,7 +219,7 @@ int RTPPacketBuilder::BuildPacketEx(const void *data, size_t len, uint16_t hdrex return PrivateBuildPacket(data, len, defaultpayloadtype, defaultmark, defaulttimestampinc, true, hdrextID, hdrextdata, numhdrextwords); } -int RTPPacketBuilder::BuildPacketEx(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords) +int RTPPacketBuilder::BuildPacketEx(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords) { if (!init) return ERR_RTP_PACKBUILD_NOTINIT; @@ -227,8 +227,8 @@ int RTPPacketBuilder::BuildPacketEx(const void *data, size_t len, uint8_t pt, bo } -int RTPPacketBuilder::PrivateBuildPacket(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc, bool gotextension, uint16_t hdrextID, const void *hdrextdata, - size_t numhdrextwords) +int RTPPacketBuilder::PrivateBuildPacket(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc, bool gotextension, uint16_t hdrextID, const void *hdrextdata, + std::size_t numhdrextwords) { RTPPacket p(pt, data, len, seqnr, timestamp, ssrc, mark, numcsrcs, csrcs, gotextension, hdrextID, (uint16_t) numhdrextwords, hdrextdata, buffer, maxpacksize); int status = p.GetCreationError(); diff --git a/qrtplib/rtppacketbuilder.h b/qrtplib/rtppacketbuilder.h index d7b489e0b..7bda2c4a9 100644 --- a/qrtplib/rtppacketbuilder.h +++ b/qrtplib/rtppacketbuilder.h @@ -63,7 +63,7 @@ public: ~RTPPacketBuilder(); /** Initializes the builder to only allow packets with a size below \c maxpacksize. */ - int Init(size_t maxpacksize); + int Init(std::size_t maxpacksize); /** Cleans up the builder. */ void Destroy(); @@ -85,7 +85,7 @@ public: } /** Sets the maximum allowed packet size to \c maxpacksize. */ - int SetMaximumPacketSize(size_t maxpacksize); + int SetMaximumPacketSize(std::size_t maxpacksize); /** Adds a CSRC to the CSRC list which will be stored in the RTP packets. */ int AddCSRC(uint32_t csrc); @@ -101,14 +101,14 @@ public: * and timestamp increment used will be those that have been set using the \c SetDefault * functions below. */ - int BuildPacket(const void *data, size_t len); + int BuildPacket(const void *data, std::size_t len); /** Builds a packet with payload \c data and payload length \c len. * Builds a packet with payload \c data and payload length \c len. The payload type will be * set to \c pt, the marker bit to \c mark and after building this packet, the timestamp will * be incremented with \c timestamp. */ - int BuildPacket(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc); + int BuildPacket(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc); /** Builds a packet with payload \c data and payload length \c len. * Builds a packet with payload \c data and payload length \c len. The payload type, marker @@ -117,7 +117,7 @@ public: * \c hdrextID and data \c hdrextdata. The length of the header extension data is given by * \c numhdrextwords which expresses the length in a number of 32-bit words. */ - int BuildPacketEx(const void *data, size_t len, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords); + int BuildPacketEx(const void *data, std::size_t len, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords); /** Builds a packet with payload \c data and payload length \c len. * Builds a packet with payload \c data and payload length \c len. The payload type will be set @@ -126,7 +126,7 @@ public: * with identifier \c hdrextID and data \c hdrextdata. The length of the header extension * data is given by \c numhdrextwords which expresses the length in a number of 32-bit words. */ - int BuildPacketEx(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords); + int BuildPacketEx(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords); /** Returns a pointer to the last built RTP packet data. */ uint8_t *GetPacket() @@ -137,7 +137,7 @@ public: } /** Returns the size of the last built RTP packet. */ - size_t GetPacketLength() + std::size_t GetPacketLength() { if (!init) return 0; @@ -235,13 +235,13 @@ public: ssrc = s; } private: - int PrivateBuildPacket(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc, bool gotextension, uint16_t hdrextID = 0, const void *hdrextdata = 0, - size_t numhdrextwords = 0); + int PrivateBuildPacket(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc, bool gotextension, uint16_t hdrextID = 0, const void *hdrextdata = 0, + std::size_t numhdrextwords = 0); RTPRandom &rtprnd; - size_t maxpacksize; + std::size_t maxpacksize; uint8_t *buffer; - size_t packetlength; + std::size_t packetlength; uint32_t numpayloadbytes; uint32_t numpackets; diff --git a/qrtplib/rtprawpacket.h b/qrtplib/rtprawpacket.h index 3db022298..05ab2ed7c 100644 --- a/qrtplib/rtprawpacket.h +++ b/qrtplib/rtprawpacket.h @@ -57,7 +57,7 @@ public: * The flag which indicates whether this data is RTP or RTCP data is set to \c rtp. A memory * manager can be installed as well. */ - RTPRawPacket(uint8_t *data, size_t datalen, RTPAddress *address, RTPTime &recvtime, bool rtp); + RTPRawPacket(uint8_t *data, std::size_t datalen, RTPAddress *address, RTPTime &recvtime, bool rtp); ~RTPRawPacket(); /** Returns the pointer to the data which is contained in this packet. */ @@ -67,7 +67,7 @@ public: } /** Returns the length of the packet described by this instance. */ - size_t GetDataLength() const + std::size_t GetDataLength() const { return packetdatalength; } @@ -110,7 +110,7 @@ public: /** Deallocates the previously stored data and replaces it with the data that's * specified, can be useful when e.g. decrypting data in RTPSession::OnChangeIncomingData */ - void SetData(uint8_t *data, size_t datalen); + void SetData(uint8_t *data, std::size_t datalen); /** Deallocates the currently stored RTPAddress instance and replaces it * with the one that's specified (you probably don't need this function). */ @@ -119,13 +119,13 @@ private: void DeleteData(); uint8_t *packetdata; - size_t packetdatalength; + std::size_t packetdatalength; RTPTime receivetime; RTPAddress *senderaddress; bool isrtp; }; -inline RTPRawPacket::RTPRawPacket(uint8_t *data, size_t datalen, RTPAddress *address, RTPTime &recvtime, bool rtp) : +inline RTPRawPacket::RTPRawPacket(uint8_t *data, std::size_t datalen, RTPAddress *address, RTPTime &recvtime, bool rtp) : receivetime(recvtime) { packetdata = data; @@ -155,7 +155,7 @@ inline uint8_t *RTPRawPacket::AllocateBytes(int recvlen) const return new uint8_t[recvlen]; } -inline void RTPRawPacket::SetData(uint8_t *data, size_t datalen) +inline void RTPRawPacket::SetData(uint8_t *data, std::size_t datalen) { if (packetdata) delete[] packetdata; diff --git a/qrtplib/rtpselect.h b/qrtplib/rtpselect.h index b525a87b0..679cef0cf 100644 --- a/qrtplib/rtpselect.h +++ b/qrtplib/rtpselect.h @@ -57,13 +57,13 @@ namespace qrtplib { -inline int RTPSelect(const SocketType *sockets, int8_t *readflags, size_t numsocks, RTPTime timeout) +inline int RTPSelect(const SocketType *sockets, int8_t *readflags, std::size_t numsocks, RTPTime timeout) { using namespace std; vector fds(numsocks); - for (size_t i = 0; i < numsocks; i++) + for (std::size_t i = 0; i < numsocks; i++) { fds[i].fd = sockets[i]; fds[i].events = POLLIN; @@ -98,7 +98,7 @@ inline int RTPSelect(const SocketType *sockets, int8_t *readflags, size_t numsoc if (status > 0) { - for (size_t i = 0; i < numsocks; i++) + for (std::size_t i = 0; i < numsocks; i++) { if (fds[i].revents) readflags[i] = 1; @@ -131,7 +131,7 @@ namespace qrtplib * indefinitely if set to a negative value. The function returns the number * of sockets that have data incoming. */ - inline int RTPSelect(const SocketType *sockets, int8_t *readflags, size_t numsocks, RTPTime timeout) + inline int RTPSelect(const SocketType *sockets, int8_t *readflags, std::size_t numsocks, RTPTime timeout) { struct timeval tv; struct timeval *pTv = 0; @@ -145,7 +145,7 @@ namespace qrtplib fd_set fdset; FD_ZERO(&fdset); - for (size_t i = 0; i < numsocks; i++) + for (std::size_t i = 0; i < numsocks; i++) { #ifndef RTP_SOCKETTYPE_WINSOCK const int setsize = FD_SETSIZE; @@ -174,7 +174,7 @@ namespace qrtplib if (status > 0) // some descriptors were set, check them { - for (size_t i = 0; i < numsocks; i++) + for (std::size_t i = 0; i < numsocks; i++) { if (FD_ISSET(sockets[i], &fdset)) readflags[i] = 1; diff --git a/qrtplib/rtpsession.cpp b/qrtplib/rtpsession.cpp index e0bc3d222..2d92c502a 100644 --- a/qrtplib/rtpsession.cpp +++ b/qrtplib/rtpsession.cpp @@ -220,7 +220,7 @@ int RTPSession::InternalCreate(const RTPSessionParams &sessparams) double timestampunit = sessparams.GetOwnTimestampUnit(); uint8_t buf[1024]; - size_t buflen = 1024; + std::size_t buflen = 1024; std::string forcedcname = sessparams.GetCNAME(); if (forcedcname.length() == 0) @@ -329,7 +329,7 @@ void RTPSession::Destroy() created = false; } -void RTPSession::BYEDestroy(const RTPTime &maxwaittime, const void *reason, size_t reasonlength) +void RTPSession::BYEDestroy(const RTPTime &maxwaittime, const void *reason, std::size_t reasonlength) { if (!created) return; @@ -474,7 +474,7 @@ void RTPSession::LeaveAllMulticastGroups() rtptrans->LeaveAllMulticastGroups(); } -int RTPSession::SendPacket(const void *data, size_t len) +int RTPSession::SendPacket(const void *data, std::size_t len) { int status; @@ -503,7 +503,7 @@ int RTPSession::SendPacket(const void *data, size_t len) return 0; } -int RTPSession::SendPacket(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc) +int RTPSession::SendPacket(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc) { int status; @@ -532,7 +532,7 @@ int RTPSession::SendPacket(const void *data, size_t len, uint8_t pt, bool mark, return 0; } -int RTPSession::SendPacketEx(const void *data, size_t len, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords) +int RTPSession::SendPacketEx(const void *data, std::size_t len, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords) { int status; @@ -561,7 +561,7 @@ int RTPSession::SendPacketEx(const void *data, size_t len, uint16_t hdrextID, co return 0; } -int RTPSession::SendPacketEx(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords) +int RTPSession::SendPacketEx(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords) { int status; @@ -592,7 +592,7 @@ int RTPSession::SendPacketEx(const void *data, size_t len, uint8_t pt, bool mark #ifdef RTP_SUPPORT_SENDAPP -int RTPSession::SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const void *appdata, size_t appdatalen) +int RTPSession::SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const void *appdata, std::size_t appdatalen) { int status; @@ -619,7 +619,7 @@ int RTPSession::SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const return status; BUILDER_LOCK - size_t owncnamelen = 0; + std::size_t owncnamelen = 0; uint8_t *owncname = rtcpbuilder.GetLocalCNAME(&owncnamelen); if ((status = pb.AddSDESNormalItem(RTCPSDESPacket::CNAME, owncname, owncnamelen)) < 0) @@ -650,7 +650,7 @@ int RTPSession::SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const #endif // RTP_SUPPORT_SENDAPP -int RTPSession::SendRawData(const void *data, size_t len, bool usertpchannel) +int RTPSession::SendRawData(const void *data, std::size_t len, bool usertpchannel) { if (!created) return ERR_RTP_SESSION_NOTCREATED; @@ -940,7 +940,7 @@ void RTPSession::ClearAcceptList() rtptrans->ClearAcceptList(); } -int RTPSession::SetMaximumPacketSize(size_t s) +int RTPSession::SetMaximumPacketSize(std::size_t s) { if (!created) return ERR_RTP_SESSION_NOTCREATED; @@ -1059,7 +1059,7 @@ rtcpbuilder.SetNoteInterval(count); BUILDER_UNLOCK } -int RTPSession::SetLocalName(const void *s, size_t len) +int RTPSession::SetLocalName(const void *s, std::size_t len) { if (!created) return ERR_RTP_SESSION_NOTCREATED; @@ -1071,7 +1071,7 @@ BUILDER_UNLOCK return status; } -int RTPSession::SetLocalEMail(const void *s, size_t len) +int RTPSession::SetLocalEMail(const void *s, std::size_t len) { if (!created) return ERR_RTP_SESSION_NOTCREATED; @@ -1083,7 +1083,7 @@ BUILDER_UNLOCK return status; } -int RTPSession::SetLocalLocation(const void *s, size_t len) +int RTPSession::SetLocalLocation(const void *s, std::size_t len) { if (!created) return ERR_RTP_SESSION_NOTCREATED; @@ -1095,7 +1095,7 @@ BUILDER_UNLOCK return status; } -int RTPSession::SetLocalPhone(const void *s, size_t len) +int RTPSession::SetLocalPhone(const void *s, std::size_t len) { if (!created) return ERR_RTP_SESSION_NOTCREATED; @@ -1107,7 +1107,7 @@ BUILDER_UNLOCK return status; } -int RTPSession::SetLocalTool(const void *s, size_t len) +int RTPSession::SetLocalTool(const void *s, std::size_t len) { if (!created) return ERR_RTP_SESSION_NOTCREATED; @@ -1119,7 +1119,7 @@ BUILDER_UNLOCK return status; } -int RTPSession::SetLocalNote(const void *s, size_t len) +int RTPSession::SetLocalNote(const void *s, std::size_t len) { if (!created) return ERR_RTP_SESSION_NOTCREATED; @@ -1321,7 +1321,7 @@ SOURCES_UNLOCK return 0; } -int RTPSession::CreateCNAME(uint8_t *buffer, size_t *bufferlength, bool resolve) +int RTPSession::CreateCNAME(uint8_t *buffer, std::size_t *bufferlength, bool resolve) { #ifndef WIN32 bool gotlogin = true; @@ -1370,12 +1370,12 @@ RTP_STRNCPY((char *)buffer,"unknown",*bufferlength); #endif // WIN32 buffer[*bufferlength - 1] = 0; -size_t offset = strlen((const char *) buffer); +std::size_t offset = strlen((const char *) buffer); if (offset < (*bufferlength - 1)) buffer[offset] = (uint8_t) '@'; offset++; -size_t buflen2 = *bufferlength - offset; +std::size_t buflen2 = *bufferlength - offset; int status; if (resolve) @@ -1418,13 +1418,13 @@ deletertprnd = false; return rnew; } -int RTPSession::SendRTPData(const void *data, size_t len) +int RTPSession::SendRTPData(const void *data, std::size_t len) { if (!m_changeOutgoingData) return rtptrans->SendRTPData(data, len); void *pSendData = 0; -size_t sendLen = 0; +std::size_t sendLen = 0; int status = 0; status = OnChangeRTPOrRTCPData(data, len, true, &pSendData, &sendLen); @@ -1440,13 +1440,13 @@ OnSentRTPOrRTCPData(pSendData, sendLen, true); return status; } -int RTPSession::SendRTCPData(const void *data, size_t len) +int RTPSession::SendRTCPData(const void *data, std::size_t len) { if (!m_changeOutgoingData) return rtptrans->SendRTCPData(data, len); void *pSendData = 0; -size_t sendLen = 0; +std::size_t sendLen = 0; int status = 0; status = OnChangeRTPOrRTCPData(data, len, false, &pSendData, &sendLen); diff --git a/qrtplib/rtpsession.h b/qrtplib/rtpsession.h index 555c3d82e..960c6aa5a 100644 --- a/qrtplib/rtpsession.h +++ b/qrtplib/rtpsession.h @@ -112,7 +112,7 @@ public: * send the BYE packet. If this time expires, the session will be left without sending a BYE packet. * The BYE packet will contain as reason for leaving \c reason with length \c reasonlength. */ - void BYEDestroy(const RTPTime &maxwaittime, const void *reason, size_t reasonlength); + void BYEDestroy(const RTPTime &maxwaittime, const void *reason, std::size_t reasonlength); /** Returns whether the session has been created or not. */ bool IsActive(); @@ -146,13 +146,13 @@ public: * The used payload type, marker and timestamp increment will be those that have been set * using the \c SetDefault member functions. */ - int SendPacket(const void *data, size_t len); + int SendPacket(const void *data, std::size_t len); /** Sends the RTP packet with payload \c data which has length \c len. * It will use payload type \c pt, marker \c mark and after the packet has been built, the * timestamp will be incremented by \c timestampinc. */ - int SendPacket(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc); + int SendPacket(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc); /** Sends the RTP packet with payload \c data which has length \c len. * The packet will contain a header extension with identifier \c hdrextID and containing data @@ -160,7 +160,7 @@ public: * number of 32-bit words. The used payload type, marker and timestamp increment will be those that * have been set using the \c SetDefault member functions. */ - int SendPacketEx(const void *data, size_t len, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords); + int SendPacketEx(const void *data, std::size_t len, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords); /** Sends the RTP packet with payload \c data which has length \c len. * It will use payload type \c pt, marker \c mark and after the packet has been built, the @@ -168,7 +168,7 @@ public: * extension with identifier \c hdrextID and containing data \c hdrextdata. The length * of this data is given by \c numhdrextwords and is specified in a number of 32-bit words. */ - int SendPacketEx(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords); + int SendPacketEx(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords); #ifdef RTP_SUPPORT_SENDAPP /** If sending of RTCP APP packets was enabled at compile time, this function creates a compound packet * containing an RTCP APP packet and sends it immediately. @@ -177,13 +177,13 @@ public: * of bytes in the RTCP compound packet. Note that this immediate sending is not compliant with the RTP * specification, so use with care. */ - int SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const void *appdata, size_t appdatalen); + int SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const void *appdata, std::size_t appdatalen); #endif // RTP_SUPPORT_SENDAPP /** With this function raw data can be sent directly over the RTP or * RTCP channel (if they are different); the data is **not** passed through the * RTPSession::OnChangeRTPOrRTCPData function. */ - int SendRawData(const void *data, size_t len, bool usertpchannel); + int SendRawData(const void *data, std::size_t len, bool usertpchannel); /** Sets the default payload type for RTP packets to \c pt. */ int SetDefaultPayloadType(uint8_t pt); @@ -353,7 +353,7 @@ public: void ClearAcceptList(); /** Sets the maximum allowed packet size to \c s. */ - int SetMaximumPacketSize(size_t s); + int SetMaximumPacketSize(std::size_t s); /** Sets the session bandwidth to \c bw, which is specified in bytes per second. */ int SetSessionBandwidth(double bw); @@ -415,22 +415,22 @@ public: void SetNoteInterval(int count); /** Sets the SDES name item for the local participant to the value \c s with length \c len. */ - int SetLocalName(const void *s, size_t len); + int SetLocalName(const void *s, std::size_t len); /** Sets the SDES e-mail item for the local participant to the value \c s with length \c len. */ - int SetLocalEMail(const void *s, size_t len); + int SetLocalEMail(const void *s, std::size_t len); /** Sets the SDES location item for the local participant to the value \c s with length \c len. */ - int SetLocalLocation(const void *s, size_t len); + int SetLocalLocation(const void *s, std::size_t len); /** Sets the SDES phone item for the local participant to the value \c s with length \c len. */ - int SetLocalPhone(const void *s, size_t len); + int SetLocalPhone(const void *s, std::size_t len); /** Sets the SDES tool item for the local participant to the value \c s with length \c len. */ - int SetLocalTool(const void *s, size_t len); + int SetLocalTool(const void *s, std::size_t len); /** Sets the SDES note item for the local participant to the value \c s with length \c len. */ - int SetLocalNote(const void *s, size_t len); + int SetLocalNote(const void *s, std::size_t len); protected: /** Allocate a user defined transmitter. @@ -461,7 +461,7 @@ protected: virtual void OnSSRCCollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp); /** Is called when another CNAME was received than the one already present for source \c srcdat. */ - virtual void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, size_t cnamelength); + virtual void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, std::size_t cnamelength); /** Is called when a new entry \c srcdat is added to the source table. */ virtual void OnNewSource(RTPSourceData *srcdat); @@ -496,10 +496,10 @@ protected: virtual void OnRTCPReceiverReport(RTPSourceData *srcdat); /** Is called when a specific SDES item was received for this source. */ - virtual void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, size_t itemlength); + virtual void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, std::size_t itemlength); #ifdef RTP_SUPPORT_SDESPRIV /** Is called when a specific SDES item of 'private' type was received for this source. */ - virtual void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, size_t prefixlen, const void *valuedata, size_t valuelen); + virtual void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, std::size_t prefixlen, const void *valuedata, std::size_t valuelen); #endif // RTP_SUPPORT_SDESPRIV /** Is called when a BYE packet has been processed for source \c srcdat. */ @@ -531,12 +531,12 @@ protected: * yourself, a good way may be to do this in RTPSession::OnSentRTPOrRTCPData. If `senddata` is * set to 0, no packet will be sent out. This also provides a way to turn off sending RTCP * packets if desired. */ - virtual int OnChangeRTPOrRTCPData(const void *origdata, size_t origlen, bool isrtp, void **senddata, size_t *sendlen); + virtual int OnChangeRTPOrRTCPData(const void *origdata, std::size_t origlen, bool isrtp, void **senddata, std::size_t *sendlen); /** This function is called when an RTP or RTCP packet was sent, it can be helpful * when data was allocated in RTPSession::OnChangeRTPOrRTCPData to deallocate it * here. */ - virtual void OnSentRTPOrRTCPData(void *senddata, size_t sendlen, bool isrtp); + virtual void OnSentRTPOrRTCPData(void *senddata, std::size_t sendlen, bool isrtp); /** By overriding this function, the raw incoming data can be inspected * and modified (e.g. for encryption). @@ -559,12 +559,12 @@ protected: virtual void OnValidatedRTPPacket(RTPSourceData *srcdat, RTPPacket *rtppack, bool isonprobation, bool *ispackethandled); private: int InternalCreate(const RTPSessionParams &sessparams); - int CreateCNAME(uint8_t *buffer, size_t *bufferlength, bool resolve); + int CreateCNAME(uint8_t *buffer, std::size_t *bufferlength, bool resolve); int ProcessPolledData(); int ProcessRTCPCompoundPacket(RTCPCompoundPacket &rtcpcomppack, RTPRawPacket *pack); RTPRandom *GetRandomNumberGenerator(RTPRandom *r); - int SendRTPData(const void *data, size_t len); - int SendRTCPData(const void *data, size_t len); + int SendRTPData(const void *data, std::size_t len); + int SendRTCPData(const void *data, std::size_t len); RTPRandom *rtprnd; bool deletertprnd; @@ -575,7 +575,7 @@ private: bool usingpollthread, needthreadsafety; bool acceptownpackets; bool useSR_BYEifpossible; - size_t maxpacksize; + std::size_t maxpacksize; double sessionbandwidth; double controlfragment; double sendermultiplier; @@ -612,7 +612,7 @@ inline void RTPSession::OnRTCPCompoundPacket(RTCPCompoundPacket *, const RTPTime inline void RTPSession::OnSSRCCollision(RTPSourceData *, const RTPAddress *, bool) { } -inline void RTPSession::OnCNAMECollision(RTPSourceData *, const RTPAddress *, const uint8_t *, size_t) +inline void RTPSession::OnCNAMECollision(RTPSourceData *, const RTPAddress *, const uint8_t *, std::size_t) { } inline void RTPSession::OnNewSource(RTPSourceData *) @@ -645,12 +645,12 @@ inline void RTPSession::OnRTCPSenderReport(RTPSourceData *) inline void RTPSession::OnRTCPReceiverReport(RTPSourceData *) { } -inline void RTPSession::OnRTCPSDESItem(RTPSourceData *, RTCPSDESPacket::ItemType, const void *, size_t) +inline void RTPSession::OnRTCPSDESItem(RTPSourceData *, RTCPSDESPacket::ItemType, const void *, std::size_t) { } #ifdef RTP_SUPPORT_SDESPRIV -inline void RTPSession::OnRTCPSDESPrivateItem(RTPSourceData *, const void *, size_t, const void *, size_t) +inline void RTPSession::OnRTCPSDESPrivateItem(RTPSourceData *, const void *, std::size_t, const void *, std::size_t) { } #endif // RTP_SUPPORT_SDESPRIV @@ -662,11 +662,11 @@ inline void RTPSession::OnSendRTCPCompoundPacket(RTCPCompoundPacket *) { } -inline int RTPSession::OnChangeRTPOrRTCPData(const void *, size_t, bool, void **, size_t *) +inline int RTPSession::OnChangeRTPOrRTCPData(const void *, std::size_t, bool, void **, std::size_t *) { return ERR_RTP_RTPSESSION_CHANGEREQUESTEDBUTNOTIMPLEMENTED; } -inline void RTPSession::OnSentRTPOrRTCPData(void *, size_t, bool) +inline void RTPSession::OnSentRTPOrRTCPData(void *, std::size_t, bool) { } inline bool RTPSession::OnChangeIncomingData(RTPRawPacket *) diff --git a/qrtplib/rtpsessionparams.h b/qrtplib/rtpsessionparams.h index e4208dc96..b75517c42 100644 --- a/qrtplib/rtpsessionparams.h +++ b/qrtplib/rtpsessionparams.h @@ -72,13 +72,13 @@ public: } /** Sets the maximum allowed packet size for the session. */ - void SetMaximumPacketSize(size_t max) + void SetMaximumPacketSize(std::size_t max) { maxpacksize = max; } /** Returns the maximum allowed packet size (default is 1400 bytes). */ - size_t GetMaximumPacketSize() const + std::size_t GetMaximumPacketSize() const { return maxpacksize; } @@ -340,7 +340,7 @@ public: private: bool acceptown; bool usepollthread; - size_t maxpacksize; + std::size_t maxpacksize; double owntsunit; RTPTransmitter::ReceiveMode receivemode; bool resolvehostname; diff --git a/qrtplib/rtpsessionsources.cpp b/qrtplib/rtpsessionsources.cpp index c1525fada..045fa1cee 100644 --- a/qrtplib/rtpsessionsources.cpp +++ b/qrtplib/rtpsessionsources.cpp @@ -56,7 +56,7 @@ void RTPSessionSources::OnSSRCCollision(RTPSourceData *srcdat, const RTPAddress rtpsession.OnSSRCCollision(srcdat, senderaddress, isrtp); } -void RTPSessionSources::OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, size_t cnamelength) +void RTPSessionSources::OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, std::size_t cnamelength) { rtpsession.OnCNAMECollision(srcdat, senderaddress, cname, cnamelength); } @@ -123,13 +123,13 @@ void RTPSessionSources::OnRTCPReceiverReport(RTPSourceData *srcdat) rtpsession.OnRTCPReceiverReport(srcdat); } -void RTPSessionSources::OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, size_t itemlength) +void RTPSessionSources::OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, std::size_t itemlength) { rtpsession.OnRTCPSDESItem(srcdat, t, itemdata, itemlength); } #ifdef RTP_SUPPORT_SDESPRIV -void RTPSessionSources::OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, size_t prefixlen, const void *valuedata, size_t valuelen) +void RTPSessionSources::OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, std::size_t prefixlen, const void *valuedata, std::size_t valuelen) { rtpsession.OnRTCPSDESPrivateItem(srcdat, prefixdata, prefixlen, valuedata, valuelen); } diff --git a/qrtplib/rtpsessionsources.h b/qrtplib/rtpsessionsources.h index 2163e4486..1649c0a90 100644 --- a/qrtplib/rtpsessionsources.h +++ b/qrtplib/rtpsessionsources.h @@ -69,7 +69,7 @@ private: void OnRTPPacket(RTPPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress); void OnRTCPCompoundPacket(RTCPCompoundPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress); void OnSSRCCollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp); - void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, size_t cnamelength); + void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, std::size_t cnamelength); void OnNewSource(RTPSourceData *srcdat); void OnRemoveSource(RTPSourceData *srcdat); void OnTimeout(RTPSourceData *srcdat); @@ -82,9 +82,9 @@ private: void OnValidatedRTPPacket(RTPSourceData *srcdat, RTPPacket *rtppack, bool isonprobation, bool *ispackethandled); void OnRTCPSenderReport(RTPSourceData *srcdat); void OnRTCPReceiverReport(RTPSourceData *srcdat); - void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, size_t itemlength); + void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, std::size_t itemlength); #ifdef RTP_SUPPORT_SDESPRIV - void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, size_t prefixlen, const void *valuedata, size_t valuelen); + void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, std::size_t prefixlen, const void *valuedata, std::size_t valuelen); #endif // RTP_SUPPORT_SDESPRIV RTPSession &rtpsession; diff --git a/qrtplib/rtpsourcedata.h b/qrtplib/rtpsourcedata.h index b87efc095..a2d83cf13 100644 --- a/qrtplib/rtpsourcedata.h +++ b/qrtplib/rtpsourcedata.h @@ -405,7 +405,7 @@ public: * Returns the reason for leaving contained in the BYE packet of this participant. The length of * the reason is stored in \c len. */ - uint8_t *GetBYEReason(size_t *len) const + uint8_t *GetBYEReason(std::size_t *len) const { *len = byereasonlen; return byereason; @@ -679,43 +679,43 @@ public: } /** Returns a pointer to the SDES CNAME item of this participant and stores its length in \c len. */ - uint8_t *SDES_GetCNAME(size_t *len) const + uint8_t *SDES_GetCNAME(std::size_t *len) const { return SDESinf.GetCNAME(len); } /** Returns a pointer to the SDES name item of this participant and stores its length in \c len. */ - uint8_t *SDES_GetName(size_t *len) const + uint8_t *SDES_GetName(std::size_t *len) const { return SDESinf.GetName(len); } /** Returns a pointer to the SDES e-mail item of this participant and stores its length in \c len. */ - uint8_t *SDES_GetEMail(size_t *len) const + uint8_t *SDES_GetEMail(std::size_t *len) const { return SDESinf.GetEMail(len); } /** Returns a pointer to the SDES phone item of this participant and stores its length in \c len. */ - uint8_t *SDES_GetPhone(size_t *len) const + uint8_t *SDES_GetPhone(std::size_t *len) const { return SDESinf.GetPhone(len); } /** Returns a pointer to the SDES location item of this participant and stores its length in \c len. */ - uint8_t *SDES_GetLocation(size_t *len) const + uint8_t *SDES_GetLocation(std::size_t *len) const { return SDESinf.GetLocation(len); } /** Returns a pointer to the SDES tool item of this participant and stores its length in \c len. */ - uint8_t *SDES_GetTool(size_t *len) const + uint8_t *SDES_GetTool(std::size_t *len) const { return SDESinf.GetTool(len); } /** Returns a pointer to the SDES note item of this participant and stores its length in \c len. */ - uint8_t *SDES_GetNote(size_t *len) const + uint8_t *SDES_GetNote(std::size_t *len) const { return SDESinf.GetNote(len); } @@ -730,7 +730,7 @@ public: /** If available, returns \c true and stores the next SDES private item prefix in \c prefix and its length in * \c prefixlen; the associated value and its length are then stored in \c value and \c valuelen. */ - bool SDES_GetNextPrivateValue(uint8_t **prefix, size_t *prefixlen, uint8_t **value, size_t *valuelen) + bool SDES_GetNextPrivateValue(uint8_t **prefix, std::size_t *prefixlen, uint8_t **value, std::size_t *valuelen) { return SDESinf.GetNextPrivateValue(prefix, prefixlen, value, valuelen); } @@ -739,7 +739,7 @@ public: * \c prefixlen; if found, the function returns \c true and stores the associated value and * its length in \c value and \c valuelen respectively. */ - bool SDES_GetPrivateValue(uint8_t *prefix, size_t prefixlen, uint8_t **value, size_t *valuelen) const + bool SDES_GetPrivateValue(uint8_t *prefix, std::size_t prefixlen, uint8_t **value, std::size_t *valuelen) const { return SDESinf.GetPrivateValue(prefix, prefixlen, value, valuelen); } @@ -767,7 +767,7 @@ protected: RTPTime byetime; uint8_t *byereason; - size_t byereasonlen; + std::size_t byereasonlen; }; inline RTPPacket *RTPSourceData::GetNextPacket() diff --git a/qrtplib/rtpsources.cpp b/qrtplib/rtpsources.cpp index f44e96a9c..f72c19b3a 100644 --- a/qrtplib/rtpsources.cpp +++ b/qrtplib/rtpsources.cpp @@ -686,7 +686,7 @@ int RTPSources::ProcessRTCPReportBlock(uint32_t ssrc, uint8_t fractionlost, int3 return 0; } -int RTPSources::ProcessSDESNormalItem(uint32_t ssrc, RTCPSDESPacket::ItemType t, size_t itemlength, const void *itemdata, const RTPTime &receivetime, +int RTPSources::ProcessSDESNormalItem(uint32_t ssrc, RTCPSDESPacket::ItemType t, std::size_t itemlength, const void *itemdata, const RTPTime &receivetime, const RTPAddress *senderaddress) { RTPInternalSourceData *srcdat; @@ -746,7 +746,7 @@ int RTPSources::ProcessSDESNormalItem(uint32_t ssrc, RTCPSDESPacket::ItemType t, } #ifdef RTP_SUPPORT_SDESPRIV -int RTPSources::ProcessSDESPrivateItem(uint32_t ssrc, size_t prefixlen, const void *prefixdata, size_t valuelen, const void *valuedata, const RTPTime &receivetime, +int RTPSources::ProcessSDESPrivateItem(uint32_t ssrc, std::size_t prefixlen, const void *prefixdata, std::size_t valuelen, const void *valuedata, const RTPTime &receivetime, const RTPAddress *senderaddress) { RTPInternalSourceData *srcdat; @@ -771,7 +771,7 @@ int RTPSources::ProcessSDESPrivateItem(uint32_t ssrc, size_t prefixlen, const vo } #endif //RTP_SUPPORT_SDESPRIV -int RTPSources::ProcessBYE(uint32_t ssrc, size_t reasonlength, const void *reasondata, const RTPTime &receivetime, const RTPAddress *senderaddress) +int RTPSources::ProcessBYE(uint32_t ssrc, std::size_t reasonlength, const void *reasondata, const RTPTime &receivetime, const RTPAddress *senderaddress) { RTPInternalSourceData *srcdat; bool created; @@ -1027,7 +1027,7 @@ void RTPSources::NoteTimeout(const RTPTime &curtime, const RTPTime &timeoutdelay while (sourcelist.HasCurrentElement()) { RTPInternalSourceData *srcdat = sourcelist.GetCurrentElement(); - size_t notelen; + std::size_t notelen; srcdat->SDES_GetNote(¬elen); if (notelen != 0) // Note has been set @@ -1076,7 +1076,7 @@ void RTPSources::MultipleTimeouts(const RTPTime &curtime, const RTPTime &sendert bool deleted, issender, isactive; bool byetimeout, normaltimeout, notetimeout; - size_t notelen; + std::size_t notelen; issender = srcdat->IsSender(); isactive = srcdat->IsActive(); diff --git a/qrtplib/rtpsources.h b/qrtplib/rtpsources.h index e169277b9..f549e71af 100644 --- a/qrtplib/rtpsources.h +++ b/qrtplib/rtpsources.h @@ -153,14 +153,14 @@ public: * received at time \c receivetime from address \c senderaddress. The \c senderaddress parameter must * be NULL if the packet was sent by the local participant. */ - int ProcessSDESNormalItem(uint32_t ssrc, RTCPSDESPacket::ItemType t, size_t itemlength, const void *itemdata, const RTPTime &receivetime, const RTPAddress *senderaddress); + int ProcessSDESNormalItem(uint32_t ssrc, RTCPSDESPacket::ItemType t, std::size_t itemlength, const void *itemdata, const RTPTime &receivetime, const RTPAddress *senderaddress); #ifdef RTP_SUPPORT_SDESPRIV /** Processes the SDES private item from source \c ssrc into the source table. * Processes the SDES private item from source \c ssrc into the source table. The information was * received at time \c receivetime from address \c senderaddress. The \c senderaddress * parameter must be NULL if the packet was sent by the local participant. */ - int ProcessSDESPrivateItem(uint32_t ssrc, size_t prefixlen, const void *prefixdata, size_t valuelen, const void *valuedata, const RTPTime &receivetime, + int ProcessSDESPrivateItem(uint32_t ssrc, std::size_t prefixlen, const void *prefixdata, std::size_t valuelen, const void *valuedata, const RTPTime &receivetime, const RTPAddress *senderaddress); #endif //RTP_SUPPORT_SDESPRIV /** Processes the BYE message for SSRC \c ssrc. @@ -168,7 +168,7 @@ public: * address \c senderaddress. The \c senderaddress parameter must be NULL if the packet was sent by the * local participant. */ - int ProcessBYE(uint32_t ssrc, size_t reasonlength, const void *reasondata, const RTPTime &receivetime, const RTPAddress *senderaddress); + int ProcessBYE(uint32_t ssrc, std::size_t reasonlength, const void *reasondata, const RTPTime &receivetime, const RTPAddress *senderaddress); /** If we heard from source \c ssrc, but no actual data was added to the source table (for example, if * no report block was meant for us), this function can e used to indicate that something was received from @@ -302,7 +302,7 @@ protected: virtual void OnSSRCCollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp); /** Is called when another CNAME was received than the one already present for source \c srcdat. */ - virtual void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, size_t cnamelength); + virtual void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, std::size_t cnamelength); /** Is called when a new entry \c srcdat is added to the source table. */ virtual void OnNewSource(RTPSourceData *srcdat); @@ -326,10 +326,10 @@ protected: virtual void OnRTCPReceiverReport(RTPSourceData *srcdat); /** Is called when a specific SDES item was received for this source. */ - virtual void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, size_t itemlength); + virtual void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, std::size_t itemlength); #ifdef RTP_SUPPORT_SDESPRIV /** Is called when a specific SDES item of 'private' type was received for this source. */ - virtual void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, size_t prefixlen, const void *valuedata, size_t valuelen); + virtual void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, std::size_t prefixlen, const void *valuedata, std::size_t valuelen); #endif // RTP_SUPPORT_SDESPRIV /** Is called when an RTCP APP packet \c apppacket has been received at time \c receivetime @@ -378,7 +378,7 @@ inline void RTPSources::OnRTCPCompoundPacket(RTCPCompoundPacket *, const RTPTime inline void RTPSources::OnSSRCCollision(RTPSourceData *, const RTPAddress *, bool) { } -inline void RTPSources::OnCNAMECollision(RTPSourceData *, const RTPAddress *, const uint8_t *, size_t) +inline void RTPSources::OnCNAMECollision(RTPSourceData *, const RTPAddress *, const uint8_t *, std::size_t) { } inline void RTPSources::OnNewSource(RTPSourceData *) @@ -402,11 +402,11 @@ inline void RTPSources::OnRTCPSenderReport(RTPSourceData *) inline void RTPSources::OnRTCPReceiverReport(RTPSourceData *) { } -inline void RTPSources::OnRTCPSDESItem(RTPSourceData *, RTCPSDESPacket::ItemType, const void *, size_t) +inline void RTPSources::OnRTCPSDESItem(RTPSourceData *, RTCPSDESPacket::ItemType, const void *, std::size_t) { } #ifdef RTP_SUPPORT_SDESPRIV -inline void RTPSources::OnRTCPSDESPrivateItem(RTPSourceData *, const void *, size_t, const void *, size_t) +inline void RTPSources::OnRTCPSDESPrivateItem(RTPSourceData *, const void *, std::size_t, const void *, std::size_t) { } #endif // RTP_SUPPORT_SDESPRIV diff --git a/qrtplib/rtptcptransmitter.cpp b/qrtplib/rtptcptransmitter.cpp index ce8ce0dde..411c6f56a 100644 --- a/qrtplib/rtptcptransmitter.cpp +++ b/qrtplib/rtptcptransmitter.cpp @@ -76,7 +76,7 @@ int RTPTCPTransmitter::Init(bool tsafe) return 0; } -int RTPTCPTransmitter::Create(size_t maximumpacketsize __attribute__((unused)), const RTPTransmissionParams *transparams) +int RTPTCPTransmitter::Create(std::size_t maximumpacketsize __attribute__((unused)), const RTPTransmissionParams *transparams) { const RTPTCPTransmissionParams *params, defaultparams; int status; @@ -167,7 +167,7 @@ void RTPTCPTransmitter::DeleteTransmissionInfo(RTPTransmissionInfo *i) delete i; } -int RTPTCPTransmitter::GetLocalHostName(uint8_t *buffer, size_t *bufferlength) +int RTPTCPTransmitter::GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength) { if (!m_init) return ERR_RTP_TCPTRANS_NOTINIT; @@ -259,7 +259,7 @@ int RTPTCPTransmitter::Poll() ++it; } - for (size_t i = 0; i < errSockets.size(); i++) + for (std::size_t i = 0; i < errSockets.size(); i++) OnReceiveError(errSockets[i]); return status; @@ -324,7 +324,7 @@ int RTPTCPTransmitter::WaitForIncomingData(const RTPTime &delay, bool *dataavail { bool avail = false; - for (size_t i = 0; i < m_tmpFlags.size(); i++) + for (std::size_t i = 0; i < m_tmpFlags.size(); i++) { if (m_tmpFlags[i]) { @@ -362,12 +362,12 @@ int RTPTCPTransmitter::AbortWait() return 0; } -int RTPTCPTransmitter::SendRTPData(const void *data, size_t len) +int RTPTCPTransmitter::SendRTPData(const void *data, std::size_t len) { return SendRTPRTCPData(data, len); } -int RTPTCPTransmitter::SendRTCPData(const void *data, size_t len) +int RTPTCPTransmitter::SendRTCPData(const void *data, std::size_t len) { return SendRTPRTCPData(data, len); } @@ -523,7 +523,7 @@ void RTPTCPTransmitter::ClearAcceptList() { } -int RTPTCPTransmitter::SetMaximumPacketSize(size_t s) +int RTPTCPTransmitter::SetMaximumPacketSize(std::size_t s) { if (!m_init) return ERR_RTP_TCPTRANS_NOTINIT; @@ -603,7 +603,7 @@ int RTPTCPTransmitter::PollSocket(SocketType sock, SocketData &sdata) #ifdef RTP_SOCKETTYPE_WINSOCK unsigned long len; #else - size_t len; + std::size_t len; #endif // RTP_SOCKETTYPE_WINSOCK bool dataavailable; @@ -668,7 +668,7 @@ int RTPTCPTransmitter::PollSocket(SocketType sock, SocketData &sdata) return 0; } -int RTPTCPTransmitter::SendRTPRTCPData(const void *data, size_t len) +int RTPTCPTransmitter::SendRTPRTCPData(const void *data, std::size_t len) { if (!m_init) return ERR_RTP_TCPTRANS_NOTINIT; @@ -706,7 +706,7 @@ int RTPTCPTransmitter::SendRTPRTCPData(const void *data, size_t len) if (errSockets.size() != 0) { - for (size_t i = 0; i < errSockets.size(); i++) + for (std::size_t i = 0; i < errSockets.size(); i++) OnSendError(errSockets[i]); } diff --git a/qrtplib/rtptcptransmitter.h b/qrtplib/rtptcptransmitter.h index fa8515360..205e3c019 100644 --- a/qrtplib/rtptcptransmitter.h +++ b/qrtplib/rtptcptransmitter.h @@ -124,14 +124,14 @@ public: ~RTPTCPTransmitter(); int Init(bool treadsafe); - int Create(size_t maxpacksize, const RTPTransmissionParams *transparams); + int Create(std::size_t maxpacksize, const RTPTransmissionParams *transparams); void Destroy(); RTPTransmissionInfo *GetTransmissionInfo(); void DeleteTransmissionInfo(RTPTransmissionInfo *inf); - int GetLocalHostName(uint8_t *buffer, size_t *bufferlength); + int GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength); bool ComesFromThisTransmitter(const RTPAddress *addr); - size_t GetHeaderOverhead() + std::size_t GetHeaderOverhead() { return RTPTCPTRANS_HEADERSIZE; } @@ -140,8 +140,8 @@ public: int WaitForIncomingData(const RTPTime &delay, bool *dataavailable = 0); int AbortWait(); - int SendRTPData(const void *data, size_t len); - int SendRTCPData(const void *data, size_t len); + int SendRTPData(const void *data, std::size_t len); + int SendRTCPData(const void *data, std::size_t len); int AddDestination(const RTPAddress &addr); int DeleteDestination(const RTPAddress &addr); @@ -159,7 +159,7 @@ public: int AddToAcceptList(const RTPAddress &addr); int DeleteFromAcceptList(const RTPAddress &addr); void ClearAcceptList(); - int SetMaximumPacketSize(size_t s); + int SetMaximumPacketSize(std::size_t s); bool NewDataAvailable(); RTPRawPacket *GetNextPacket(); @@ -191,7 +191,7 @@ private: int ProcessAvailableBytes(SocketType sock, int availLen, bool &complete); }; - int SendRTPRTCPData(const void *data, size_t len); + int SendRTPRTCPData(const void *data, std::size_t len); void FlushPackets(); int PollSocket(SocketType sock, SocketData &sdata); void ClearDestSockets(); @@ -205,7 +205,7 @@ private: std::vector m_tmpSocks; std::vector m_tmpFlags; std::vector m_localHostname; - size_t m_maxPackSize; + std::size_t m_maxPackSize; std::list m_rawpacketlist; diff --git a/qrtplib/rtptransmitter.h b/qrtplib/rtptransmitter.h index 8cfad498d..a337fb30f 100644 --- a/qrtplib/rtptransmitter.h +++ b/qrtplib/rtptransmitter.h @@ -41,6 +41,7 @@ #include "rtpconfig.h" #include "rtptypes.h" #include "rtptimeutilities.h" +#include namespace qrtplib { @@ -107,7 +108,7 @@ public: * from RTPTransmissionParams. If \c transparams is NULL, the default transmission parameters * for the component will be used. */ - virtual int Create(size_t maxpacksize, const RTPTransmissionParams *transparams) = 0; + virtual int Create(std::size_t maxpacksize, const RTPTransmissionParams *transparams) = 0; /** By calling this function, buffers are cleared and the component cannot be used anymore. * By calling this function, buffers are cleared and the component cannot be used anymore. @@ -137,14 +138,14 @@ public: * it returns \c ERR_RTP_TRANS_BUFFERLENGTHTOOSMALL and stores the number of bytes needed in * \c bufferlength. */ - virtual int GetLocalHostName(uint8_t *buffer, size_t *bufferlength) = 0; + virtual int GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength) = 0; /** Returns \c true if the address specified by \c addr is one of the addresses of the transmitter. */ virtual bool ComesFromThisTransmitter(const RTPAddress *addr) = 0; /** Returns the amount of bytes that will be added to the RTP packet by the underlying layers (excluding * the link layer). */ - virtual size_t GetHeaderOverhead() = 0; + virtual std::size_t GetHeaderOverhead() = 0; /** Checks for incoming data and stores it. */ virtual int Poll() = 0; @@ -159,10 +160,10 @@ public: virtual int AbortWait() = 0; /** Send a packet with length \c len containing \c data to all RTP addresses of the current destination list. */ - virtual int SendRTPData(const void *data, size_t len) = 0; + virtual int SendRTPData(const void *data, std::size_t len) = 0; /** Send a packet with length \c len containing \c data to all RTCP addresses of the current destination list. */ - virtual int SendRTCPData(const void *data, size_t len) = 0; + virtual int SendRTCPData(const void *data, std::size_t len) = 0; /** Adds the address specified by \c addr to the list of destinations. */ virtual int AddDestination(const RTPAddress &addr) = 0; @@ -211,7 +212,7 @@ public: virtual void ClearAcceptList() = 0; /** Sets the maximum packet size which the transmitter should allow to \c s. */ - virtual int SetMaximumPacketSize(size_t s) = 0; + virtual int SetMaximumPacketSize(std::size_t s) = 0; /** Returns \c true if packets can be obtained using the GetNextPacket member function. */ virtual bool NewDataAvailable() = 0; diff --git a/qrtplib/rtpudpv4transmitter.cpp b/qrtplib/rtpudpv4transmitter.cpp index 47cc89aac..12f165281 100644 --- a/qrtplib/rtpudpv4transmitter.cpp +++ b/qrtplib/rtpudpv4transmitter.cpp @@ -137,7 +137,7 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc SocketType sock = socket(PF_INET, SOCK_DGRAM, 0); if (sock == RTPSOCKERR) { - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return ERR_RTP_UDPV4TRANS_CANTCREATESOCKET; } @@ -153,7 +153,7 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc if (bind(sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) != 0) { RTPCLOSE(sock); - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return ERR_RTP_UDPV4TRANS_CANTGETVALIDSOCKET; } @@ -163,7 +163,7 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc if (status < 0) { RTPCLOSE(sock); - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return status; } @@ -176,7 +176,7 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc *pRtcpSock = sock; *pRtpPort = basePort; *pRtcpPort = basePort; - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return 0; @@ -190,7 +190,7 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc if (sock2 == RTPSOCKERR) { RTPCLOSE(sock); - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return ERR_RTP_UDPV4TRANS_CANTCREATESOCKET; } @@ -237,7 +237,7 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc *pRtcpPort = basePort; } - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return 0; @@ -249,13 +249,13 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc } } - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return ERR_RTP_UDPV4TRANS_TOOMANYATTEMPTSCHOOSINGSOCKET; } -int RTPUDPv4Transmitter::Create(size_t maximumpacketsize, const RTPTransmissionParams *transparams) +int RTPUDPv4Transmitter::Create(std::size_t maximumpacketsize, const RTPTransmissionParams *transparams) { const RTPUDPv4TransmissionParams *params, defaultparams; struct sockaddr_in addr; @@ -555,7 +555,7 @@ void RTPUDPv4Transmitter::DeleteTransmissionInfo(RTPTransmissionInfo *i) delete i; } -int RTPUDPv4Transmitter::GetLocalHostName(uint8_t *buffer, size_t *bufferlength) +int RTPUDPv4Transmitter::GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength) { if (!init) return ERR_RTP_UDPV4TRANS_NOTINIT; @@ -831,7 +831,7 @@ int RTPUDPv4Transmitter::AbortWait() return 0; } -int RTPUDPv4Transmitter::SendRTPData(const void *data, size_t len) +int RTPUDPv4Transmitter::SendRTPData(const void *data, std::size_t len) { if (!init) return ERR_RTP_UDPV4TRANS_NOTINIT; @@ -857,7 +857,7 @@ int RTPUDPv4Transmitter::SendRTPData(const void *data, size_t len) return 0; } -int RTPUDPv4Transmitter::SendRTCPData(const void *data, size_t len) +int RTPUDPv4Transmitter::SendRTCPData(const void *data, std::size_t len) { if (!init) return ERR_RTP_UDPV4TRANS_NOTINIT; @@ -1248,7 +1248,7 @@ void RTPUDPv4Transmitter::ClearAcceptList() } -int RTPUDPv4Transmitter::SetMaximumPacketSize(size_t s) +int RTPUDPv4Transmitter::SetMaximumPacketSize(std::size_t s) { if (!init) return ERR_RTP_UDPV4TRANS_NOTINIT; @@ -1352,7 +1352,7 @@ int RTPUDPv4Transmitter::PollSocket(bool rtp) SOCKET sock; unsigned long len; #else - size_t len; + std::size_t len; int sock; #endif // RTP_SOCKETTYPE_WINSOCK struct sockaddr_in srcaddr; @@ -1425,7 +1425,7 @@ int RTPUDPv4Transmitter::PollSocket(bool rtp) { isrtp = true; - if ((size_t) recvlen > sizeof(RTCPCommonHeader)) + if ((std::size_t) recvlen > sizeof(RTCPCommonHeader)) { RTCPCommonHeader *rtcpheader = (RTCPCommonHeader *) datacopy; uint8_t packettype = rtcpheader->packettype; diff --git a/qrtplib/rtpudpv4transmitter.h b/qrtplib/rtpudpv4transmitter.h index bd2aa9597..109a4c093 100644 --- a/qrtplib/rtpudpv4transmitter.h +++ b/qrtplib/rtpudpv4transmitter.h @@ -380,14 +380,14 @@ public: ~RTPUDPv4Transmitter(); int Init(bool treadsafe); - int Create(size_t maxpacksize, const RTPTransmissionParams *transparams); + int Create(std::size_t maxpacksize, const RTPTransmissionParams *transparams); void Destroy(); RTPTransmissionInfo *GetTransmissionInfo(); void DeleteTransmissionInfo(RTPTransmissionInfo *inf); - int GetLocalHostName(uint8_t *buffer, size_t *bufferlength); + int GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength); bool ComesFromThisTransmitter(const RTPAddress *addr); - size_t GetHeaderOverhead() + std::size_t GetHeaderOverhead() { return RTPUDPV4TRANS_HEADERSIZE; } @@ -396,8 +396,8 @@ public: int WaitForIncomingData(const RTPTime &delay, bool *dataavailable = 0); int AbortWait(); - int SendRTPData(const void *data, size_t len); - int SendRTCPData(const void *data, size_t len); + int SendRTPData(const void *data, std::size_t len); + int SendRTCPData(const void *data, std::size_t len); int AddDestination(const RTPAddress &addr); int DeleteDestination(const RTPAddress &addr); @@ -415,7 +415,7 @@ public: int AddToAcceptList(const RTPAddress &addr); int DeleteFromAcceptList(const RTPAddress &addr); void ClearAcceptList(); - int SetMaximumPacketSize(size_t s); + int SetMaximumPacketSize(std::size_t s); bool NewDataAvailable(); RTPRawPacket *GetNextPacket(); @@ -449,7 +449,7 @@ private: RTPTransmitter::ReceiveMode receivemode; uint8_t *localhostname; - size_t localhostnamelength; + std::size_t localhostnamelength; RTPHashTable destinations; #ifdef RTP_SUPPORT_IPV4MULTICAST @@ -458,7 +458,7 @@ private: std::list rawpacketlist; bool supportsmulticasting; - size_t maxpacksize; + std::size_t maxpacksize; class PortInfo { diff --git a/qrtplib/rtpudpv4transmitternobind.cpp b/qrtplib/rtpudpv4transmitternobind.cpp index ad4f79d86..e51ba491d 100644 --- a/qrtplib/rtpudpv4transmitternobind.cpp +++ b/qrtplib/rtpudpv4transmitternobind.cpp @@ -137,7 +137,7 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo SocketType sock = socket(PF_INET, SOCK_DGRAM, 0); if (sock == RTPSOCKERR) { - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return ERR_RTP_UDPV4TRANS_CANTCREATESOCKET; } @@ -153,7 +153,7 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo if (bind(sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) != 0) { RTPCLOSE(sock); - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return ERR_RTP_UDPV4TRANS_CANTGETVALIDSOCKET; } @@ -163,7 +163,7 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo if (status < 0) { RTPCLOSE(sock); - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return status; } @@ -176,7 +176,7 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo *pRtcpSock = sock; *pRtpPort = basePort; *pRtcpPort = basePort; - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return 0; @@ -190,7 +190,7 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo if (sock2 == RTPSOCKERR) { RTPCLOSE(sock); - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return ERR_RTP_UDPV4TRANS_CANTCREATESOCKET; } @@ -237,7 +237,7 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo *pRtcpPort = basePort; } - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return 0; @@ -249,13 +249,13 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo } } - for (size_t i = 0; i < toClose.size(); i++) + for (std::size_t i = 0; i < toClose.size(); i++) RTPCLOSE(toClose[i]); return ERR_RTP_UDPV4TRANS_TOOMANYATTEMPTSCHOOSINGSOCKET; } -int RTPUDPv4TransmitterNoBind::Create(size_t maximumpacketsize, const RTPTransmissionParams *transparams) +int RTPUDPv4TransmitterNoBind::Create(std::size_t maximumpacketsize, const RTPTransmissionParams *transparams) { const RTPUDPv4TransmissionNoBindParams *params, defaultparams; // struct sockaddr_in addr; @@ -557,7 +557,7 @@ void RTPUDPv4TransmitterNoBind::DeleteTransmissionInfo(RTPTransmissionInfo *i) delete i; } -int RTPUDPv4TransmitterNoBind::GetLocalHostName(uint8_t *buffer, size_t *bufferlength) +int RTPUDPv4TransmitterNoBind::GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength) { if (!init) return ERR_RTP_UDPV4TRANS_NOTINIT; @@ -833,7 +833,7 @@ int RTPUDPv4TransmitterNoBind::AbortWait() return 0; } -int RTPUDPv4TransmitterNoBind::SendRTPData(const void *data, size_t len) +int RTPUDPv4TransmitterNoBind::SendRTPData(const void *data, std::size_t len) { if (!init) return ERR_RTP_UDPV4TRANS_NOTINIT; @@ -859,7 +859,7 @@ int RTPUDPv4TransmitterNoBind::SendRTPData(const void *data, size_t len) return 0; } -int RTPUDPv4TransmitterNoBind::SendRTCPData(const void *data, size_t len) +int RTPUDPv4TransmitterNoBind::SendRTCPData(const void *data, std::size_t len) { if (!init) return ERR_RTP_UDPV4TRANS_NOTINIT; @@ -1250,7 +1250,7 @@ void RTPUDPv4TransmitterNoBind::ClearAcceptList() } -int RTPUDPv4TransmitterNoBind::SetMaximumPacketSize(size_t s) +int RTPUDPv4TransmitterNoBind::SetMaximumPacketSize(std::size_t s) { if (!init) return ERR_RTP_UDPV4TRANS_NOTINIT; @@ -1354,7 +1354,7 @@ int RTPUDPv4TransmitterNoBind::PollSocket(bool rtp) SOCKET sock; unsigned long len; #else - size_t len; + std::size_t len; int sock; #endif // RTP_SOCKETTYPE_WINSOCK struct sockaddr_in srcaddr; @@ -1427,7 +1427,7 @@ int RTPUDPv4TransmitterNoBind::PollSocket(bool rtp) { isrtp = true; - if ((size_t) recvlen > sizeof(RTCPCommonHeader)) + if ((std::size_t) recvlen > sizeof(RTCPCommonHeader)) { RTCPCommonHeader *rtcpheader = (RTCPCommonHeader *) datacopy; uint8_t packettype = rtcpheader->packettype; diff --git a/qrtplib/rtpudpv4transmitternobind.h b/qrtplib/rtpudpv4transmitternobind.h index 6b0da05d1..a1d3f4201 100644 --- a/qrtplib/rtpudpv4transmitternobind.h +++ b/qrtplib/rtpudpv4transmitternobind.h @@ -382,16 +382,16 @@ public: ~RTPUDPv4TransmitterNoBind(); int Init(bool treadsafe); - int Create(size_t maxpacksize, const RTPTransmissionParams *transparams); + int Create(std::size_t maxpacksize, const RTPTransmissionParams *transparams); /** Bind the RTP and RTCP sockets to ports defined in the transmission parameters */ int BindSockets(const RTPTransmissionParams *transparams); void Destroy(); RTPTransmissionInfo *GetTransmissionInfo(); void DeleteTransmissionInfo(RTPTransmissionInfo *inf); - int GetLocalHostName(uint8_t *buffer, size_t *bufferlength); + int GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength); bool ComesFromThisTransmitter(const RTPAddress *addr); - size_t GetHeaderOverhead() + std::size_t GetHeaderOverhead() { return RTPUDPV4TRANSNOBIND_HEADERSIZE; } @@ -400,8 +400,8 @@ public: int WaitForIncomingData(const RTPTime &delay, bool *dataavailable = 0); int AbortWait(); - int SendRTPData(const void *data, size_t len); - int SendRTCPData(const void *data, size_t len); + int SendRTPData(const void *data, std::size_t len); + int SendRTCPData(const void *data, std::size_t len); int AddDestination(const RTPAddress &addr); int DeleteDestination(const RTPAddress &addr); @@ -419,7 +419,7 @@ public: int AddToAcceptList(const RTPAddress &addr); int DeleteFromAcceptList(const RTPAddress &addr); void ClearAcceptList(); - int SetMaximumPacketSize(size_t s); + int SetMaximumPacketSize(std::size_t s); bool NewDataAvailable(); RTPRawPacket *GetNextPacket(); @@ -453,7 +453,7 @@ private: RTPTransmitter::ReceiveMode receivemode; uint8_t *localhostname; - size_t localhostnamelength; + std::size_t localhostnamelength; RTPHashTable destinations; #ifdef RTP_SUPPORT_IPV4MULTICAST @@ -462,7 +462,7 @@ private: std::list rawpacketlist; bool supportsmulticasting; - size_t maxpacksize; + std::size_t maxpacksize; class PortInfo {