MdeModulePkg/DxeHttpLib: Refine some coding style.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
This commit is contained in:
Jiaxin Wu 2017-12-26 09:31:06 +08:00
parent 4a6f440f25
commit 0d07e6fb53
2 changed files with 59 additions and 61 deletions

View File

@ -434,9 +434,9 @@ HttpFreeHeaderFields (
NULL if any error occured.
@param[out] RequestMsgSize Size of the RequestMsg (in bytes).
@return EFI_SUCCESS If HTTP request string was created successfully
@retval EFI_SUCCESS If HTTP request string was created successfully.
@retval EFI_OUT_OF_RESOURCES Failed to allocate resources.
@retval EFI_INVALID_PARAMETER The input arguments are invalid
@retval EFI_INVALID_PARAMETER The input arguments are invalid.
**/
EFI_STATUS

View File

@ -56,7 +56,8 @@ UriPercentDecode (
HexStr[2] = '\0';
while (Index < BufferLength) {
if (Buffer[Index] == '%') {
if (Index + 1 >= BufferLength || Index + 2 >= BufferLength || !NET_IS_HEX_CHAR (Buffer[Index+1]) || !NET_IS_HEX_CHAR (Buffer[Index+2])) {
if (Index + 1 >= BufferLength || Index + 2 >= BufferLength ||
!NET_IS_HEX_CHAR (Buffer[Index+1]) || !NET_IS_HEX_CHAR (Buffer[Index+2])) {
return EFI_INVALID_PARAMETER;
}
HexStr[0] = Buffer[Index+1];
@ -1476,7 +1477,6 @@ HttpFreeMsgParser (
**/
CHAR8 *
EFIAPI
AsciiStrGetNextToken (
IN CONST CHAR8 *String,
IN CHAR8 Separator
@ -1621,7 +1621,7 @@ HttpGetFieldNameAndValue (
//
// Boundary condition check.
//
if ((UINTN)EndofHeader - (UINTN)(FieldValueStr) < 1) {
if ((UINTN) EndofHeader - (UINTN) FieldValueStr < 1) {
return NULL;
}
@ -1630,7 +1630,7 @@ HttpGetFieldNameAndValue (
//
// Boundary condition check.
//
if ((UINTN)EndofHeader - (UINTN)(FieldValueStr) < 3) {
if ((UINTN) EndofHeader - (UINTN) FieldValueStr < 3) {
return NULL;
}
@ -1716,9 +1716,9 @@ HttpFreeHeaderFields (
NULL if any error occured.
@param[out] RequestMsgSize Size of the RequestMsg (in bytes).
@return EFI_SUCCESS If HTTP request string was created successfully
@retval EFI_SUCCESS If HTTP request string was created successfully.
@retval EFI_OUT_OF_RESOURCES Failed to allocate resources.
@retval EFI_INVALID_PARAMETER The input arguments are invalid
@retval EFI_INVALID_PARAMETER The input arguments are invalid.
**/
EFI_STATUS
@ -1805,9 +1805,7 @@ HttpGenRequestMessage (
&HttpHdr
);
if (AppendList != NULL) {
FreePool (AppendList);
}
if (EFI_ERROR (Status) || HttpHdr == NULL){
return Status;