shithub: openh264

Download patch

ref: c44d4a7f0791cb2f1a3bd85e90ea7d580785e022
parent: 82b70b34fe3ca03af1e7f79aa92d85e6917454d1
parent: 917d41bd47217d890cb3414d65477cafa9f2f332
author: ruil2 <[email protected]>
date: Thu Nov 27 16:54:42 EST 2014

Merge pull request #1569 from mstorsjo/pointer-diff-cast

Add casts when converting pointer differences to integers

--- a/codec/decoder/core/src/au_parser.cpp
+++ b/codec/decoder/core/src/au_parser.cpp
@@ -1053,7 +1053,7 @@
         pCtx->iErrorCode |= dsOutOfMemory;
         return pCtx->iErrorCode;
       }
-      DecInitBitsForEncoding (&sSubsetSpsBs, pBsBuf, pBs->pEndBuf - pBs->pStartBuf);
+      DecInitBitsForEncoding (&sSubsetSpsBs, pBsBuf, (int32_t) (pBs->pEndBuf - pBs->pStartBuf));
       DecBsWriteBits (&sSubsetSpsBs, 8, 77); //profile_idc, forced to Main profile
       DecBsWriteOneBit (&sSubsetSpsBs, pSps->bConstraintSet0Flag); // constraint_set0_flag
       DecBsWriteOneBit (&sSubsetSpsBs, pSps->bConstraintSet1Flag); // constraint_set1_flag
@@ -1093,9 +1093,9 @@
       }
       DecBsWriteOneBit (&sSubsetSpsBs, 0); //vui_parameters_present_flag
       DecBsRbspTrailingBits (&sSubsetSpsBs); //finished, rbsp trailing bit
-      int32_t iRbspSize = sSubsetSpsBs.pCurBuf - sSubsetSpsBs.pStartBuf;
+      int32_t iRbspSize = (int32_t) (sSubsetSpsBs.pCurBuf - sSubsetSpsBs.pStartBuf);
       RBSP2EBSP (pSpsBs->pSpsBsBuf + 5, sSubsetSpsBs.pStartBuf, iRbspSize);
-      pSpsBs->uiSpsBsLen = sSubsetSpsBs.pCurBuf - sSubsetSpsBs.pStartBuf + 5;
+      pSpsBs->uiSpsBsLen = (uint16_t) (sSubsetSpsBs.pCurBuf - sSubsetSpsBs.pStartBuf + 5);
       if (pBsBuf) {
         WelsFree (pBsBuf, "pBsBuf for parse only usage");
       }