[Live-devel] [patch] places where unsigned causes code to do nothing
Erik Hovland
erik at hovland.org
Tue Jul 1 08:49:16 PDT 2008
Sometimes the type can do funny things. In this patch using unsigned as
a type means that testing against less then zero or >= 0 has no effect.
E
---
liveMedia/InputFile.cpp | 2 +-
liveMedia/OnDemandServerMediaSubsession.cpp | 2 +-
liveMedia/SIPClient.cpp | 2 +-
liveMedia/include/InputFile.hh | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/liveMedia/InputFile.cpp b/liveMedia/InputFile.cpp
index bf92ab1..39ab953 100644
--- a/liveMedia/InputFile.cpp
+++ b/liveMedia/InputFile.cpp
@@ -78,7 +78,7 @@ u_int64_t GetFileSize(char const* fileName, FILE* fid) {
return fileSize;
}
-u_int64_t SeekFile64(FILE *fid, int64_t offset, int whence) {
+int64_t SeekFile64(FILE *fid, int64_t offset, int whence) {
clearerr(fid);
fflush(fid);
#if (defined(__WIN32__) || defined(_WIN32)) && !defined(_WIN32_WCE)
diff --git a/liveMedia/OnDemandServerMediaSubsession.cpp b/liveMedia/OnDemandServerMediaSubsession.cpp
index 4ef058e..b95bd00 100644
--- a/liveMedia/OnDemandServerMediaSubsession.cpp
+++ b/liveMedia/OnDemandServerMediaSubsession.cpp
@@ -313,7 +313,7 @@ void OnDemandServerMediaSubsession::deleteStream(unsigned clientSessionId,
}
// Delete the "StreamState" structure if it's no longer being used:
- if (streamState != NULL && streamState->referenceCount() >= 0) {
+ if (streamState != NULL) {
if (streamState->referenceCount() > 0) --streamState->referenceCount();
if (streamState->referenceCount() == 0) {
delete streamState;
diff --git a/liveMedia/SIPClient.cpp b/liveMedia/SIPClient.cpp
index 73db7c0..a6cb8c3 100644
--- a/liveMedia/SIPClient.cpp
+++ b/liveMedia/SIPClient.cpp
@@ -458,7 +458,7 @@ unsigned SIPClient::getResponseCode() {
char* firstLine = NULL;
char* nextLineStart = NULL;
unsigned bytesRead = getResponse(readBuf, readBufSize);
- if (bytesRead < 0) break;
+ if (bytesRead == 0) break;
if (fVerbosityLevel >= 1) {
envir() << "Received INVITE response: " << readBuf << "\n";
}
diff --git a/liveMedia/include/InputFile.hh b/liveMedia/include/InputFile.hh
index 3f4207a..905905f 100644
--- a/liveMedia/include/InputFile.hh
+++ b/liveMedia/include/InputFile.hh
@@ -31,7 +31,7 @@ void CloseInputFile(FILE* fid);
u_int64_t GetFileSize(char const* fileName, FILE* fid);
// 0 means zero-length, unbounded, or unknown
-u_int64_t SeekFile64(FILE *fid, int64_t offset, int whence);
+int64_t SeekFile64(FILE *fid, int64_t offset, int whence);
// A platform-independent routine for seeking within (possibly) large files
u_int64_t TellFile64(FILE *fid);
--
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