[edk2] [Patch] MdeModulePkg BrotliLib: Rename function with the specific lib name

Liming Gao posted 1 patch 6 years, 1 month ago
Failed in applying to current master (apply log)
.../Library/BrotliCustomDecompressLib/BrotliDecompress.c   | 14 +++++++-------
.../BrotliDecompressLibInternal.h                          |  6 +++---
.../Library/BrotliCustomDecompressLib/dec/decode.c         |  2 +-
MdeModulePkg/Library/BrotliCustomDecompressLib/dec/state.c |  4 ++--
4 files changed, 13 insertions(+), 13 deletions(-)
[edk2] [Patch] MdeModulePkg BrotliLib: Rename function with the specific lib name
Posted by Liming Gao 6 years, 1 month ago
This change is to avoid the function conflict.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
---
 .../Library/BrotliCustomDecompressLib/BrotliDecompress.c   | 14 +++++++-------
 .../BrotliDecompressLibInternal.h                          |  6 +++---
 .../Library/BrotliCustomDecompressLib/dec/decode.c         |  2 +-
 MdeModulePkg/Library/BrotliCustomDecompressLib/dec/state.c |  4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompress.c b/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompress.c
index a303921..4b10b40 100644
--- a/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompress.c
+++ b/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompress.c
@@ -1,7 +1,7 @@
 /** @file
   Brotli Decompress interfaces
 
-  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -17,7 +17,7 @@
   Dummy malloc function for compiler.
 **/
 VOID *
