StdLib: Fix GCC warnings/errors caused by variables being set but not used.

Removed variables that had no effect on code behavior.

Fifo.c::FIFO_Dequeue: Replaced instances of "Self->ElementSize" with preexisting variable "SizeOfElement".

IIOutilities.c::IIO_GetInChar: Fixed variable of wrong, but compatible, type and made updating of housekeeping variables dependent upon successful completion of reading from the buffer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed by: Daryl McDaniel <daryl.mcdaniel@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16276 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Olivier Martin
2014-10-30 01:05:22 +00:00
committed by darylm503
parent b07ae3d607
commit 0e565888ee
11 changed files with 449 additions and 426 deletions

View File

@@ -292,17 +292,17 @@ FIFO_Dequeue (
SizeOfElement = Self->ElementSize; // Get size of this FIFO's elements
Count = MIN(Count, Self->Count(Self, AsElements)); // Lesser of requested or actual
QPtr = (UINTN)Self->Queue + (RDex * Self->ElementSize); // Point to Read location in FIFO
QPtr = (UINTN)Self->Queue + (RDex * SizeOfElement); // Point to Read location in FIFO
for(i = 0; i < Count; ++i) { // Iterate Count times...
(void)CopyMem(pElement, (const void *)QPtr, Self->ElementSize); // Copy element from FIFO to caller's buffer
(void)CopyMem(pElement, (const void *)QPtr, SizeOfElement); // Copy element from FIFO to caller's buffer
RDex = (UINT32)ModuloIncrement(RDex, Self->NumElements); // Increment Read Index
if(RDex == 0) { // If the index wrapped
QPtr = (UINTN)Self->Queue; // Point back to beginning of data
}
else { // Otherwise
QPtr += Self->ElementSize; // Point to the next element in FIFO
QPtr += SizeOfElement; // Point to the next element in FIFO
}
pElement = (char*)pElement + Self->ElementSize; // Point to next element in caller's buffer
pElement = (char*)pElement + SizeOfElement; // Point to next element in caller's buffer
} // Iterate: for loop
if(Consume) { // If caller requests data consumption
Self->ReadIndex = RDex; // Set FIFO's Read Index to new Index

View File

@@ -75,7 +75,7 @@ IIO_GetInChar (
{
cIIO *This;
cFIFO *InBuf;
EFI_STATUS Status;
size_t Status;
ssize_t NumRead;
wint_t RetVal;
wchar_t InChar;
@@ -92,8 +92,10 @@ IIO_GetInChar (
}
if(BufCnt > 0) {
Status = InBuf->Read(InBuf, &InChar, 1);
--BufCnt;
NumRead = 1;
if (Status > 0) {
--BufCnt;
NumRead = 1;
}
}
else {
NumRead = filp->f_ops->fo_read(filp, &filp->f_offset, sizeof(wchar_t), &InChar);

View File

@@ -8,7 +8,7 @@
It is the responsibility of the caller, or higher level function, to perform
any necessary translation between wide and narrow characters.
Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
@@ -63,7 +63,6 @@ IIO_WriteOne(struct __filedes *filp, cFIFO *OBuf, wchar_t InCh)
UINT32 CurRow; // Current cursor row on the screen
UINT32 PrevColumn; // Previous column. Used to detect wrapping.
UINT32 AdjColumn; // Current cursor column on the screen
UINT32 AdjRow; // Current cursor row on the screen
RetVal = -1;
wcb = wc;
@@ -79,7 +78,6 @@ IIO_WriteOne(struct __filedes *filp, cFIFO *OBuf, wchar_t InCh)
CurRow = This->CurrentXY.Row;
numW = 1; // The majority of characters buffer one character
AdjRow = 0; // Most characters just cause horizontal movement
AdjColumn = 0;
if(OFlag & OPOST) {
/* Perform output processing */
@@ -127,7 +125,6 @@ IIO_WriteOne(struct __filedes *filp, cFIFO *OBuf, wchar_t InCh)
numW = 2;
CurColumn = 0;
}
AdjRow = 1;
break; //}}
case CHAR_BACKSPACE: //{{

View File

@@ -37,7 +37,6 @@ IIO_NonCanonRead (
cIIO *This;
cFIFO *InBuf;
struct termios *Termio;
EFI_STATUS Status;
ssize_t NumRead;
cc_t tioMin;
cc_t tioTime;
@@ -74,7 +73,7 @@ IIO_NonCanonRead (
if(InBuf->IsEmpty(InBuf)) {
NumRead = filp->f_ops->fo_read(filp, &filp->f_offset, sizeof(wchar_t), &InChar);
if(NumRead > 0) {
Status = InBuf->Write(InBuf, &InChar, 1); // Buffer the character
(void) InBuf->Write(InBuf, &InChar, 1); // Buffer the character
}
}
// break;

View File

@@ -1,7 +1,6 @@
/*
* Copyright (c) 1999, 2000
* Intel Corporation.
* All rights reserved.
/** @file
*
* Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -100,9 +99,11 @@ writev(
int iovcnt
)
{
const struct iovec *pVecTmp;
char *pBuf, *pBufTmp;
size_t TotalBytes, i, ret;
const struct iovec *pVecTmp;
char *pBuf;
size_t TotalBytes;
size_t i;
size_t ret;
//
// See how much memory we'll need
@@ -126,7 +127,7 @@ writev(
// Copy vectors to the buffer
//
for (pBufTmp = pBuf; iovcnt; iovcnt--) {
for (; iovcnt; iovcnt--) {
bcopy(iov->iov_base, pBuf, iov->iov_len);
pBuf += iov->iov_len;
iov++;