Add more comments:
1) EDKII version safe string function is similar as the one C11.
2) If error is returned, the Destination is unmodified.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
/**\r
Returns the length of a Null-terminated Unicode string.\r
\r
/**\r
Returns the length of a Null-terminated Unicode string.\r
\r
+ This function is similar as strlen_s defined in C11.\r
+\r
If String is not aligned on a 16-bit boundary, then ASSERT().\r
\r
@param String A pointer to a Null-terminated Unicode string.\r
If String is not aligned on a 16-bit boundary, then ASSERT().\r
\r
@param String A pointer to a Null-terminated Unicode string.\r
Copies the string pointed to by Source (including the terminating null char)\r
to the array pointed to by Destination.\r
\r
Copies the string pointed to by Source (including the terminating null char)\r
to the array pointed to by Destination.\r
\r
+ This function is similar as strcpy_s defined in C11.\r
+\r
If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
Source to the array pointed to by Destination. If no null char is copied from\r
Source, then Destination[Length] is always set to null.\r
\r
Source to the array pointed to by Destination. If no null char is copied from\r
Source, then Destination[Length] is always set to null.\r
\r
+ This function is similar as strncpy_s defined in C11.\r
+\r
If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
Appends a copy of the string pointed to by Source (including the terminating\r
null char) to the end of the string pointed to by Destination.\r
\r
Appends a copy of the string pointed to by Source (including the terminating\r
null char) to the end of the string pointed to by Destination.\r
\r
+ This function is similar as strcat_s defined in C11.\r
+\r
If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
copied from Source, then Destination[StrLen(Destination) + Length] is always\r
set to null.\r
\r
copied from Source, then Destination[StrLen(Destination) + Length] is always\r
set to null.\r
\r
+ This function is similar as strncat_s defined in C11.\r
+\r
If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
/**\r
Returns the length of a Null-terminated Ascii string.\r
\r
/**\r
Returns the length of a Null-terminated Ascii string.\r
\r
+ This function is similar as strlen_s defined in C11.\r
+\r
@param String A pointer to a Null-terminated Ascii string.\r
@param MaxSize The maximum number of Destination Ascii\r
char, including terminating null char.\r
@param String A pointer to a Null-terminated Ascii string.\r
@param MaxSize The maximum number of Destination Ascii\r
char, including terminating null char.\r
Copies the string pointed to by Source (including the terminating null char)\r
to the array pointed to by Destination.\r
\r
Copies the string pointed to by Source (including the terminating null char)\r
to the array pointed to by Destination.\r
\r
+ This function is similar as strcpy_s defined in C11.\r
+\r
If an error would be returned, then the function will also ASSERT().\r
\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
Source to the array pointed to by Destination. If no null char is copied from\r
Source, then Destination[Length] is always set to null.\r
\r
Source to the array pointed to by Destination. If no null char is copied from\r
Source, then Destination[Length] is always set to null.\r
\r
+ This function is similar as strncpy_s defined in C11.\r
+\r
If an error would be returned, then the function will also ASSERT().\r
\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
Appends a copy of the string pointed to by Source (including the terminating\r
null char) to the end of the string pointed to by Destination.\r
\r
Appends a copy of the string pointed to by Source (including the terminating\r
null char) to the end of the string pointed to by Destination.\r
\r
+ This function is similar as strcat_s defined in C11.\r
+\r
If an error would be returned, then the function will also ASSERT().\r
\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
copied from Source, then Destination[StrLen(Destination) + Length] is always\r
set to null.\r
\r
copied from Source, then Destination[StrLen(Destination) + Length] is always\r
set to null.\r
\r
+ This function is similar as strncat_s defined in C11.\r
+\r
If an error would be returned, then the function will also ASSERT().\r
\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
/**\r
Returns the length of a Null-terminated Unicode string.\r
\r
/**\r
Returns the length of a Null-terminated Unicode string.\r
\r
+ This function is similar as strlen_s defined in C11.\r
+\r
If String is not aligned on a 16-bit boundary, then ASSERT().\r
\r
@param String A pointer to a Null-terminated Unicode string.\r
If String is not aligned on a 16-bit boundary, then ASSERT().\r
\r
@param String A pointer to a Null-terminated Unicode string.\r
Copies the string pointed to by Source (including the terminating null char)\r
to the array pointed to by Destination.\r
\r
Copies the string pointed to by Source (including the terminating null char)\r
to the array pointed to by Destination.\r
\r
+ This function is similar as strcpy_s defined in C11.\r
+\r
If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
Source to the array pointed to by Destination. If no null char is copied from\r
Source, then Destination[Length] is always set to null.\r
\r
Source to the array pointed to by Destination. If no null char is copied from\r
Source, then Destination[Length] is always set to null.\r
\r
+ This function is similar as strncpy_s defined in C11.\r
+\r
If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
Appends a copy of the string pointed to by Source (including the terminating\r
null char) to the end of the string pointed to by Destination.\r
\r
Appends a copy of the string pointed to by Source (including the terminating\r
null char) to the end of the string pointed to by Destination.\r
\r
+ This function is similar as strcat_s defined in C11.\r
+\r
If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
copied from Source, then Destination[StrLen(Destination) + Length] is always\r
set to null.\r
\r
copied from Source, then Destination[StrLen(Destination) + Length] is always\r
set to null.\r
\r
+ This function is similar as strncat_s defined in C11.\r
+\r
If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
If Source is not aligned on a 16-bit boundary, then ASSERT().\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Unicode string.\r
@param DestMax The maximum number of Destination Unicode\r
char, including terminating null char.\r
/**\r
Returns the length of a Null-terminated Ascii string.\r
\r
/**\r
Returns the length of a Null-terminated Ascii string.\r
\r
+ This function is similar as strlen_s defined in C11.\r
+\r
@param String A pointer to a Null-terminated Ascii string.\r
@param MaxSize The maximum number of Destination Ascii\r
char, including terminating null char.\r
@param String A pointer to a Null-terminated Ascii string.\r
@param MaxSize The maximum number of Destination Ascii\r
char, including terminating null char.\r
Copies the string pointed to by Source (including the terminating null char)\r
to the array pointed to by Destination.\r
\r
Copies the string pointed to by Source (including the terminating null char)\r
to the array pointed to by Destination.\r
\r
+ This function is similar as strcpy_s defined in C11.\r
+\r
If an error would be returned, then the function will also ASSERT().\r
\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
Source to the array pointed to by Destination. If no null char is copied from\r
Source, then Destination[Length] is always set to null.\r
\r
Source to the array pointed to by Destination. If no null char is copied from\r
Source, then Destination[Length] is always set to null.\r
\r
+ This function is similar as strncpy_s defined in C11.\r
+\r
If an error would be returned, then the function will also ASSERT().\r
\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
Appends a copy of the string pointed to by Source (including the terminating\r
null char) to the end of the string pointed to by Destination.\r
\r
Appends a copy of the string pointed to by Source (including the terminating\r
null char) to the end of the string pointed to by Destination.\r
\r
+ This function is similar as strcat_s defined in C11.\r
+\r
If an error would be returned, then the function will also ASSERT().\r
\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
copied from Source, then Destination[StrLen(Destination) + Length] is always\r
set to null.\r
\r
copied from Source, then Destination[StrLen(Destination) + Length] is always\r
set to null.\r
\r
+ This function is similar as strncat_s defined in C11.\r
+\r
If an error would be returned, then the function will also ASSERT().\r
\r
If an error would be returned, then the function will also ASSERT().\r
\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r
@param Destination A pointer to a Null-terminated Ascii string.\r
@param DestMax The maximum number of Destination Ascii\r
char, including terminating null char.\r