/**\r
Set information about a file\r
\r
- @param File Protocol instance pointer.\r
+ @param This Protocol instance pointer.\r
@param InformationType Type of information in Buffer.\r
@param BufferSize Size of buffer.\r
@param Buffer The data to write.\r
return (Status);\r
}\r
\r
+/**\r
+ Determin if a file name represents a unicode file.\r
+\r
+ @param[in] FileName Pointer to the filename to open.\r
+\r
+ @retval EFI_SUCCESS The file is a unicode file.\r
+ @return An error upon failure.\r
+**/\r
EFI_STATUS\r
EFIAPI\r
IsUnicodeFile(\r
to prevent invalid answers to question.\r
@param[in] HiiFormatStringId The format string Id for getting from Hii.\r
@param[in] HiiFormatHandle The format string Handle for getting from Hii.\r
- @param[out] Response The pointer to Response, which will be populated upon return.\r
+ @param[in,out] Response The pointer to Response, which will be populated upon return.\r
\r
@retval EFI_SUCCESS The operation was sucessful.\r
@return other The operation failed.\r
#ifndef __SHELL_BASE__\r
#define __SHELL_BASE__\r
\r
-#define ABS(a) (a<0)?(-(a)):(a)\r
+#define ABS(a) ((a<0)?(-(a)):(a))\r
\r
typedef VOID *SHELL_FILE_HANDLE;\r
\r
}\r
\r
/**\r
- Initialize String Info Log data structures\r
-\r
+ Initialize String Info Log data structures.\r
**/\r
VOID\r
EFIAPI\r
}\r
\r
/**\r
- Outputs the code length array for Char&Length Set\r
-\r
+ Outputs the code length array for Char&Length Set.\r
**/\r
VOID\r
EFIAPI\r
CurrentLine = FileBuffer.CurrentLine;\r
Line = MoveLine (FRow - FileBuffer.FilePosition.Row);\r
\r
- if (FColumn > Line->Size) {\r
+ if (Line == NULL || FColumn > Line->Size) {\r
HasCharacter = FALSE;\r
}\r
\r
Change a Unicode string to an ASCII string.\r
\r
@param[in] UStr The Unicode string.\r
- @param[in] Lenght The maximum size of AStr.\r
+ @param[in] Length The maximum size of AStr.\r
@param[out] AStr ASCII string to pass out.\r
\r
@return The actuall length.\r
UINTN\r
EFIAPI\r
UnicodeToAscii (\r
- IN CONST CHAR16 *UStr,\r
- IN CONST UINTN Length,\r
- OUT CHAR8 *AStr\r
+ IN CONST CHAR16 *UStr,\r
+ IN CONST UINTN Length,\r
+ OUT CHAR8 *AStr\r
)\r
{\r
UINTN Index;\r
//\r
// now everything is ready , you can set the new file name to filebuffer\r
//\r
- if (StrCmp (FileName, FileBuffer.FileName) != 0) {\r
+ if (FileName != NULL && FileBuffer.FileName != NULL && StrCmp (FileName, FileBuffer.FileName) != 0) {\r
//\r
// not the same\r
//\r
VOID\r
);\r
\r
-/*\r
+/**\r
search string in file buffer, and replace it with another str\r
\r
@retval EFI_SUCCESS The operation was successful.\r
return EFI_SUCCESS;\r
}\r
\r
-/*\r
- search string in file buffer, and replace it with another str\r
+/**\r
+ Search string in file buffer, and replace it with another str.\r
\r
@retval EFI_SUCCESS The operation was successful.\r
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r
@retval EFI_SUCCESS The operation was successful.\r
@retval EFI_NOT_FOUND There was no mouse support found.\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
MainEditorHandleMouseInput (\r
HBufferImageInit (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
+/**
Initialization function for HBufferImage\r
\r
-Arguments: \r
+ \r
\r
None\r
\r
-Returns: \r
+ \r
\r
EFI_SUCCESS\r
EFI_LOAD_ERROR\r
\r
---*/\r
+**/\r
{\r
EFI_STATUS Status;\r
\r
HBufferImageBackup (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
+/**
Backup function for HBufferImage\r
Only a few fields need to be backup. \r
This is for making the file buffer refresh \r
as few as possible.\r
\r
-Arguments: \r
+ \r
\r
None\r
\r
-Returns: \r
+ \r
\r
EFI_SUCCESS\r
\r
---*/\r
+**/\r
{\r
HBufferImageBackupVar.MousePosition = HBufferImage.MousePosition;\r
\r
HBufferImageFreeLines (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
+/**
Free all the lines in HBufferImage\r
Fields affected:\r
Lines\r
NumLines\r
ListHead \r
\r
-Arguments: \r
+ \r
\r
None\r
\r
-Returns: \r
+ \r
\r
EFI_SUCCESS\r
\r
---*/\r
+**/\r
{\r
HFreeLines (HBufferImage.ListHead, HBufferImage.Lines);\r
\r
HBufferImageCleanup (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
+/**
Cleanup function for HBufferImage\r
\r
-Arguments: \r
+ \r
\r
None\r
\r
-Returns: \r
+ \r
\r
EFI_SUCCESS\r
\r
---*/\r
+**/\r
{\r
EFI_STATUS Status;\r
\r
IN HEFI_EDITOR_COLOR_UNION New\r
\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
+/**
Print Line on Row\r
\r
-Arguments: \r
+ \r
\r
Line - Line to print\r
Row - Row on screen ( begin from 1 )\r
Orig - Orig\r
New - Light display\r
\r
-Returns: \r
+ \r
\r
EFI_SUCCESS\r
\r
---*/\r
+**/\r
{\r
\r
UINTN Index;\r
CurrentLine = HBufferImage.CurrentLine;\r
Line = HMoveLine (FRow - HBufferImage.BufferPosition.Row);\r
\r
- if (FColumn > Line->Size) {\r
+ if (Line == NULL || FColumn > Line->Size) {\r
HasCharacter = FALSE;\r
}\r
\r
HBufferImageRestorePosition (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
+/**
Set cursor position according to HBufferImage.DisplayPosition.\r
\r
-Arguments: \r
+ \r
\r
None\r
\r
-Returns: \r
+ \r
\r
EFI_SUCCESS\r
\r
---*/\r
+**/\r
{\r
//\r
// set cursor position\r
return EFI_SUCCESS;\r
}\r
\r
+/**
+ Refresh function for HBufferImage.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_LOAD_ERROR A Load error occured.\r
+\r
+**/\r
EFI_STATUS\r
HBufferImageRefresh (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Refresh function for HBufferImage\r
-\r
-Arguments: \r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
- EFI_LOAD_ERROR \r
-\r
---*/\r
{\r
LIST_ENTRY *Link;\r
HEFI_EDITOR_LINE *Line;\r
// no definite required refresh\r
// and file position displayed on screen has not been changed\r
//\r
- if (HBufferImageNeedRefresh == FALSE &&\r
- HBufferImageOnlyLineNeedRefresh == FALSE &&\r
+ if (!HBufferImageNeedRefresh &&\r
+ !HBufferImageOnlyLineNeedRefresh &&\r
HBufferImageBackupVar.LowVisibleRow == HBufferImage.LowVisibleRow\r
) {\r
HBufferImageRestoreMousePosition ();\r
//\r
// only need to refresh current line\r
//\r
- if (HBufferImageOnlyLineNeedRefresh == TRUE && HBufferImageBackupVar.LowVisibleRow == HBufferImage.LowVisibleRow) {\r
+ if (HBufferImageOnlyLineNeedRefresh && HBufferImageBackupVar.LowVisibleRow == HBufferImage.LowVisibleRow) {\r
\r
HBufferImagePrintLine (\r
HBufferImage.CurrentLine,\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Read an image into a buffer friom a source.\r
+\r
+ @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.\r
+ @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
+ @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
+ @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
+ @param[in] MemoryOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.\r
+ @param[in] MemorySize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.\r
+ @param[in] BufferType The type of buffer to save. IGNORED.\r
+ @param[in] Recover TRUE for recovermode, FALSE otherwise.\r
+\r
+ @return EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
+EFIAPI\r
HBufferImageRead (\r
IN CONST CHAR16 *FileName,\r
IN CONST CHAR16 *DiskName,\r
return Status;\r
}\r
\r
+/**\r
+ Save the current image.\r
+\r
+ @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.\r
+ @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
+ @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
+ @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
+ @param[in] MemoryOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.\r
+ @param[in] MemorySize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.\r
+ @param[in] BufferType The type of buffer to save. IGNORED.\r
+\r
+ @return EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImageSave (\r
IN CHAR16 *FileName,\r
return Status;\r
}\r
\r
-HEFI_EDITOR_LINE *\r
-HBufferImageCreateLine (\r
- VOID\r
- )\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Create a new line and append it to the line list\r
+/**
+ Create a new line and append it to the line list.\r
Fields affected:\r
NumLines\r
Lines \r
\r
-Arguments: \r
+ @retval NULL create line failed.\r
+ @return the line created.\r
\r
- None\r
-\r
-Returns: \r
-\r
- NULL -- create line failed\r
- Not NULL -- the line created\r
-\r
---*/\r
+**/\r
+HEFI_EDITOR_LINE *\r
+HBufferImageCreateLine (\r
+ VOID\r
+ )\r
{\r
HEFI_EDITOR_LINE *Line;\r
\r
return Line;\r
}\r
\r
+/**
+ Free the current image.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImageFree (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Function called when load a new file in. It will free all the old lines\r
- and set FileModified field to FALSE\r
-\r
-Arguments: \r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
{\r
//\r
// free all lines\r
return EFI_SUCCESS;\r
}\r
\r
+/**
+ Dispatch input to different handler\r
+\r
+ @param[in] Key The input key:\r
+ the keys can be:\r
+ ASCII KEY\r
+ Backspace/Delete\r
+ Direction key: up/down/left/right/pgup/pgdn\r
+ Home/End\r
+ INS\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_LOAD_ERROR A load error occured.\r
+ @retval EFI_OUT_OF_RESOURCES A Memory allocation failed.\r
+**/\r
EFI_STATUS\r
HBufferImageHandleInput (\r
IN EFI_INPUT_KEY *Key\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Dispatch input to different handler\r
-\r
-Arguments: \r
-\r
- Key -- input key\r
- the keys can be:\r
- ASCII KEY\r
- Backspace/Delete\r
- Direction key: up/down/left/right/pgup/pgdn\r
- Home/End\r
- INS\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
- EFI_LOAD_ERROR\r
- EFI_OUT_OF_RESOURCES\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
\r
return Status;\r
}\r
\r
+/**
+ ASCII key + Backspace + return.\r
+\r
+ @param[in] Char The input char.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_LOAD_ERROR A load error occured.\r
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r
+**/\r
EFI_STATUS\r
+EFIAPI\r
HBufferImageDoCharInput (\r
IN CHAR16 Char\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- ASCII key + Backspace + return\r
-\r
-Arguments: \r
-\r
- Char -- input char\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
- EFI_LOAD_ERROR\r
- EFI_OUT_OF_RESOURCES\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
\r
return Status;\r
}\r
\r
+/**\r
+ change char to int value based on Hex.\r
+\r
+ @param[in] Char The input char.\r
+\r
+ @return The character's index value.\r
+ @retval -1 The operation failed.\r
+**/\r
INTN\r
+EFIAPI\r
HBufferImageCharToHex (\r
IN CHAR16 Char\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- change char to int value based on Hex\r
-\r
-Arguments: \r
-\r
- Char -- input char\r
-\r
-Returns: \r
-\r
- int value;\r
-\r
-\r
---*/\r
{\r
//\r
// change the character to hex\r
return -1;\r
}\r
\r
+/**\r
+ Add character.\r
+\r
+ @param[in] Char -- input char.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r
+**/\r
EFI_STATUS\r
+EFIAPI\r
HBufferImageAddChar (\r
IN CHAR16 Char\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Add character\r
-\r
-Arguments: \r
-\r
- Char -- input char\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
- EFI_OUT_OF_RESOURCES\r
-\r
---*/\r
{\r
HEFI_EDITOR_LINE *Line;\r
HEFI_EDITOR_LINE *NewLine;\r
// at the low 4 bits of the last character of a full line\r
// so if no next line, need to create a new line\r
//\r
- if (High == FALSE && FCol == 0x10) {\r
+ if (!High && FCol == 0x10) {\r
\r
HBufferImageOnlyLineNeedRefresh = FALSE;\r
HBufferImageNeedRefresh = TRUE;\r
//\r
// if already at end of this line, scroll it to the start of next line\r
//\r
- if (FCol == 0x10 && High == FALSE) {\r
+ if (FCol == 0x10 && !High) {\r
//\r
// definitely has next line\r
//\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Check user specified FileRow and FileCol is in current screen.\r
+\r
+ @param[in] FileRow Row of file position ( start from 1 ).\r
+\r
+ @retval TRUE It's on the current screen.\r
+ @retval FALSE It's not on the current screen.\r
+**/\r
BOOLEAN\r
HInCurrentScreen (\r
IN UINTN FileRow\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Check user specified FileRow and FileCol is in current screen\r
-\r
-Arguments: \r
-\r
- FileRow -- Row of file position ( start from 1 )\r
-\r
-\r
-Returns: \r
-\r
- TRUE\r
- FALSE\r
-\r
---*/\r
{\r
if (FileRow >= HBufferImage.LowVisibleRow && FileRow <= HBufferImage.LowVisibleRow + (HMainEditor.ScreenSize.Row - 5) - 1) {\r
return TRUE;\r
return FALSE;\r
}\r
\r
+/**\r
+ Check user specified FileRow is above current screen.\r
+\r
+ @param[in] FileRow Row of file position ( start from 1 ).\r
+ \r
+ @retval TRUE It is above the current screen.\r
+ @retval FALSE It is not above the current screen.\r
+\r
+**/\r
BOOLEAN\r
HAboveCurrentScreen (\r
IN UINTN FileRow\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Check user specified FileRow is above current screen\r
-\r
-Arguments: \r
-\r
- FileRow -- Row of file position ( start from 1 )\r
- \r
-Returns: \r
-\r
- TRUE\r
- FALSE\r
-\r
---*/\r
{\r
if (FileRow < HBufferImage.LowVisibleRow) {\r
return TRUE;\r
return FALSE;\r
}\r
\r
+/**\r
+ Check user specified FileRow is under current screen.\r
+\r
+ @param[in] FileRow Row of file position ( start from 1 ).\r
+\r
+ @retval TRUE It is under the current screen.\r
+ @retval FALSE It is not under the current screen.\r
+\r
+**/\r
BOOLEAN\r
HUnderCurrentScreen (\r
IN UINTN FileRow\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Check user specified FileRow is under current screen\r
-\r
-Arguments: \r
-\r
- FileRow -- Row of file position ( start from 1 )\r
-\r
-Returns: \r
-\r
- TRUE\r
- FALSE\r
-\r
---*/\r
{\r
if (FileRow > HBufferImage.LowVisibleRow + (HMainEditor.ScreenSize.Row - 5) - 1) {\r
return TRUE;\r
return FALSE;\r
}\r
\r
+/**\r
+ According to cursor's file position, adjust screen display.\r
+\r
+ @param[in] NewFilePosRow Row of file position ( start from 1 ).\r
+ @param[in] NewFilePosCol Column of file position ( start from 1 ).\r
+ @param[in] HighBits Cursor will on high4 bits or low4 bits.\r
+**/\r
VOID\r
HBufferImageMovePosition (\r
IN UINTN NewFilePosRow,\r
IN UINTN NewFilePosCol,\r
IN BOOLEAN HighBits\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- According to cursor's file position, adjust screen display\r
\r
-Arguments: \r
-\r
- NewFilePosRow -- Row of file position ( start from 1 )\r
- NewFilePosCol -- Column of file position ( start from 1 ) \r
- HighBits -- cursor will on high4 bits or low4 bits\r
-\r
-Returns: \r
-\r
- None\r
-\r
---*/\r
{\r
INTN RowGap;\r
UINTN Abs;\r
NewDisplayCol++;\r
}\r
\r
- if (HighBits == FALSE) {\r
+ if (!HighBits) {\r
NewDisplayCol++;\r
}\r
\r
\r
}\r
\r
+/**\r
+ Scroll cursor to right.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImageScrollRight (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Scroll cursor to right\r
-\r
-Arguments: \r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
{\r
HEFI_EDITOR_LINE *Line;\r
UINTN FRow;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Scroll cursor to left.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImageScrollLeft (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Scroll cursor to left\r
-\r
-Arguments: \r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
{\r
\r
HEFI_EDITOR_LINE *Line;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Scroll cursor to the next line\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImageScrollDown (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Scroll cursor to the next line\r
-\r
-Arguments: \r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
{\r
HEFI_EDITOR_LINE *Line;\r
UINTN FRow;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Scroll cursor to previous line\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImageScrollUp (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Scroll cursor to previous line\r
-\r
-Arguments: \r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
{\r
HEFI_EDITOR_LINE *Line;\r
UINTN FRow;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Scroll cursor to next page\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImagePageDown (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Scroll cursor to next page\r
-\r
-Arguments: \r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
{\r
HEFI_EDITOR_LINE *Line;\r
UINTN FRow;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Scroll cursor to previous page\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImagePageUp (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Scroll cursor to previous page\r
-\r
-Arguments: \r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
{\r
HEFI_EDITOR_LINE *Line;\r
UINTN FRow;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Scroll cursor to start of line\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImageHome (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Scroll cursor to start of line\r
-\r
-Arguments: \r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
{\r
HEFI_EDITOR_LINE *Line;\r
UINTN FRow;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Scroll cursor to end of line.\r
+\r
+ @retval EFI_SUCCESS Teh operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImageEnd (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Scroll cursor to end of line\r
-\r
-Arguments: \r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
{\r
HEFI_EDITOR_LINE *Line;\r
UINTN FRow;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Get the size of the open buffer.\r
+\r
+ @retval The size in bytes.\r
+**/\r
UINTN\r
HBufferImageGetTotalSize (\r
VOID\r
return Size;\r
}\r
\r
+/**\r
+ Delete character from buffer.\r
+ \r
+ @param[in] Pos Position, Pos starting from 0.\r
+ @param[in] Count The Count of characters to delete.\r
+ @param[OUT] DeleteBuffer The DeleteBuffer.\r
+\r
+ @retval EFI_SUCCESS Success \r
+**/\r
EFI_STATUS\r
HBufferImageDeleteCharacterFromBuffer (\r
IN UINTN Pos,\r
IN UINTN Count,\r
OUT UINT8 *DeleteBuffer\r
)\r
-/*++\r
-Routine Description:\r
-\r
- Delete character from buffer\r
- \r
-Arguments:\r
-\r
- Pos - Position, Pos starting from 0\r
- Count - Count\r
- DeleteBuffer - DeleteBuffer\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS Success\r
- \r
---*/\r
{\r
UINTN Index;\r
\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Add character to buffer, add before pos.\r
+\r
+ @param[in] Pos Position, Pos starting from 0.\r
+ @param[in] Count Count of characters to add.\r
+ @param[in] AddBuffer Add buffer.\r
+\r
+ @retval EFI_SUCCESS Success. \r
+**/\r
EFI_STATUS\r
HBufferImageAddCharacterToBuffer (\r
IN UINTN Pos,\r
IN UINTN Count,\r
IN UINT8 *AddBuffer\r
)\r
-/*++'\r
-Routine Description:\r
-\r
- Add character to buffer, add before pos\r
-\r
-Arguments:\r
-\r
- Pos - Position, Pos starting from 0\r
- Count - Count\r
- AddBuffer - Add buffer\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS Success\r
- \r
---*/\r
{\r
INTN Index;\r
\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Delete the previous character.\r
+\r
+ @retval EFI_SUCCESS The operationw as successful.\r
+**/\r
EFI_STATUS\r
+EFIAPI\r
HBufferImageDoBackspace (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- delete the previous character\r
-\r
-Arguments: \r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
{\r
HEFI_EDITOR_LINE *Line;\r
\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Delete current character from line.\r
+\r
+ @retval EFI_SUCCESS The operationw as successful.\r
+**/\r
EFI_STATUS\r
+EFIAPI\r
HBufferImageDoDelete (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Delete current character from line\r
-\r
-Arguments: \r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
{\r
\r
HEFI_EDITOR_LINE *Line;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Change the raw buffer to a list of lines for the UI.\r
+ \r
+ @param[in] Buffer The pointer to the buffer to fill.\r
+ @param[in] Bytes The size of the buffer in bytes.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r
+**/\r
EFI_STATUS\r
+EFIAPI\r
HBufferImageBufferToList (\r
IN VOID *Buffer,\r
IN UINTN Bytes\r
)\r
{\r
- UINTN i;\r
- UINTN j;\r
+ UINTN TempI;\r
+ UINTN TempJ;\r
UINTN Left;\r
HEFI_EDITOR_LINE *Line;\r
UINT8 *BufferPtr;\r
\r
- i = 0;\r
+ TempI = 0;\r
Left = 0;\r
BufferPtr = (UINT8 *) Buffer;\r
\r
//\r
// parse file content line by line\r
//\r
- while (i < Bytes) {\r
- if (Bytes - i >= 0x10) {\r
+ while (TempI < Bytes) {\r
+ if (Bytes - TempI >= 0x10) {\r
Left = 0x10;\r
} else {\r
- Left = Bytes - i;\r
+ Left = Bytes - TempI;\r
}\r
\r
//\r
\r
Line->Size = Left;\r
\r
- for (j = 0; j < Left; j++) {\r
- Line->Buffer[j] = BufferPtr[i];\r
- i++;\r
+ for (TempJ = 0; TempJ < Left; TempJ++) {\r
+ Line->Buffer[TempJ] = BufferPtr[TempI];\r
+ TempI++;\r
}\r
\r
}\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Change the list of lines from the UI to a raw buffer.\r
+ \r
+ @param[in] Buffer The pointer to the buffer to fill.\r
+ @param[in] Bytes The size of the buffer in bytes.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
+EFIAPI\r
HBufferImageListToBuffer (\r
IN VOID *Buffer,\r
IN UINTN Bytes\r
\r
Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);\r
\r
+ //@todo shouldn't this be an error???\r
if (Count + Line->Size > Bytes) {\r
return EFI_SUCCESS;\r
}\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Move the mouse in the image buffer.\r
+\r
+ @param[in] TextX The x-coordinate.\r
+ @param[in] TextY The y-coordinate.\r
+**/\r
VOID\r
+EFIAPI\r
HBufferImageAdjustMousePosition (\r
IN INT32 TextX,\r
IN INT32 TextY\r
)\r
{\r
- UINTN X;\r
- UINTN Y;\r
+ UINTN TempX;\r
+ UINTN TempY;\r
UINTN AbsX;\r
UINTN AbsY;\r
\r
// This function will change it to MousePosition\r
//\r
//\r
- // get absolute X value\r
+ // get absolute TempX value\r
//\r
if (TextX >= 0) {\r
AbsX = TextX;\r
AbsX = -TextX;\r
}\r
//\r
- // get absolute Y value\r
+ // get absolute TempY value\r
//\r
if (TextY >= 0) {\r
AbsY = TextY;\r
AbsY = -TextY;\r
}\r
\r
- X = HBufferImage.MousePosition.Column;\r
- Y = HBufferImage.MousePosition.Row;\r
+ TempX = HBufferImage.MousePosition.Column;\r
+ TempY = HBufferImage.MousePosition.Row;\r
\r
if (TextX >= 0) {\r
- X += TextX;\r
+ TempX += TextX;\r
} else {\r
- if (X >= AbsX) {\r
- X -= AbsX;\r
+ if (TempX >= AbsX) {\r
+ TempX -= AbsX;\r
} else {\r
- X = 0;\r
+ TempX = 0;\r
}\r
}\r
\r
if (TextY >= 0) {\r
- Y += TextY;\r
+ TempY += TextY;\r
} else {\r
- if (Y >= AbsY) {\r
- Y -= AbsY;\r
+ if (TempY >= AbsY) {\r
+ TempY -= AbsY;\r
} else {\r
- Y = 0;\r
+ TempY = 0;\r
}\r
}\r
//\r
// check whether new mouse column position is beyond screen\r
// if not, adjust it\r
//\r
- if (X >= 10 && X <= (10 + 0x10 * 3 - 1)) {\r
- HBufferImage.MousePosition.Column = X;\r
- } else if (X < 10) {\r
+ if (TempX >= 10 && TempX <= (10 + 0x10 * 3 - 1)) {\r
+ HBufferImage.MousePosition.Column = TempX;\r
+ } else if (TempX < 10) {\r
HBufferImage.MousePosition.Column = 10;\r
- } else if (X > (10 + 0x10 * 3 - 1)) {\r
+ } else if (TempX > (10 + 0x10 * 3 - 1)) {\r
HBufferImage.MousePosition.Column = 10 + 0x10 * 3 - 1;\r
}\r
//\r
// check whether new mouse row position is beyond screen\r
// if not, adjust it\r
//\r
- if (Y >= 2 && Y <= (HMainEditor.ScreenSize.Row - 4)) {\r
- HBufferImage.MousePosition.Row = Y;\r
- } else if (Y < 2) {\r
+ if (TempY >= 2 && TempY <= (HMainEditor.ScreenSize.Row - 4)) {\r
+ HBufferImage.MousePosition.Row = TempY;\r
+ } else if (TempY < 2) {\r
HBufferImage.MousePosition.Row = 2;\r
- } else if (Y > (HMainEditor.ScreenSize.Row - 4)) {\r
+ } else if (TempY > (HMainEditor.ScreenSize.Row - 4)) {\r
HBufferImage.MousePosition.Row = (HMainEditor.ScreenSize.Row - 4);\r
}\r
\r
UINTN\r
);\r
\r
+/**
+ Free the current image.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImageFree (\r
VOID\r
- ) ;\r
+ );\r
\r
EFI_STATUS\r
HBufferImageDeleteCharacterFromBuffer (\r
//\r
// now everything is ready , you can set the new file name to filebuffer\r
//\r
- if (BufferTypeBackup != FileTypeFileBuffer || StringNoCaseCompare (&FileName, &HFileImage.FileName) != 0) {\r
+ if ((BufferTypeBackup != FileTypeFileBuffer && FileName != NULL) ||\r
+ (FileName != NULL && HFileImage.FileName != NULL && StringNoCaseCompare (&FileName, &HFileImage.FileName) != 0)){\r
//\r
// not the same\r
//\r
Size = ShellStrToUintn(ShellCommandLineGetRawValue(Package, 2));\r
}\r
}\r
- if (WhatToDo == FileTypeNone && ShellCommandLineGetRawValue(Package, 1) != NULL) {\r
- Name = ShellCommandLineGetRawValue(Package, 1);\r
+ Name = ShellCommandLineGetRawValue(Package, 1);\r
+ if (WhatToDo == FileTypeNone && Name != NULL) {\r
if (!IsValidFileName(Name)) {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Name);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
|| ReadChange ) {\r
\r
MainTitleBarRefresh (\r
- HMainEditor.BufferImage->BufferType == FileTypeFileBuffer?HMainEditor.BufferImage->FileImage->FileName:HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Name:NULL,\r
+ 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,\r
HMainEditor.BufferImage->BufferType,\r
- HMainEditor.BufferImage->FileImage->ReadOnly,\r
+ (BOOLEAN)(HMainEditor.BufferImage->FileImage!=NULL?HMainEditor.BufferImage->FileImage->ReadOnly:FALSE),\r
HMainEditor.BufferImage->Modified,\r
HMainEditor.ScreenSize.Column,\r
HMainEditor.ScreenSize.Row,\r
//\r
if (High > Low && Key >= Low && Key <= High) {\r
StrnCpy (Info, Table[Index].Info, InfoLen-1);\r
- StrCat (Info, L"\n");\r
+ StrnCat (Info, L"\n", InfoLen - StrLen(Info));\r
return Key;\r
}\r
//\r
//\r
if (Table[Index].Key == Key) {\r
StrnCpy (Info, Table[Index].Info, InfoLen-1);\r
- StrCat (Info, L"\n");\r
+ StrnCat (Info, L"\n", InfoLen - StrLen(Info));\r
return Key;\r
}\r
}\r
{\r
EFI_STATUS Status;\r
BOOLEAN Found;\r
+ SCRIPT_FILE *CurrentScriptFile;\r
\r
Status = CommandInit();\r
ASSERT_EFI_ERROR(Status);\r
Found = MoveToTag(GetPreviousNode, L"for", L"endfor", NULL, ShellCommandGetCurrentScriptFile(), FALSE, FALSE, FALSE);\r
\r
if (!Found) {\r
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile();\r
ShellPrintHiiEx(\r
-1, \r
-1, \r
gShellLevel1HiiHandle, \r
L"For", \r
L"EndFor", \r
- ShellCommandGetCurrentScriptFile()!=NULL\r
- &&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL\r
- ?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);\r
+ CurrentScriptFile!=NULL\r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
return (SHELL_NOT_FOUND);\r
}\r
return (SHELL_SUCCESS);\r
Info->CurrentValue = NULL;\r
ArgSetWalker = ArgSet;\r
if (ArgSetWalker[0] != L'(') {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);\r
+ ShellPrintHiiEx(\r
+ -1, \r
+ -1, \r
+ NULL, \r
+ STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), \r
+ gShellLevel1HiiHandle, \r
+ ArgSet, \r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
TempSpot = StrStr(ArgSetWalker, L")");\r
}\r
}\r
if (TempSpot == NULL) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);\r
+ ShellPrintHiiEx(\r
+ -1, \r
+ -1, \r
+ NULL, \r
+ STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), \r
+ gShellLevel1HiiHandle, \r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
*TempSpot = CHAR_NULL;\r
ArgSetWalker++;\r
}\r
if (!ShellIsValidForNumber(ArgSetWalker)) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);\r
+ ShellPrintHiiEx(\r
+ -1, \r
+ -1, \r
+ NULL, \r
+ STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), \r
+ gShellLevel1HiiHandle, \r
+ ArgSet, \r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
if (ArgSetWalker[0] == L'-') {\r
ArgSetWalker++;\r
}\r
if (ArgSetWalker == NULL || *ArgSetWalker == CHAR_NULL || !ShellIsValidForNumber(ArgSetWalker)){\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);\r
+ ShellPrintHiiEx(\r
+ -1, \r
+ -1, \r
+ NULL, \r
+ STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), \r
+ gShellLevel1HiiHandle, \r
+ ArgSet, \r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
if (ArgSetWalker[0] == L'-') {\r
}\r
if (ArgSetWalker != NULL && *ArgSetWalker != CHAR_NULL) {\r
if (ArgSetWalker == NULL || *ArgSetWalker == CHAR_NULL || !ShellIsValidForNumber(ArgSetWalker)){\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);\r
+ ShellPrintHiiEx(\r
+ -1, \r
+ -1, \r
+ NULL, \r
+ STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), \r
+ gShellLevel1HiiHandle, \r
+ ArgSet, \r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
if (*ArgSetWalker == L')') {\r
}\r
\r
if (StrStr(ArgSetWalker, L" ") != NULL) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);\r
+ ShellPrintHiiEx(\r
+ -1, \r
+ -1, \r
+ NULL, \r
+ STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), \r
+ gShellLevel1HiiHandle, \r
+ ArgSet, \r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
}\r
}\r
}\r
CurrentScriptFile->CurrentCommand->Data = Info;\r
} else {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);\r
+ ShellPrintHiiEx(\r
+ -1, \r
+ -1, \r
+ NULL, \r
+ STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), \r
+ gShellLevel1HiiHandle, \r
+ ArgSet, \r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
}\r
} else {\r
// find the matching endfor (we're done with the loop)\r
//\r
if (!MoveToTag(GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, FALSE, FALSE)) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_NO_MATCHING), gShellLevel1HiiHandle, L"EndFor", L"For", ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);\r
+ ShellPrintHiiEx(\r
+ -1, \r
+ -1, \r
+ NULL, \r
+ STRING_TOKEN (STR_SYNTAX_NO_MATCHING), \r
+ gShellLevel1HiiHandle, \r
+ L"EndFor", \r
+ L"For", \r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
ShellStatus = SHELL_DEVICE_ERROR;\r
}\r
if (Info->RemoveSubstAlias) {\r
// find the matching endfor (we're done with the loop)\r
//\r
if (!MoveToTag(GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, FALSE, FALSE)) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_NO_MATCHING), gShellLevel1HiiHandle, L"EndFor", L"For", ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);\r
+ ShellPrintHiiEx(\r
+ -1, \r
+ -1, \r
+ NULL, \r
+ STRING_TOKEN (STR_SYNTAX_NO_MATCHING), \r
+ gShellLevel1HiiHandle, \r
+ L"EndFor", \r
+ L"For", \r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
ShellStatus = SHELL_DEVICE_ERROR;\r
}\r
if (Info->RemoveSubstAlias) {\r
SHELL_STATUS ShellStatus;\r
CHAR16 *CompareString;\r
UINTN Size;\r
+ SCRIPT_FILE *CurrentScriptFile;\r
\r
ShellStatus = SHELL_SUCCESS;\r
CompareString = NULL;\r
// Check forwards and then backwards for a label...\r
//\r
if (!MoveToTag(GetNextNode, L"endfor", L"for", CompareString, ShellCommandGetCurrentScriptFile(), FALSE, FALSE, TRUE)) {\r
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile();\r
ShellPrintHiiEx(\r
-1, \r
-1, \r
gShellLevel1HiiHandle, \r
CompareString, \r
L"Goto", \r
- ShellCommandGetCurrentScriptFile()!=NULL\r
- &&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL\r
- ?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);\r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
ShellStatus = SHELL_NOT_FOUND;\r
}\r
FreePool(CompareString);\r
BOOLEAN CurrentValue;\r
END_TAG_TYPE Ending;\r
END_TAG_TYPE PreviousEnding;\r
-\r
+ SCRIPT_FILE *CurrentScriptFile;\r
\r
Status = CommandInit();\r
ASSERT_EFI_ERROR(Status);\r
//\r
// Make sure that an End exists.\r
//\r
- if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, ShellCommandGetCurrentScriptFile(), TRUE, TRUE, FALSE)) {\r
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile();\r
+ if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, CurrentScriptFile, TRUE, TRUE, FALSE)) {\r
ShellPrintHiiEx(\r
-1, \r
-1, \r
gShellLevel1HiiHandle, \r
L"EnfIf", \r
L"If", \r
- ShellCommandGetCurrentScriptFile()!=NULL\r
- &&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL\r
- ?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);\r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
return (SHELL_DEVICE_ERROR);\r
}\r
\r
// build up the next statement for analysis\r
//\r
if (!BuildNextStatement(CurrentParameter, &EndParameter, &Ending)) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_NO_MATCHING), gShellLevel1HiiHandle, L"Then", L"If", ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);\r
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile();\r
+ ShellPrintHiiEx(\r
+ -1, \r
+ -1, \r
+ NULL, \r
+ STRING_TOKEN (STR_SYNTAX_NO_MATCHING), \r
+ gShellLevel1HiiHandle, \r
+ L"Then", \r
+ L"If",\r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
//\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
+ SCRIPT_FILE *CurrentScriptFile;\r
ASSERT_EFI_ERROR(CommandInit());\r
\r
if (gEfiShellParametersProtocol->Argc > 1) {\r
return (SHELL_UNSUPPORTED);\r
}\r
\r
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile();\r
\r
- if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, ShellCommandGetCurrentScriptFile(), FALSE, TRUE, FALSE)) {\r
+ if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {\r
ShellPrintHiiEx(\r
-1, \r
-1, \r
gShellLevel1HiiHandle, \r
L"If", \r
L"Else", \r
- ShellCommandGetCurrentScriptFile()!=NULL\r
- &&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL\r
- ?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);\r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
return (SHELL_DEVICE_ERROR);\r
}\r
- if (!MoveToTag(GetPreviousNode, L"if", L"else", NULL, ShellCommandGetCurrentScriptFile(), FALSE, TRUE, FALSE)) {\r
+ if (!MoveToTag(GetPreviousNode, L"if", L"else", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {\r
ShellPrintHiiEx(\r
-1, \r
-1, \r
gShellLevel1HiiHandle, \r
L"If", \r
L"Else", \r
- ShellCommandGetCurrentScriptFile()!=NULL\r
- &&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL\r
- ?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);\r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
return (SHELL_DEVICE_ERROR);\r
}\r
\r
- if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, ShellCommandGetCurrentScriptFile(), FALSE, FALSE, FALSE)) {\r
+ if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, CurrentScriptFile, FALSE, FALSE, FALSE)) {\r
ShellPrintHiiEx(\r
-1, \r
-1, \r
gShellLevel1HiiHandle, \r
L"EndIf", \r
"Else", \r
- ShellCommandGetCurrentScriptFile()!=NULL\r
- &&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL\r
- ?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);\r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
return (SHELL_DEVICE_ERROR);\r
}\r
\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
+ SCRIPT_FILE *CurrentScriptFile;\r
ASSERT_EFI_ERROR(CommandInit());\r
\r
if (gEfiShellParametersProtocol->Argc > 1) {\r
return (SHELL_UNSUPPORTED);\r
}\r
\r
- if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, ShellCommandGetCurrentScriptFile(), FALSE, TRUE, FALSE)) {\r
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile();\r
+ if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {\r
ShellPrintHiiEx(\r
-1, \r
-1, \r
gShellLevel1HiiHandle, \r
L"If", \r
L"EndIf", \r
- ShellCommandGetCurrentScriptFile()!=NULL\r
- &&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL\r
- ?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);\r
+ CurrentScriptFile!=NULL \r
+ && CurrentScriptFile->CurrentCommand!=NULL\r
+ ? CurrentScriptFile->CurrentCommand->Line:0);\r
return (SHELL_DEVICE_ERROR);\r
}\r
\r
&BufferSize,\r
HandleBuffer);\r
}\r
- if (!EFI_ERROR(Status)) {\r
+ if (!EFI_ERROR(Status) && HandleBuffer != NULL) {\r
//\r
// Get the map name(s) for each one.\r
//\r
HandleVol(\r
IN CONST CHAR16 *Path,\r
IN CONST BOOLEAN Delete,\r
- IN CONST CHAR16 *Name\r
+ IN CONST CHAR16 *Name OPTIONAL\r
)\r
{\r
EFI_STATUS Status;\r
ShellStatus = SHELL_SUCCESS;\r
\r
if (\r
+ Name != NULL && (\r
StrStr(Name, L"%") != NULL ||\r
StrStr(Name, L"^") != NULL ||\r
StrStr(Name, L"*") != NULL ||\r
StrStr(Name, L">") != NULL ||\r
StrStr(Name, L"?") != NULL ||\r
StrStr(Name, L"/") != NULL ||\r
- StrStr(Name, L" ") != NULL\r
+ StrStr(Name, L" ") != NULL )\r
){\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, Name);\r
return (SHELL_INVALID_PARAMETER);\r
}\r
\r
gEfiShellProtocol->CloseFile(ShellFileHandle);\r
+ \r
+ ASSERT(SysInfo != NULL);\r
\r
//\r
// print VolumeInfo table\r
CHAR16 *FullPath;\r
CHAR16 *TempSpot;\r
UINTN Length;\r
+ CONST CHAR16 *NewName;\r
\r
Length = 0;\r
ProblemParam = NULL;\r
StrnCatGrow(&FullPath, &Length, PathName, 0);\r
StrnCatGrow(&FullPath, &Length, L":\\", 0);\r
DeleteMode = ShellCommandLineGetFlag(Package, L"-d");\r
+ NewName = ShellCommandLineGetValue(Package, L"-n");\r
if (DeleteMode && ShellCommandLineGetFlag(Package, L"-n")) {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel2HiiHandle);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
- } else if (ShellCommandLineGetFlag(Package, L"-n") && ShellCommandLineGetValue(Package, L"-n") == NULL) {\r
+ } else if (ShellCommandLineGetFlag(Package, L"-n") && NewName == NULL) {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"-n");\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
- } else if (ShellCommandLineGetValue(Package, L"-n") != NULL && StrLen(ShellCommandLineGetValue(Package, L"-n")) > 11) {\r
+ } else if (NewName != NULL && StrLen(NewName) > 11) {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"-n");\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else if (ShellStatus == SHELL_SUCCESS) {\r
ShellStatus = HandleVol(\r
FullPath,\r
DeleteMode,\r
- ShellCommandLineGetValue(Package, L"-n")\r
+ NewName\r
);\r
}\r
}\r
if (ConfigHdr != NULL) {\r
Length = StrLen (ConfigHdr);\r
} else {\r
- Length = 0;\r
+ ShellStatus = SHELL_OUT_OF_RESOURCES;\r
+ goto ON_EXIT;\r
}\r
ConfigResp = AllocateZeroPool ((Length + NIC_ITEM_CONFIG_SIZE * 2 + 100) * sizeof (CHAR16));\r
+ if (ConfigResp == NULL) {\r
+ ShellStatus = SHELL_OUT_OF_RESOURCES;\r
+ goto ON_EXIT;\r
+ }\r
if (ConfigHdr != NULL) {\r
StrCpy (ConfigResp, ConfigHdr);\r
}\r