-malloc (
+BrDummyMalloc (
   IN size_t    Size
   )
 {
@@ -29,7 +29,7 @@ malloc (
   Dummy free function for compiler.
 **/
 VOID
-free (
+BrDummyFree (
   IN VOID *    Ptr
   )
 {
@@ -198,7 +198,7 @@ BrotliDecompress (
   @return The size of the uncompressed buffer.
 **/
 UINT64
-GetDecodedSizeOfBuf(
+BrGetDecodedSizeOfBuf(
   IN UINT8 *  EncodedData,
   IN UINT8    StartOffset,
   IN UINT8    EndOffset
@@ -259,10 +259,10 @@ BrotliUefiDecompressGetInfo (
   ASSERT(SourceSize >= BROTLI_SCRATCH_MAX);
 
   MaxOffset = BROTLI_DECODE_MAX;
-  GetSize = GetDecodedSizeOfBuf((UINT8 *)Source, MaxOffset - BROTLI_INFO_SIZE, MaxOffset);
+  GetSize = BrGetDecodedSizeOfBuf((UINT8 *)Source, MaxOffset - BROTLI_INFO_SIZE, MaxOffset);
   *DestinationSize = (UINT32)GetSize;
   MaxOffset = BROTLI_SCRATCH_MAX;
-  GetSize = GetDecodedSizeOfBuf((UINT8 *)Source, MaxOffset - BROTLI_INFO_SIZE, MaxOffset);
+  GetSize = BrGetDecodedSizeOfBuf((UINT8 *)Source, MaxOffset - BROTLI_INFO_SIZE, MaxOffset);
   *ScratchSize = (UINT32)GetSize;
   return EFI_SUCCESS;
 }
@@ -305,7 +305,7 @@ BrotliUefiDecompress (
   UINT8          MaxOffset;
 
   MaxOffset = BROTLI_SCRATCH_MAX;
-  GetSize = GetDecodedSizeOfBuf((UINT8 *)Source, MaxOffset - BROTLI_INFO_SIZE, MaxOffset);
+  GetSize = BrGetDecodedSizeOfBuf((UINT8 *)Source, MaxOffset - BROTLI_INFO_SIZE, MaxOffset);
 
   BroBuff.Buff     = Scratch;
   BroBuff.BuffSize = (UINTN)GetSize;
diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompressLibInternal.h b/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompressLibInternal.h
index c2d84a8..0aca763 100644
--- a/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompressLibInternal.h
+++ b/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompressLibInternal.h
@@ -3,7 +3,7 @@
 
   Allows BROTLI code to build under UEFI (edk2) build environment
 
-  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -41,12 +41,12 @@ typedef struct
 #define memset(dest,ch,count)       SetMem(dest,(UINTN)(count),(UINT8)(ch))
 
 VOID *
-malloc (
+BrDummyMalloc (
   IN size_t   Size
   );
 
 VOID
-free (
+BrDummyFree (
   IN VOID *   Ptr
   );
 
diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c
index 6557ba6..3bee3e7 100644
--- a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c
+++ b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c
@@ -56,7 +56,7 @@ BrotliDecoderState* BrotliDecoderCreateInstance(
     brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque) {
   BrotliDecoderState* state = 0;
   if (!alloc_func && !free_func) {
-    state = (BrotliDecoderState*)malloc(sizeof(BrotliDecoderState));
+    state = (BrotliDecoderState*)BrDummyMalloc(sizeof(BrotliDecoderState));
   } else if (alloc_func && free_func) {
     state = (BrotliDecoderState*)alloc_func(opaque, sizeof(BrotliDecoderState));
   }
diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/state.c b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/state.c
index e7e5e3c..dbe4a36 100644
--- a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/state.c
+++ b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/state.c
@@ -18,12 +18,12 @@ extern "C" {
 
 static void* DefaultAllocFunc(void* opaque, size_t size) {
   BROTLI_UNUSED(opaque);
-  return malloc(size);
+  return BrDummyMalloc(size);
 }
 
 static void DefaultFreeFunc(void* opaque, void* address) {
   BROTLI_UNUSED(opaque);
-  free(address);
+  BrDummyFree(address);
 }
 
 void BrotliDecoderStateInit(BrotliDecoderState* s) {
-- 
2.8.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] MdeModulePkg BrotliLib: Rename function with the specific lib name
Posted by Zeng, Star 6 years, 1 month ago
Reviewed-by: Star Zeng <star.zeng@intel.com>

Thanks,
Star
-----Original Message-----
From: Gao, Liming 
Sent: Tuesday, March 13, 2018 3:58 PM
To: edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>
Subject: [Patch] MdeModulePkg BrotliLib: Rename function with the specific lib name

This change is to avoid the function conflict.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
---
 .../Library/BrotliCustomDecompressLib/BrotliDecompress.c   | 14 +++++++-------
 .../BrotliDecompressLibInternal.h                          |  6 +++---
 .../Library/BrotliCustomDecompressLib/dec/decode.c         |  2 +-
 MdeModulePkg/Library/BrotliCustomDecompressLib/dec/state.c |  4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompress.c b/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompress.c
index a303921..4b10b40 100644
--- a/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompress.c
+++ b/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompress.c
@@ -1,7 +1,7 @@
 /** @file
   Brotli Decompress interfaces
 
-  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2017 - 2018, Intel Corporation. All rights 
+ reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at @@ -17,7 +17,7 @@
   Dummy malloc function for compiler.
 **/
 VOID *
-malloc (
+BrDummyMalloc (
   IN size_t    Size
   )
 {
@@ -29,7 +29,7 @@ malloc (
   Dummy free function for compiler.
 **/
 VOID
-free (
+BrDummyFree (
   IN VOID *    Ptr
   )
 {
@@ -198,7 +198,7 @@ BrotliDecompress (
   @return The size of the uncompressed buffer.
 **/
 UINT64
-GetDecodedSizeOfBuf(
+BrGetDecodedSizeOfBuf(
   IN UINT8 *  EncodedData,
   IN UINT8    StartOffset,
   IN UINT8    EndOffset
@@ -259,10 +259,10 @@ BrotliUefiDecompressGetInfo (
   ASSERT(SourceSize >= BROTLI_SCRATCH_MAX);
 
   MaxOffset = BROTLI_DECODE_MAX;
-  GetSize = GetDecodedSizeOfBuf((UINT8 *)Source, MaxOffset - BROTLI_INFO_SIZE, MaxOffset);
+  GetSize = BrGetDecodedSizeOfBuf((UINT8 *)Source, MaxOffset - 
+ BROTLI_INFO_SIZE, MaxOffset);
   *DestinationSize = (UINT32)GetSize;
   MaxOffset = BROTLI_SCRATCH_MAX;
-  GetSize = GetDecodedSizeOfBuf((UINT8 *)Source, MaxOffset - BROTLI_INFO_SIZE, MaxOffset);
+  GetSize = BrGetDecodedSizeOfBuf((UINT8 *)Source, MaxOffset - 
+ BROTLI_INFO_SIZE, MaxOffset);
   *ScratchSize = (UINT32)GetSize;
   return EFI_SUCCESS;
 }
@@ -305,7 +305,7 @@ BrotliUefiDecompress (
   UINT8          MaxOffset;
 
   MaxOffset = BROTLI_SCRATCH_MAX;
-  GetSize = GetDecodedSizeOfBuf((UINT8 *)Source, MaxOffset - BROTLI_INFO_SIZE, MaxOffset);
+  GetSize = BrGetDecodedSizeOfBuf((UINT8 *)Source, MaxOffset - 
+ BROTLI_INFO_SIZE, MaxOffset);
 
   BroBuff.Buff     = Scratch;
   BroBuff.BuffSize = (UINTN)GetSize;
diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompressLibInternal.h b/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompressLibInternal.h
index c2d84a8..0aca763 100644
--- a/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompressLibInternal.h
+++ b/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliDecompressLib
+++ Internal.h
@@ -3,7 +3,7 @@
 
   Allows BROTLI code to build under UEFI (edk2) build environment
 
-  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2017 - 2018, Intel Corporation. All rights 
+ reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at @@ -41,12 +41,12 @@ typedef struct
 #define memset(dest,ch,count)       SetMem(dest,(UINTN)(count),(UINT8)(ch))
 
 VOID *
-malloc (
+BrDummyMalloc (
   IN size_t   Size
   );
 
 VOID
-free (
+BrDummyFree (
   IN VOID *   Ptr
   );
 
diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c
index 6557ba6..3bee3e7 100644
--- a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c
+++ b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c
@@ -56,7 +56,7 @@ BrotliDecoderState* BrotliDecoderCreateInstance(
     brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque) {
   BrotliDecoderState* state = 0;
   if (!alloc_func && !free_func) {
-    state = (BrotliDecoderState*)malloc(sizeof(BrotliDecoderState));
+    state = 
+ (BrotliDecoderState*)BrDummyMalloc(sizeof(BrotliDecoderState));
   } else if (alloc_func && free_func) {
     state = (BrotliDecoderState*)alloc_func(opaque, sizeof(BrotliDecoderState));
   }
diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/state.c b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/state.c
index e7e5e3c..dbe4a36 100644
--- a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/state.c
+++ b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/state.c
@@ -18,12 +18,12 @@ extern "C" {
 
 static void* DefaultAllocFunc(void* opaque, size_t size) {
   BROTLI_UNUSED(opaque);
-  return malloc(size);
+  return BrDummyMalloc(size);
 }
 
 static void DefaultFreeFunc(void* opaque, void* address) {
   BROTLI_UNUSED(opaque);
-  free(address);
+  BrDummyFree(address);
 }
 
 void BrotliDecoderStateInit(BrotliDecoderState* s) {
--
2.8.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel