Use the local sha1 function names directly without compatibility defines

This commit is contained in:
Martin Storsjö 2014-01-17 10:43:26 +02:00
parent 4f5fd952b6
commit 0f3dfb33b0
4 changed files with 15 additions and 19 deletions

View File

@ -6,14 +6,14 @@
#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;
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 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>,
if (HasFatalFailure()) {
return;
}
SHA1_Init(&ctx_);
SHA1Reset(&ctx_);
}
virtual void TearDown() {
@ -87,7 +87,7 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>,
}
protected:
SHA_CTX ctx_;
SHA1Context ctx_;
BufferedData buf_;
};
@ -97,7 +97,7 @@ TEST_P(DecodeEncodeTest, CompareOutput) {
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));
}

View File

@ -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 @@ class DecoderOutputTest : public ::testing::WithParamInterface<FileParam>,
if (HasFatalFailure()) {
return;
}
SHA1_Init(&ctx_);
SHA1Reset(&ctx_);
}
virtual void onDecodeFrame(const Frame& frame) {
const Plane& y = frame.y;
@ -47,7 +47,7 @@ class DecoderOutputTest : public ::testing::WithParamInterface<FileParam>,
UpdateHashFromPlane(&ctx_, v.data, v.width, v.height, v.stride);
}
protected:
SHA_CTX ctx_;
SHA1Context ctx_;
};
TEST_P(DecoderOutputTest, CompareOutput) {
@ -55,7 +55,7 @@ TEST_P(DecoderOutputTest, CompareOutput) {
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));
}

View File

@ -2,14 +2,14 @@
#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;
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 @@ class EncoderOutputTest : public ::testing::WithParamInterface<EncodeFileParam>,
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 @@ TEST_P(EncoderOutputTest, CompareOutput) {
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));
}

View File

@ -78,10 +78,6 @@ void SHA1Input( SHA1Context *,
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
}