Comment's added and fixed.

Pointer's checked for NULL before access and after memory allocations.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11499 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey
2011-04-01 22:16:01 +00:00
parent 5f2915f593
commit ae724571be
19 changed files with 481 additions and 518 deletions

View File

@@ -237,8 +237,7 @@ FreeMemory (
}
/**
Initialize String Info Log data structures
Initialize String Info Log data structures.
**/
VOID
EFIAPI
@@ -1043,8 +1042,7 @@ WritePTLen (
}
/**
Outputs the code length array for Char&Length Set
Outputs the code length array for Char&Length Set.
**/
VOID
EFIAPI

View File

@@ -357,7 +357,7 @@ FileBufferRestoreMousePosition (
CurrentLine = FileBuffer.CurrentLine;
Line = MoveLine (FRow - FileBuffer.FilePosition.Row);
if (FColumn > Line->Size) {
if (Line == NULL || FColumn > Line->Size) {
HasCharacter = FALSE;
}
@@ -1367,7 +1367,7 @@ GetNewLine (
Change a Unicode string to an ASCII string.
@param[in] UStr The Unicode string.
@param[in] Lenght The maximum size of AStr.
@param[in] Length The maximum size of AStr.
@param[out] AStr ASCII string to pass out.
@return The actuall length.
@@ -1375,9 +1375,9 @@ GetNewLine (
UINTN
EFIAPI
UnicodeToAscii (
IN CONST CHAR16 *UStr,
IN CONST UINTN Length,
OUT CHAR8 *AStr
IN CONST CHAR16 *UStr,
IN CONST UINTN Length,
OUT CHAR8 *AStr
)
{
UINTN Index;
@@ -1621,7 +1621,7 @@ FileBufferSave (
//
// now everything is ready , you can set the new file name to filebuffer
//
if (StrCmp (FileName, FileBuffer.FileName) != 0) {
if (FileName != NULL && FileBuffer.FileName != NULL && StrCmp (FileName, FileBuffer.FileName) != 0) {
//
// not the same
//

View File

@@ -91,7 +91,7 @@ MainCommandSearch (
VOID
);
/*
/**
search string in file buffer, and replace it with another str
@retval EFI_SUCCESS The operation was successful.
@@ -589,8 +589,8 @@ MainCommandSearch (
return EFI_SUCCESS;
}
/*
search string in file buffer, and replace it with another str
/**
Search string in file buffer, and replace it with another str.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@@ -1589,7 +1589,6 @@ GetTextY (
@retval EFI_SUCCESS The operation was successful.
@retval EFI_NOT_FOUND There was no mouse support found.
**/
STATIC
EFI_STATUS
EFIAPI
MainEditorHandleMouseInput (

View File

@@ -188,10 +188,15 @@ HBufferImageReplace (
UINTN
);
/**
Free the current image.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HBufferImageFree (
VOID
) ;
);
EFI_STATUS
HBufferImageDeleteCharacterFromBuffer (

View File

@@ -489,7 +489,8 @@ Returns:
//
// now everything is ready , you can set the new file name to filebuffer
//
if (BufferTypeBackup != FileTypeFileBuffer || StringNoCaseCompare (&FileName, &HFileImage.FileName) != 0) {
if ((BufferTypeBackup != FileTypeFileBuffer && FileName != NULL) ||
(FileName != NULL && HFileImage.FileName != NULL && StringNoCaseCompare (&FileName, &HFileImage.FileName) != 0)){
//
// not the same
//

View File

@@ -135,8 +135,8 @@ ShellCommandRunHexEdit (
Size = ShellStrToUintn(ShellCommandLineGetRawValue(Package, 2));
}
}
if (WhatToDo == FileTypeNone && ShellCommandLineGetRawValue(Package, 1) != NULL) {
Name = ShellCommandLineGetRawValue(Package, 1);
Name = ShellCommandLineGetRawValue(Package, 1);
if (WhatToDo == FileTypeNone && Name != NULL) {
if (!IsValidFileName(Name)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Name);
ShellStatus = SHELL_INVALID_PARAMETER;

View File

@@ -1868,9 +1868,9 @@ Returns:
|| ReadChange ) {
MainTitleBarRefresh (
HMainEditor.BufferImage->BufferType == FileTypeFileBuffer?HMainEditor.BufferImage->FileImage->FileName:HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Name:NULL,
HMainEditor.BufferImage->BufferType == FileTypeFileBuffer&&HMainEditor.BufferImage->FileImage!=NULL?HMainEditor.BufferImage->FileImage->FileName:HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer&&HMainEditor.BufferImage->DiskImage!=NULL?HMainEditor.BufferImage->DiskImage->Name:NULL,
HMainEditor.BufferImage->BufferType,
HMainEditor.BufferImage->FileImage->ReadOnly,
(BOOLEAN)(HMainEditor.BufferImage->FileImage!=NULL?HMainEditor.BufferImage->FileImage->ReadOnly:FALSE),
HMainEditor.BufferImage->Modified,
HMainEditor.ScreenSize.Column,
HMainEditor.ScreenSize.Row,

View File

@@ -2969,7 +2969,7 @@ QueryTable (
//
if (High > Low && Key >= Low && Key <= High) {
StrnCpy (Info, Table[Index].Info, InfoLen-1);
StrCat (Info, L"\n");
StrnCat (Info, L"\n", InfoLen - StrLen(Info));
return Key;
}
//
@@ -2977,7 +2977,7 @@ QueryTable (
//
if (Table[Index].Key == Key) {
StrnCpy (Info, Table[Index].Info, InfoLen-1);
StrCat (Info, L"\n");
StrnCat (Info, L"\n", InfoLen - StrLen(Info));
return Key;
}
}