diff options
author | lpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-30 23:04:13 +0000 |
---|---|---|
committer | lpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-30 23:04:13 +0000 |
commit | 59bc059327dd519619fa437c0d7c941e090cd8a3 (patch) | |
tree | 0159ec3a44a5b35410a156aba19f43ad9937cdb2 /AppPkg/Applications/Sockets/DataSource/DataSource.c | |
parent | a88c31639bb24c73383a4528a5b77066e805148b (diff) | |
download | edk2-platforms-59bc059327dd519619fa437c0d7c941e090cd8a3.tar.xz |
Update the sockets applications
* Builds with GCC 4.4 compiler.
Signed-off by: lpleahy
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12498 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'AppPkg/Applications/Sockets/DataSource/DataSource.c')
-rw-r--r-- | AppPkg/Applications/Sockets/DataSource/DataSource.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/AppPkg/Applications/Sockets/DataSource/DataSource.c b/AppPkg/Applications/Sockets/DataSource/DataSource.c index 9add3f24e7..98a0c9f120 100644 --- a/AppPkg/Applications/Sockets/DataSource/DataSource.c +++ b/AppPkg/Applications/Sockets/DataSource/DataSource.c @@ -84,7 +84,7 @@ UINT64 TotalBytesSent; UINT64 PreviousBytes;
UINT64 AverageBytes;
UINT64 Samples;
-UINT8 Buffer [ DATA_BUFFER_SIZE ];
+UINT8 Buffer[ DATA_BUFFER_SIZE ];
//
@@ -146,8 +146,7 @@ GetDigit ( // Walk the digits
//
Value = 0;
- while (( '0' <= *pDigit ) && ( '9' >= *pDigit ))
- {
+ while (( '0' <= *pDigit ) && ( '9' >= *pDigit )) {
//
// Make room for the new least significant digit
//
@@ -313,7 +312,7 @@ SocketConnect ( //
// Check for user stop request
//
- while ( ! bTick ) {
+ while ( !bTick ) {
Status = ControlCCheck ( );
if ( EFI_ERROR ( Status )) {
break;
@@ -494,8 +493,7 @@ SocketOpen ( //
// Use do/while and break instead of goto
//
- do
- {
+ do {
//
// Wait for the network layer to initialize
//
@@ -801,7 +799,7 @@ Tcp4Locate ( //
// Open the network controller's service protocol
//
- Tcp4Controller = pHandles [ Tcp4Index++ ];
+ Tcp4Controller = pHandles[ Tcp4Index++ ];
Status = gBS->OpenProtocol (
Tcp4Controller,
&gEfiTcp4ServiceBindingProtocolGuid,
@@ -1499,12 +1497,15 @@ main ( //
// Validate the command line
//
- if ( 2 != Argc ) {
- Print ( L"%s <remote IP address>\r\n", Argv[0] );
+ if ( 2 > Argc ) {
+ Print ( L"%s <remote IP address> [Use TCP]\r\n", Argv[0] );
return -1;
}
-bTcp4 = TRUE;
+ //
+ // Determine if TCP should be used
+ //
+ bTcp4 = (BOOLEAN)( 2 < Argc );
//
// Determine the support routines
@@ -1522,8 +1523,7 @@ bTcp4 = TRUE; //
// Use for/break instead of goto
//
- for ( ; ; )
- {
+ for ( ; ; ) {
//
// No bytes sent so far
//
@@ -1540,14 +1540,10 @@ bTcp4 = TRUE; RemoteHostAddress.sin_family = AF_INET;
RemoteHostAddress.sin_port = htons ( PcdGet16 ( DataSource_Port ));
-Print ( L"Argc: %d\r\n", Argc);
-Print ( L"Argv[0]: %a\r\n", Argv[0]);
-Print ( L"Argv[1]: %a\r\n", Argv[1]);
-
//
// Get the IP address
//
- pRemoteHost = Argv [1];
+ pRemoteHost = Argv[1];
Status = IpAddress ( );
if ( EFI_ERROR ( Status )) {
break;
|