Author: gschneider Date: Sun May 30 22:31:58 2010 New Revision: 47460 URL: http://svn.reactos.org/svn/reactos?rev=47460&view=rev Log: Various application fixes by Jan Roeloffzen, bug #5182, part 3 arp: Remove unused variables ftp: tabs->spaces, remove unused variables nslookup: Remove unused variables
Modified: trunk/reactos/base/applications/network/arp/arp.c trunk/reactos/base/applications/network/ftp/fake.c trunk/reactos/base/applications/network/ftp/ftp.c trunk/reactos/base/applications/network/nslookup/nslookup.c Modified: trunk/reactos/base/applications/network/arp/arp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/arp/arp.c?rev=47460&r1=47459&r2=47460&view=diff ============================================================================== --- trunk/reactos/base/applications/network/arp/arp.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/arp/arp.c [iso-8859-1] Sun May 30 22:31:58 2010 @@ -170,9 +170,7 @@ ZeroMemory(pIpNetTable, sizeof(*pIpNetTable)); - iRet = GetIpNetTable(pIpNetTable, &Size, TRUE); - - if (iRet != NO_ERROR) + if (GetIpNetTable(pIpNetTable, &Size, TRUE) != NO_ERROR) { _tprintf(_T("failed to allocate memory for GetIpNetTable\n")); DoFormatMessage(); @@ -201,9 +199,7 @@ ZeroMemory(pIpAddrTable, sizeof(*pIpAddrTable)); - iRet = GetIpAddrTable(pIpAddrTable, &Size, TRUE); - - if (iRet != NO_ERROR) + if ((iRet = GetIpAddrTable(pIpAddrTable, &Size, TRUE)) != NO_ERROR) { _tprintf(_T("GetIpAddrTable failed: %d\n"), iRet); DoFormatMessage(); @@ -272,7 +268,7 @@ PMIB_IPNETTABLE pIpNetTable = NULL; DWORD dwIpAddr = 0; ULONG Size = 0; - INT iRet, i, val, c; + INT i, val, c; /* error checking */ @@ -320,9 +316,7 @@ ZeroMemory(pIpNetTable, sizeof(*pIpNetTable)); - iRet = GetIpNetTable(pIpNetTable, &Size, TRUE); - - if (iRet != NO_ERROR) + if (GetIpNetTable(pIpNetTable, &Size, TRUE) != NO_ERROR) { _tprintf(_T("failed to allocate memory for GetIpNetTable\n")); DoFormatMessage(); @@ -382,7 +376,7 @@ /* Add the ARP entry */ - if ((iRet = SetIpNetEntry(pAddHost)) != NO_ERROR) + if (SetIpNetEntry(pAddHost) != NO_ERROR) { DoFormatMessage(); goto cleanup; @@ -415,7 +409,6 @@ PMIB_IPNETTABLE pIpNetTable = NULL; ULONG Size = 0; DWORD dwIpAddr = 0; - INT iRet; BOOL bFlushTable = FALSE; /* error checking */ @@ -449,9 +442,7 @@ ZeroMemory(pIpNetTable, sizeof(*pIpNetTable)); - iRet = GetIpNetTable(pIpNetTable, &Size, TRUE); - - if (iRet != NO_ERROR) + if (GetIpNetTable(pIpNetTable, &Size, TRUE) != NO_ERROR) { _tprintf(_T("failed to allocate memory for GetIpNetTable\n")); DoFormatMessage(); @@ -485,7 +476,7 @@ if (bFlushTable == TRUE) { /* delete arp cache */ - if ((iRet = FlushIpNetTable(pDelHost->dwIndex)) != NO_ERROR) + if (FlushIpNetTable(pDelHost->dwIndex) != NO_ERROR) { DoFormatMessage(); goto cleanup; @@ -501,7 +492,7 @@ pDelHost->dwAddr = dwIpAddr; /* Add the ARP entry */ - if ((iRet = DeleteIpNetEntry(pDelHost)) != NO_ERROR) + if (DeleteIpNetEntry(pDelHost) != NO_ERROR) { DoFormatMessage(); goto cleanup; Modified: trunk/reactos/base/applications/network/ftp/fake.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/ftp/fake.c?rev=47460&r1=47459&r2=47460&view=diff ============================================================================== --- trunk/reactos/base/applications/network/ftp/fake.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/ftp/fake.c [iso-8859-1] Sun May 30 22:31:58 2010 @@ -29,10 +29,10 @@ void blkfree(char **av0) { - register char **av = av0; - - while (*av) - free(*av++); + register char **av = av0; + + while (*av) + free(*av++); } char **glob(register char *v) @@ -52,16 +52,16 @@ #if 0 int gettimeofday(struct timeval *timenow, - struct timezone *zone) -{ - time_t t; - - t = clock(); - - timenow->tv_usec = t; - timenow->tv_sec = t / CLK_TCK; - - return 0; + struct timezone *zone) +{ + time_t t; + + t = clock(); + + timenow->tv_usec = t; + timenow->tv_sec = t / CLK_TCK; + + return 0; } int fgetcSocket(int s) @@ -100,13 +100,13 @@ total = recv(s, buffer, sizeof(buffer), 0); if (total == SOCKET_ERROR) - { - total = 0; - return ERROR; - } + { + total = 0; + return ERROR; + } if (total == 0) - return EOF; + return EOF; } return buffer[index++]; } @@ -142,29 +142,29 @@ buffer[1] = '\0'; if(SOCKET_ERROR==send(s, buffer, 1, 0)) { - int iret=WSAGetLastError (); - fprintf(stdout,"fputcSocket: %d\n",iret); - return 0; + int iret=WSAGetLastError (); + fprintf(stdout,"fputcSocket: %d\n",iret); + return 0; } else { - return putChar; + return putChar; } } int fputSocket(int s, char *buffer, int len) { - int iret; - while(len) { - if(SOCKET_ERROR==(iret=send(s, buffer, len, 0))) - { - iret=WSAGetLastError (); - fprintf(stdout,"fputcSocket: %d\n",iret); - return 0; - } - else { - return len-=iret; - } - } - return 0; + int iret; + while(len) { + if(SOCKET_ERROR==(iret=send(s, buffer, len, 0))) + { + iret=WSAGetLastError (); + fprintf(stdout,"fputcSocket: %d\n",iret); + return 0; + } + else { + return len-=iret; + } + } + return 0; } char *fgetsSocket(int s, char *string) @@ -180,31 +180,31 @@ if (count == SOCKET_ERROR) { - printf("Error in fgetssocket"); - return NULL; + printf("Error in fgetssocket"); + return NULL; } if (count == 1) { - string[i] = buffer[0]; - - if (i == MAX_ASCII - 3) - { - count = 0; - string[++i] = '\n'; - string[++i] = '\0'; - } + string[i] = buffer[0]; + + if (i == MAX_ASCII - 3) + { + count = 0; + string[++i] = '\n'; + string[++i] = '\0'; + } } else { - if (i == 0) - return NULL; - else - { - string[i] = '\n'; - string[i + 1] = '\0'; // This is risky - return string; - } + if (i == 0) + return NULL; + else + { + string[i] = '\n'; + string[i + 1] = '\0'; // This is risky + return string; + } } @@ -250,44 +250,44 @@ int rc; if (istty) - { - if (GetConsoleMode (in, &old_flags)) - SetConsoleMode (in, ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT); - else - istty = 0; - } + { + if (GetConsoleMode (in, &old_flags)) + SetConsoleMode (in, ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT); + else + istty = 0; + } /* Need to read line one byte at time to avoid blocking, if not a tty, so always do it this way. */ count = 0; while (1) - { - DWORD dummy; - char one_char; - - rc = ReadFile (in, &one_char, 1, &dummy, NULL); - if (rc == 0) - break; - if (one_char == '\r') - { - /* CR is always followed by LF if reading from tty. */ - if (istty) - continue; - else - break; - } - if (one_char == '\n') - break; - /* Silently truncate password string if overly long. */ - if (count < sizeof (input) - 1) - input[count++] = one_char; - } + { + DWORD dummy; + char one_char; + + rc = ReadFile (in, &one_char, 1, &dummy, NULL); + if (rc == 0) + break; + if (one_char == '\r') + { + /* CR is always followed by LF if reading from tty. */ + if (istty) + continue; + else + break; + } + if (one_char == '\n') + break; + /* Silently truncate password string if overly long. */ + if (count < sizeof (input) - 1) + input[count++] = one_char; + } input[count] = '\0'; WriteFile (err, "\r\n", 2, &count, NULL); if (istty) - SetConsoleMode (in, old_flags); + SetConsoleMode (in, old_flags); if (rc) - return input; + return input; } return NULL; Modified: trunk/reactos/base/applications/network/ftp/ftp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/ftp/ftp.c?rev=47460&r1=47459&r2=47460&view=diff ============================================================================== --- trunk/reactos/base/applications/network/ftp/ftp.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/ftp/ftp.c [iso-8859-1] Sun May 30 22:31:58 2010 @@ -345,7 +345,7 @@ cp = reply_string; while ((c = fgetcSocket(cin)) != '\n') { if (c == IAC) { /* handle telnet commands */ - switch (c = fgetcSocket(cin)) { + switch (fgetcSocket(cin)) { case WILL: case WONT: c = fgetcSocket(cin); @@ -745,7 +745,7 @@ long bytes = 0, hashbytes = HASHBYTES; // struct fd_set mask; - register int c, d; + register int c; struct timeval start, stop; // struct stat st; @@ -781,6 +781,7 @@ null();// oldintr = signal(SIGINT, abortrecv); if (strcmp(local, "-") && *local != '|') { #ifndef _WIN32 + register int d; // This whole thing is a problem... access Won't work on non-existent files if (access(local, 2) < 0) { char *dir = rindex(local, '/'); @@ -919,7 +920,7 @@ (*closefunc)(fout); return; } - errno = d = 0; + errno = 0; // while ((c = recv(din, buf, bufsize, 1)) > 0) { // if ((d = write(fileno(fout), buf, c)) != c) // if ((d = write(fileno(fout), buf, c)) != c) @@ -1106,10 +1107,10 @@ lostpeer(); } if (din && FD_ISSET(din, &mask)) { - while ((c = recv(din, buf, bufsize, 0)) > 0) + while (recv(din, buf, bufsize, 0) > 0) ; } - if ((c = getreply(0)) == ERROR && code == 552) { /* needed for nic style abort */ + if (getreply(0) == ERROR && code == 552) { /* needed for nic style abort */ if (data >= 0) { (void) close(data); data = -1; Modified: trunk/reactos/base/applications/network/nslookup/nslookup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/nslookup/nslookup.c?rev=47460&r1=47459&r2=47460&view=diff ============================================================================== --- trunk/reactos/base/applications/network/nslookup/nslookup.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/nslookup/nslookup.c [iso-8859-1] Sun May 30 22:31:58 2010 @@ -90,11 +90,7 @@ BOOL bOk = FALSE; /* Makes things easier when parsing the response packet. */ - UCHAR Header1, Header2; USHORT NumQuestions; - USHORT NumAnswers; - USHORT NumAuthority; - USHORT NumAdditional; USHORT Type; if( (strlen( pAddr ) + 1) > 255 ) return FALSE; @@ -198,12 +194,7 @@ if( !bOk ) goto cleanup; /* Start parsing the received packet. */ - Header1 = RecBuffer[2]; - Header2 = RecBuffer[3]; NumQuestions = ntohs( ((PSHORT)&RecBuffer[4])[0] ); - NumAnswers = ntohs( ((PSHORT)&RecBuffer[6])[0] ); - NumAuthority = ntohs( ((PUSHORT)&RecBuffer[8])[0] ); - NumAdditional = ntohs( ((PUSHORT)&RecBuffer[10])[0] ); k = 12; @@ -257,11 +248,10 @@ BOOL bOk = FALSE; /* Makes things easier when parsing the response packet. */ - UCHAR Header1, Header2; + UCHAR Header2; USHORT NumQuestions; USHORT NumAnswers; USHORT NumAuthority; - USHORT NumAdditional; USHORT Type; if( (strlen( pAddr ) + 1) > 255 ) return; @@ -368,19 +358,17 @@ ((PSHORT)&Buffer[i])[0] = htons( ClassNametoClassID( State.Class ) ); /* Ship off the request to the DNS server. */ - bOk = SendRequest( Buffer, + bOk = SendRequest( Buffer, BufferLength, RecBuffer, &RecBufferLength ); if( !bOk ) goto cleanup; /* Start parsing the received packet. */ - Header1 = RecBuffer[2]; Header2 = RecBuffer[3]; NumQuestions = ntohs( ((PSHORT)&RecBuffer[4])[0] ); NumAnswers = ntohs( ((PSHORT)&RecBuffer[6])[0] ); NumAuthority = ntohs( ((PUSHORT)&RecBuffer[8])[0] ); - NumAdditional = ntohs( ((PUSHORT)&RecBuffer[10])[0] ); Type = 0; /* Check the RCODE for failure. */