DTSC::Packet::genericFill now allows zero sized packets, when combined with a null pointer

This commit is contained in:
Thulinma 2017-05-15 15:28:37 +02:00
parent 3a4f990143
commit e5470f035e

View file

@ -208,6 +208,7 @@ namespace DTSC {
/// Re-initializes this Packet to contain a generic DTSC packet with the given data fields. /// Re-initializes this Packet to contain a generic DTSC packet with the given data fields.
/// When given a NULL pointer, the data is reserved and memset to 0 /// When given a NULL pointer, the data is reserved and memset to 0
/// If given a NULL pointer and a zero size, an empty packet is created.
void Packet::genericFill(long long packTime, long long packOffset, long long packTrack, const char * packData, long long packDataSize, uint64_t packBytePos, bool isKeyframe){ void Packet::genericFill(long long packTime, long long packOffset, long long packTrack, const char * packData, long long packDataSize, uint64_t packBytePos, bool isKeyframe){
null(); null();
master = true; master = true;
@ -217,7 +218,7 @@ namespace DTSC {
//bpos, if >= 0, adds 9 bytes (integer type) and 6 bytes (2+namelen) //bpos, if >= 0, adds 9 bytes (integer type) and 6 bytes (2+namelen)
//keyframe, if true, adds 9 bytes (integer type) and 10 bytes (2+namelen) //keyframe, if true, adds 9 bytes (integer type) and 10 bytes (2+namelen)
//data adds packDataSize+5 bytes (string type) and 6 bytes (2+namelen) //data adds packDataSize+5 bytes (string type) and 6 bytes (2+namelen)
if (packDataSize < 1){ if (packData && packDataSize < 1){
FAIL_MSG("Attempted to fill a packet with %lli bytes!", packDataSize); FAIL_MSG("Attempted to fill a packet with %lli bytes!", packDataSize);
return; return;
} }