shithub: openh264

Download patch

ref: 0f3dfb33b0413385b48f3781a1eea92879faa7bb
parent: 4f5fd952b636e739faef2c76f74b21ee11bf6dd2
author: Martin Storsjö <[email protected]>
date: Fri Jan 17 05:43:26 EST 2014

Use the local sha1 function names directly without compatibility defines

--- a/test/decode_encode_test.cpp
+++ b/test/decode_encode_test.cpp
@@ -6,7 +6,7 @@
 #include "BaseDecoderTest.h"
 #include "BaseEncoderTest.h"
 
-static void UpdateHashFromFrame(const SFrameBSInfo& info, SHA_CTX* ctx) {
+static void UpdateHashFromFrame(const SFrameBSInfo& info, SHA1Context* ctx) {
   for (int i = 0; i < info.iLayerNum; ++i) {
     const SLayerBSInfo& layerInfo = info.sLayerInfo[i];
     int layerSize = 0;
@@ -13,7 +13,7 @@
     for (int j = 0; j < layerInfo.iNalCount; ++j) {
       layerSize += layerInfo.iNalLengthInByte[j];
     }
-    SHA1_Update(ctx, layerInfo.pBsBuf, layerSize);
+    SHA1Input(ctx, layerInfo.pBsBuf, layerSize);
   }
 }
 
@@ -49,7 +49,7 @@
     if (HasFatalFailure()) {
       return;
     }
-    SHA1_Init(&ctx_);
+    SHA1Reset(&ctx_);
   }
 
   virtual void TearDown() {
@@ -87,7 +87,7 @@
   }
 
  protected:
-  SHA_CTX ctx_;
+  SHA1Context ctx_;
   BufferedData buf_;
 };
 
@@ -97,7 +97,7 @@
   ASSERT_TRUE(Open(p.fileName));
   EncodeStream(this, p.width, p.height, p.frameRate, this);
   unsigned char digest[SHA_DIGEST_LENGTH];
-  SHA1_Final(digest, &ctx_);
+  SHA1Result(&ctx_, digest);
   if (!HasFatalFailure()) {
     ASSERT_TRUE(CompareHash(digest, p.hashStr));
   }
--- a/test/decoder_test.cpp
+++ b/test/decoder_test.cpp
@@ -2,10 +2,10 @@
 #include "utils/HashFunctions.h"
 #include "BaseDecoderTest.h"
 
-static void UpdateHashFromPlane(SHA_CTX* ctx, const uint8_t* plane,
+static void UpdateHashFromPlane(SHA1Context* ctx, const uint8_t* plane,
     int width, int height, int stride) {
   for (int i = 0; i < height; i++) {
-    SHA1_Update(ctx, plane, width);
+    SHA1Input(ctx, plane, width);
     plane += stride;
   }
 }
@@ -36,7 +36,7 @@
     if (HasFatalFailure()) {
       return;
     }
-    SHA1_Init(&ctx_);
+    SHA1Reset(&ctx_);
   }
   virtual void onDecodeFrame(const Frame& frame) {
     const Plane& y = frame.y;
@@ -47,7 +47,7 @@
     UpdateHashFromPlane(&ctx_, v.data, v.width, v.height, v.stride);
   }
  protected:
-  SHA_CTX ctx_;
+  SHA1Context ctx_;
 };
 
 TEST_P(DecoderOutputTest, CompareOutput) {
@@ -55,7 +55,7 @@
   DecodeFile(p.fileName, this);
 
   unsigned char digest[SHA_DIGEST_LENGTH];
-  SHA1_Final(digest, &ctx_);
+  SHA1Result(&ctx_, digest);
   if (!HasFatalFailure()) {
     ASSERT_TRUE(CompareHash(digest, p.hashStr));
   }
--- a/test/encoder_test.cpp
+++ b/test/encoder_test.cpp
@@ -2,7 +2,7 @@
 #include "utils/HashFunctions.h"
 #include "BaseEncoderTest.h"
 
-static void UpdateHashFromFrame(const SFrameBSInfo& info, SHA_CTX* ctx) {
+static void UpdateHashFromFrame(const SFrameBSInfo& info, SHA1Context* ctx) {
   for (int i = 0; i < info.iLayerNum; ++i) {
     const SLayerBSInfo& layerInfo = info.sLayerInfo[i];
     int layerSize = 0;
@@ -9,7 +9,7 @@
     for (int j = 0; j < layerInfo.iNalCount; ++j) {
       layerSize += layerInfo.iNalLengthInByte[j];
     }
-    SHA1_Update(ctx, layerInfo.pBsBuf, layerSize);
+    SHA1Input(ctx, layerInfo.pBsBuf, layerSize);
   }
 }
 
@@ -41,13 +41,13 @@
     if (HasFatalFailure()) {
       return;
     }
-    SHA1_Init(&ctx_);
+    SHA1Reset(&ctx_);
   }
   virtual void onEncodeFrame(const SFrameBSInfo& frameInfo) {
     UpdateHashFromFrame(frameInfo, &ctx_);
   }
  protected:
-  SHA_CTX ctx_;
+  SHA1Context ctx_;
 };
 
 
@@ -56,7 +56,7 @@
   EncodeFile(p.fileName, p.width, p.height, p.frameRate, this);
 
   unsigned char digest[SHA_DIGEST_LENGTH];
-  SHA1_Final(digest, &ctx_);
+  SHA1Result(&ctx_, digest);
   if (!HasFatalFailure()) {
     ASSERT_TRUE(CompareHash(digest, p.hashStr));
   }
--- a/test/sha1.h
+++ b/test/sha1.h
@@ -78,10 +78,6 @@
                 unsigned);
 
 #define SHA_DIGEST_LENGTH 20
-#define SHA_CTX SHA1Context
-#define SHA1_Init(ctx) SHA1Reset(ctx)
-#define SHA1_Update(ctx, d, l) SHA1Input(ctx, d, l)
-#define SHA1_Final(d, ctx) SHA1Result(ctx, d)
 
 #ifdef __cplusplus
 }