[asterisk-scf-commits] asterisk-scf/release/matroska.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Aug 10 15:34:44 CDT 2011


branch "master" has been updated
       via  227519bf8a4a3b2db287a2f1823ac8961773e3f1 (commit)
      from  4a9e42777dbeace56608c148beb49bace8a76c84 (commit)

Summary of changes:
 libebml/src/EbmlBinary.cpp  |   13 +++++++------
 libebml/src/EbmlElement.cpp |    4 ++--
 2 files changed, 9 insertions(+), 8 deletions(-)


- Log -----------------------------------------------------------------
commit 227519bf8a4a3b2db287a2f1823ac8961773e3f1
Author: Brent Eagles <beagles at digium.com>
Date:   Wed Aug 10 18:04:21 2011 -0230

    More casts to deal with type conversions.

diff --git a/libebml/src/EbmlBinary.cpp b/libebml/src/EbmlBinary.cpp
index 44b139e..eec95b3 100644
--- a/libebml/src/EbmlBinary.cpp
+++ b/libebml/src/EbmlBinary.cpp
@@ -52,9 +52,9 @@ EbmlBinary::EbmlBinary(const EbmlBinary & ElementToClone)
 	if (ElementToClone.Data == NULL)
 		Data = NULL;
 	else {
-		Data = (binary *)malloc(GetSize() * sizeof(binary));
+		Data = (binary *)malloc(static_cast<size_t>(GetSize()) * sizeof(binary));
 		assert(Data != NULL);
-		memcpy(Data, ElementToClone.Data, GetSize());
+		memcpy(Data, ElementToClone.Data, static_cast<size_t>(GetSize()));
 	}
 }
 
@@ -68,7 +68,7 @@ EbmlBinary::operator const binary &() const {return *Data;}
 
 filepos_t EbmlBinary::RenderData(IOCallback & output, bool, bool)
 {
-	output.writeFully(Data,GetSize());
+	output.writeFully(Data, static_cast<size_t>(GetSize()));
 
 	return GetSize();
 }
@@ -92,16 +92,17 @@ filepos_t EbmlBinary::ReadData(IOCallback & input, ScopeMode ReadFully)
 		return GetSize();
 	}
 
-	Data = (binary *)malloc(GetSize());
+	Data = (binary *)malloc(static_cast<size_t>(GetSize()));
     if (Data == NULL)
 		throw CRTError(std::string("Error allocating data"));
 	SetValueIsSet();
-	return input.read(Data, GetSize());
+	return input.read(Data, static_cast<size_t>(GetSize()));
 }
 
 bool EbmlBinary::operator==(const EbmlBinary & ElementToCompare) const
 {
-	return ((GetSize() == ElementToCompare.GetSize()) && !memcmp(Data, ElementToCompare.Data, GetSize()));
+	return ((GetSize() == ElementToCompare.GetSize()) && !memcmp(Data, ElementToCompare.Data, 
+                static_cast<size_t>(GetSize())));
 }
 
 END_LIBEBML_NAMESPACE
diff --git a/libebml/src/EbmlElement.cpp b/libebml/src/EbmlElement.cpp
index 7182121..4fa9612 100644
--- a/libebml/src/EbmlElement.cpp
+++ b/libebml/src/EbmlElement.cpp
@@ -113,12 +113,12 @@ int CodedValueLength(uint64 Length, int CodedSize, binary * OutBuffer)
 	int _SizeMask = 0xFF;
 	OutBuffer[0] = static_cast<binary>(1 << (8 - CodedSize));
 	for (int i=1; i<CodedSize; i++) {
-		OutBuffer[CodedSize-i] = Length & 0xFF;
+		OutBuffer[CodedSize-i] = static_cast<binary>(Length & 0xFF);
 		Length >>= 8;
 		_SizeMask >>= 1;
 	}
 	// first one use a OR with the "EBML size head"
-	OutBuffer[0] |= static_cast<binary>(Length & 0xFF & _SizeMask);
+	OutBuffer[0] = static_cast<binary>((OutBuffer[0] | (Length & 0xFF & _SizeMask)));
 	return CodedSize;
 }
 

-----------------------------------------------------------------------


-- 
asterisk-scf/release/matroska.git



More information about the asterisk-scf-commits mailing list