summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-08-23 02:19:41 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-08-23 02:19:41 +0000
commit687a2e5f6902fa26c7a1d7a7705e0747c4095125 (patch)
treebcdcba327f17dd1fe3306d8ed04a98ca1e18f1cf /MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
parent4a8f7cceccde9f40f55cae415e10d80906a84919 (diff)
downloadedk2-platforms-687a2e5f6902fa26c7a1d7a7705e0747c4095125.tar.xz
1. Enable Network stack to pass SCT, currently MNP, ARP, IP4, TCP4 and DHCP4 have passed SCT.
2. Enable Network stack to pass ICC build. 3. Sync Network library instances' module names with their filenames. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3692 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c')
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
index af61c0bf69..903494ecb7 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
@@ -229,7 +229,7 @@ Mtftp4RemoveBlockNum (
if (Range->End == Num) {
Range->End--;
} else {
- NewRange = Mtftp4AllocateRange (Num + 1, (UINT16) Range->End);
+ NewRange = Mtftp4AllocateRange ((UINT16) (Num + 1), (UINT16) Range->End);
if (NewRange == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -270,6 +270,8 @@ Mtftp4SendRequest (
UINT8 *Cur;
UINT32 Len;
UINTN Index;
+ UINT32 Len1;
+ UINT32 Len2;
Token = Instance->Token;
Options = Token->OptionList;
@@ -282,11 +284,14 @@ Mtftp4SendRequest (
//
// Compute the packet length
//
- Len = (UINT32) (AsciiStrLen (Token->Filename) + AsciiStrLen (Mode) + 4);
+ Len1 = (UINT32) AsciiStrLen ((CHAR8 *) Token->Filename);
+ Len2 = (UINT32) AsciiStrLen ((CHAR8 *) Mode);
+ Len = (Len1 + Len2 + 4);
for (Index = 0; Index < Token->OptionCount; Index++) {
- Len += (UINT32) (AsciiStrLen (Options[Index].OptionStr) +
- AsciiStrLen (Options[Index].ValueStr) + 2);
+ Len1 = (UINT32) AsciiStrLen ((CHAR8 *) Options[Index].OptionStr);
+ Len2 = (UINT32) AsciiStrLen ((CHAR8 *) Options[Index].ValueStr);
+ Len += Len1 + Len2 + 2;
}
//
@@ -299,12 +304,12 @@ Mtftp4SendRequest (
Packet = (EFI_MTFTP4_PACKET *) NetbufAllocSpace (Nbuf, Len, FALSE);
Packet->OpCode = HTONS (Instance->Operation);
Cur = Packet->Rrq.Filename;
- Cur = AsciiStrCpy (Cur, Token->Filename);
- Cur = AsciiStrCpy (Cur, Mode);
+ Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Token->Filename);
+ Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Mode);
for (Index = 0; Index < Token->OptionCount; ++Index) {
- Cur = AsciiStrCpy (Cur, Options[Index].OptionStr);
- Cur = AsciiStrCpy (Cur, Options[Index].ValueStr);
+ Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Options[Index].OptionStr);
+ Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Options[Index].ValueStr);
}
return Mtftp4SendPacket (Instance, Nbuf);
@@ -333,7 +338,7 @@ Mtftp4SendError (
EFI_MTFTP4_PACKET *TftpError;
UINT32 Len;
- Len = (UINT32) (AsciiStrLen (ErrInfo) + sizeof (EFI_MTFTP4_ERROR_HEADER));
+ Len = (UINT32) (AsciiStrLen ((CHAR8 *) ErrInfo) + sizeof (EFI_MTFTP4_ERROR_HEADER));
Packet = NetbufAlloc (Len);
if (Packet == NULL) {
@@ -344,7 +349,7 @@ Mtftp4SendError (
TftpError->OpCode = HTONS (EFI_MTFTP4_OPCODE_ERROR);
TftpError->Error.ErrorCode = HTONS (ErrCode);
- AsciiStrCpy (TftpError->Error.ErrorMessage, ErrInfo);
+ AsciiStrCpy ((CHAR8 *) TftpError->Error.ErrorMessage, (CHAR8 *) ErrInfo);
return Mtftp4SendPacket (Instance, Packet);
}
@@ -419,6 +424,7 @@ Mtftp4SendPacket (
UDP_POINTS UdpPoint;
EFI_STATUS Status;
UINT16 OpCode;
+ UINT16 Value;
//
// Save the packet for retransmission
@@ -440,7 +446,8 @@ Mtftp4SendPacket (
// Send the requests to the listening port, other packets
// to the connected port
//
- OpCode = NTOHS (*((UINT16 *) NetbufGetByte (Packet, 0, NULL)));
+ Value = *((UINT16 *) NetbufGetByte (Packet, 0, NULL));
+ OpCode = NTOHS (Value);
if ((OpCode == EFI_MTFTP4_OPCODE_RRQ) || (OpCode == EFI_MTFTP4_OPCODE_DIR) ||
(OpCode == EFI_MTFTP4_OPCODE_WRQ)) {
@@ -485,6 +492,7 @@ Mtftp4Retransmit (
UDP_POINTS UdpPoint;
EFI_STATUS Status;
UINT16 OpCode;
+ UINT16 Value;
ASSERT (Instance->LastPacket != NULL);
@@ -495,7 +503,8 @@ Mtftp4Retransmit (
//
// Set the requests to the listening port, other packets to the connected port
//
- OpCode = NTOHS (*(UINT16 *) NetbufGetByte (Instance->LastPacket, 0, NULL));
+ Value = *(UINT16 *) NetbufGetByte (Instance->LastPacket, 0, NULL);
+ OpCode = NTOHS (Value);
if ((OpCode == EFI_MTFTP4_OPCODE_RRQ) || (OpCode == EFI_MTFTP4_OPCODE_DIR) ||
(OpCode == EFI_MTFTP4_OPCODE_WRQ)) {