[Live-devel] [patch] use const_cast instead of C casting

Erik Hovland erik at hovland.org
Tue Jul 8 09:03:35 PDT 2008


In C++ it is preferred to control constness by using const_cast instead
of the C casting syntax. This patch does that in a couple of places.

E

---

 liveMedia/QuickTimeGenericRTPSource.cpp |    2 +-
 liveMedia/SimpleRTPSource.cpp           |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/liveMedia/QuickTimeGenericRTPSource.cpp b/liveMedia/QuickTimeGenericRTPSource.cpp
index eff16ea..4bbe5d3 100644
--- a/liveMedia/QuickTimeGenericRTPSource.cpp
+++ b/liveMedia/QuickTimeGenericRTPSource.cpp
@@ -74,7 +74,7 @@ QuickTimeGenericRTPSource
 
 QuickTimeGenericRTPSource::~QuickTimeGenericRTPSource() {
   delete[] qtState.sdAtom;
-  delete[] (char*)fMIMEtypeString;
+  delete[] const_cast<char*>(fMIMEtypeString);
 }
 
 Boolean QuickTimeGenericRTPSource
diff --git a/liveMedia/SimpleRTPSource.cpp b/liveMedia/SimpleRTPSource.cpp
index fcfdfb5..d41fe0b 100644
--- a/liveMedia/SimpleRTPSource.cpp
+++ b/liveMedia/SimpleRTPSource.cpp
@@ -49,7 +49,7 @@ SimpleRTPSource
 }
 
 SimpleRTPSource::~SimpleRTPSource() {
-  delete[] (char*)fMIMEtypeString;
+  delete[] const_cast<char*>(fMIMEtypeString);
 }
 
 Boolean SimpleRTPSource

-- 
Erik Hovland
mail: erik at hovland.org
web: http://hovland.org/
PGP/GPG public key available on request



More information about the live-devel mailing list