fix ecc warning

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7456 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
eric_tian 2009-02-06 05:37:46 +00:00
parent ed3a31b518
commit c24b392c30
3 changed files with 33 additions and 17 deletions

View File

@ -214,14 +214,14 @@ FindVariable (
while ((Variable[Index] != NULL) && (Variable[Index] <= GetEndPointer (VariableStoreHeader[Index]))) {
if (Variable[Index]->StartId == VARIABLE_DATA && Variable[Index]->State == VAR_ADDED) {
if (!(EfiAtRuntime () && !(Variable[Index]->Attributes & EFI_VARIABLE_RUNTIME_ACCESS))) {
if (!(EfiAtRuntime () && (Variable[Index]->Attributes & EFI_VARIABLE_RUNTIME_ACCESS == 0))) {
if (VariableName[0] == 0) {
PtrTrack->CurrPtr = Variable[Index];
PtrTrack->Volatile = (BOOLEAN) Index;
return EFI_SUCCESS;
} else {
if (CompareGuid (VendorGuid, &Variable[Index]->VendorGuid)) {
if (!CompareMem (VariableName, GET_VARIABLE_NAME_PTR (Variable[Index]), Variable[Index]->NameSize)) {
if (CompareMem (VariableName, GET_VARIABLE_NAME_PTR (Variable[Index]), Variable[Index]->NameSize) == 0) {
PtrTrack->CurrPtr = Variable[Index];
PtrTrack->Volatile = (BOOLEAN) Index;
return EFI_SUCCESS;
@ -389,7 +389,7 @@ GetNextVariableName (
// Variable is found
//
if (Variable.CurrPtr->StartId == VARIABLE_DATA && Variable.CurrPtr->State == VAR_ADDED) {
if (!(EfiAtRuntime () && !(Variable.CurrPtr->Attributes & EFI_VARIABLE_RUNTIME_ACCESS))) {
if (!(EfiAtRuntime () && (Variable.CurrPtr->Attributes & EFI_VARIABLE_RUNTIME_ACCESS == 0))) {
VarNameSize = Variable.CurrPtr->NameSize;
if (VarNameSize <= *VariableNameSize) {
CopyMem (
@ -527,7 +527,7 @@ SetVariable (
//
// Only variable have NV attribute can be updated/deleted in Runtime
//
if (!(Variable.CurrPtr->Attributes & EFI_VARIABLE_NON_VOLATILE)) {
if ((Variable.CurrPtr->Attributes & EFI_VARIABLE_NON_VOLATILE) == 0) {
Status = EFI_INVALID_PARAMETER;
goto Done;
}
@ -548,7 +548,7 @@ SetVariable (
// then return to the caller immediately.
//
if (Variable.CurrPtr->DataSize == DataSize &&
!CompareMem (Data, GetVariableDataPtr (Variable.CurrPtr), DataSize)
CompareMem (Data, GetVariableDataPtr (Variable.CurrPtr), DataSize) == 0
) {
Status = EFI_SUCCESS;
goto Done;

View File

@ -38,14 +38,6 @@ VARIABLE_CACHE_ENTRY mVariableCache[] = {
VARIABLE_INFO_ENTRY *gVariableInfo = NULL;
EFI_STATUS
FtwVariableSpace (
IN EFI_PHYSICAL_ADDRESS VariableBaseAddress,
IN UINT8 *Buffer,
IN UINTN BufferSize
);
/**
Acquires lock only at boot time. Simply returns at runtime.
@ -929,7 +921,7 @@ FindVariable (
if (Variable[Index]->State == VAR_ADDED ||
Variable[Index]->State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)
) {
if (!EfiAtRuntime () || (Variable[Index]->Attributes & EFI_VARIABLE_RUNTIME_ACCESS)) {
if (!EfiAtRuntime () || (Variable[Index]->Attributes & EFI_VARIABLE_RUNTIME_ACCESS != 0)) {
if (VariableName[0] == 0) {
if (Variable[Index]->State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)) {
InDeletedVariable = Variable[Index];
@ -947,7 +939,7 @@ FindVariable (
Point = (VOID *) GetVariableNamePtr (Variable[Index]);
ASSERT (NameSizeOfVariable (Variable[Index]) != 0);
if (!CompareMem (VariableName, Point, NameSizeOfVariable (Variable[Index]))) {
if (CompareMem (VariableName, Point, NameSizeOfVariable (Variable[Index])) == 0) {
if (Variable[Index]->State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)) {
InDeletedVariable = Variable[Index];
InDeletedStorageIndex = Index;
@ -1136,7 +1128,7 @@ RuntimeServiceGetNextVariableName (
// Variable is found
//
if (IsValidVariableHeader (Variable.CurrPtr) && Variable.CurrPtr->State == VAR_ADDED) {
if (!(EfiAtRuntime () && !(Variable.CurrPtr->Attributes & EFI_VARIABLE_RUNTIME_ACCESS))) {
if ((EfiAtRuntime () && ((Variable.CurrPtr->Attributes & EFI_VARIABLE_RUNTIME_ACCESS) == 0)) == 0) {
VarNameSize = NameSizeOfVariable (Variable.CurrPtr);
ASSERT (VarNameSize != 0);
@ -1294,7 +1286,7 @@ RuntimeServiceSetVariable (
//
// Only variable have NV attribute can be updated/deleted in Runtime
//
if (!(Variable.CurrPtr->Attributes & EFI_VARIABLE_NON_VOLATILE)) {
if ((Variable.CurrPtr->Attributes & EFI_VARIABLE_NON_VOLATILE) == 0) {
Status = EFI_INVALID_PARAMETER;
goto Done;
}

View File

@ -70,4 +70,28 @@ typedef struct {
VOID *Data;
} VARIABLE_CACHE_ENTRY;
/**
Writes a buffer to variable storage space, in the working block.
This function writes a buffer to variable storage space into firmware
volume block device. The destination is specified by parameter
VariableBase. Fault Tolerant Write protocol is used for writing.
@param VariableBase Base address of variable to write
@param Buffer Point to the data buffer
@param BufferSize The number of bytes of the data Buffer
@retval EFI_SUCCESS The function completed successfully
@retval EFI_NOT_FOUND Fail to locate Fault Tolerant Write protocol
@retval EFI_ABORTED The function could not complete successfully
**/
EFI_STATUS
FtwVariableSpace (
IN EFI_PHYSICAL_ADDRESS VariableBase,
IN UINT8 *Buffer,
IN UINTN BufferSize
);
#endif