[edk2-devel] [PATCH 3/3] MdePkg/BaseLib: Base64Decode: Add decription for RETURN_SUCCESS

Laszlo Ersek lersek at redhat.com
Mon Jul 1 09:54:56 UTC 2019


On 06/28/19 05:57, Gao, Zhichao wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1891
> 
> While the convertion Base64 ascii string is null string (the
> string only contain white space would be regard as null string),
> there would be no decodeable data. Set *DestinationSize to zero
> and return RETURN_SUCCESS. But it is not mention in the comment
> of the function. So add this decription.
> 
> Cc: Michael D Kinney <michael.d.kinney at intel.com>
> Cc: Liming Gao <liming.gao at intel.com>
> Cc: Laszlo Ersek <lersek at redhat.com>
> Signed-off-by: Zhichao Gao <zhichao.gao at intel.com>
> ---
>  MdePkg/Library/BaseLib/String.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c
> index 7ebc2ecddd..8829d2cbbf 100644
> --- a/MdePkg/Library/BaseLib/String.c
> +++ b/MdePkg/Library/BaseLib/String.c
> @@ -1929,7 +1929,8 @@ Base64Encode (
>    @param DestinationSize   Caller is responsible for passing in buffer of at least DestinationSize.
>                             Set 0 to get the size needed. Set to bytes stored on return.
>  
> -  @retval RETURN_SUCCESS             When binary buffer is filled in.
> +  @retval RETURN_SUCCESS             When binary buffer is filled in. Or if the Base64 ascii string is empty, set
> +                                     *DestinationSize to zero to indicate this case.
>    @retval RETURN_INVALID_PARAMETER   If Source is NULL or DestinationSize is NULL.
>    @retval RETURN_INVALID_PARAMETER   If SourceLength or DestinationSize is bigger than (MAX_ADDRESS -(UINTN)Destination ).
>    @retval RETURN_INVALID_PARAMETER   If there is any invalid character in input stream.
> 

The new documentation points in the right direction, but it's not
entirely correct. The right language is, "if Source decodes to zero
output characters".

Thanks
Laszlo

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43108): https://edk2.groups.io/g/devel/message/43108
Mute This Topic: https://groups.io/mt/32238990/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list