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];
@ -509,7 +510,7 @@ HttpUrlGetHostName (
return EFI_INVALID_PARAMETER;
}
Parser = (HTTP_URL_PARSER*) UrlParser;
Parser = (HTTP_URL_PARSER *) UrlParser;
if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_HOST)) == 0) {
return EFI_NOT_FOUND;
@ -569,7 +570,7 @@ HttpUrlGetIp4 (
return EFI_INVALID_PARAMETER;
}
Parser = (HTTP_URL_PARSER*) UrlParser;
Parser = (HTTP_URL_PARSER *) UrlParser;
if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_HOST)) == 0) {
return EFI_NOT_FOUND;
@ -632,7 +633,7 @@ HttpUrlGetIp6 (
return EFI_INVALID_PARAMETER;
}
Parser = (HTTP_URL_PARSER*) UrlParser;
Parser = (HTTP_URL_PARSER *) UrlParser;
if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_HOST)) == 0) {
return EFI_NOT_FOUND;
@ -711,7 +712,7 @@ HttpUrlGetPort (
*Port = 0;
Index = 0;
Parser = (HTTP_URL_PARSER*) UrlParser;
Parser = (HTTP_URL_PARSER *) UrlParser;
if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_PORT)) == 0) {
return EFI_NOT_FOUND;
@ -789,7 +790,7 @@ HttpUrlGetPath (
return EFI_INVALID_PARAMETER;
}
Parser = (HTTP_URL_PARSER*) UrlParser;
Parser = (HTTP_URL_PARSER *) UrlParser;
if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_PATH)) == 0) {
return EFI_NOT_FOUND;
@ -1159,7 +1160,7 @@ HttpParseMessageBody (
return EFI_INVALID_PARAMETER;
}
Parser = (HTTP_BODY_PARSER*) MsgParser;
Parser = (HTTP_BODY_PARSER *) MsgParser;
if (Parser->IgnoreBody) {
Parser->State = BodyParserComplete;
@ -1404,7 +1405,7 @@ HttpIsMessageComplete (
return FALSE;
}
Parser = (HTTP_BODY_PARSER*) MsgParser;
Parser = (HTTP_BODY_PARSER *) MsgParser;
if (Parser->State == BodyParserComplete) {
return TRUE;
@ -1438,7 +1439,7 @@ HttpGetEntityLength (
return EFI_INVALID_PARAMETER;
}
Parser = (HTTP_BODY_PARSER*) MsgParser;
Parser = (HTTP_BODY_PARSER *) MsgParser;
if (!Parser->ContentLengthIsValid) {
return EFI_NOT_READY;
@ -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
@ -1770,7 +1770,7 @@ HttpGenRequestMessage (
Status = gBS->LocateProtocol (
&gEfiHttpUtilitiesProtocolGuid,
NULL,
(VOID **)&HttpUtilitiesProtocol
(VOID **) &HttpUtilitiesProtocol
);
if (EFI_ERROR (Status)) {
@ -1805,9 +1805,7 @@ HttpGenRequestMessage (
&HttpHdr
);
if (AppendList != NULL) {
FreePool (AppendList);
}
if (EFI_ERROR (Status) || HttpHdr == NULL){
return Status;