Skip to content

Commit

Permalink
Fix some bugs found by the compiler
Browse files Browse the repository at this point in the history
Not sure how some of these even compiled before
  • Loading branch information
dchengTSC committed Jan 11, 2021
1 parent 8d14dc6 commit 8d6307e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion libutil/Utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ Utility::process_impl()
}

for( ;; ) {
const int code = prog::getOption( _argc, _argv, _shortOptions.c_str(), _longOptions, NULL );
const unsigned int code = prog::getOption( _argc, _argv, _shortOptions.c_str(), _longOptions, NULL );
if( code == -1 )
break;

Expand Down
17 changes: 5 additions & 12 deletions src/mp4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -864,18 +864,11 @@ MP4FileHandle MP4ReadProvider( const char* fileName, const MP4FileProvider* file
//
mp4v2_ismacrypParams *MP4DefaultISMACrypParams(mp4v2_ismacrypParams *ptr)
{
try
{
if (ptr == NULL) {
ptr = (mp4v2_ismacrypParams *)MP4Malloc(sizeof(mp4v2_ismacrypParams));
}
memset(ptr, 0, sizeof(*ptr));
return ptr;
}

catch (...) {
return MP4_INVALID_TRACK_ID;
}
if (ptr == NULL) {
ptr = (mp4v2_ismacrypParams *)MP4Malloc(sizeof(mp4v2_ismacrypParams));
}
memset(ptr, 0, sizeof(*ptr));
return ptr;
}


Expand Down
2 changes: 1 addition & 1 deletion src/rtphint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void MP4RtpHintTrack::GetPayload(
pSlash = strchr(pSlash, '/');
if (pSlash != NULL) {
pSlash++;
if (pSlash != '\0') {
if ( *pSlash != '\0' ) {
length = (uint32_t)strlen(pRtpMap) - (pSlash - pRtpMap);
*ppEncodingParams = (char *)MP4Calloc(length + 1);
strncpy(*ppEncodingParams, pSlash, length);
Expand Down

0 comments on commit 8d6307e

Please sign in to comment.