Rename Strncat to StrnAppend, use it instead of strncat.
Strncat() looks almost like strncat(), but it's completely different. Change
the name to reduce confusion.
Also fix a place where strncat() was misused anyway.
BUG=none
BRANCH=all
TEST=manual
sudo FEATURES=test emerge vboot_reference
FEATURES=test emerge-$BOARD vboot_reference
Change-Id: I39c30d391aa6566ec67461462e800720ade66a91
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44572
diff --git a/cgpt/cgpt_add.c b/cgpt/cgpt_add.c
index ada323e..9a966ba 100644
--- a/cgpt/cgpt_add.c
+++ b/cgpt/cgpt_add.c
@@ -8,7 +8,8 @@
#include "cgptlib_internal.h"
#include "cgpt_params.h"
-
+#define _STUB_IMPLEMENTATION_
+#include "utility.h"
static const char* DumpCgptAddParams(const CgptAddParams *params) {
static char buf[256];
@@ -16,49 +17,49 @@
buf[0] = 0;
snprintf(tmp, sizeof(tmp), "-i %d ", params->partition);
- strncat(buf, tmp, sizeof(buf));
+ StrnAppend(buf, tmp, sizeof(buf));
if (params->label) {
snprintf(tmp, sizeof(tmp), "-l %s ", params->label);
- strncat(buf, tmp, sizeof(buf));
+ StrnAppend(buf, tmp, sizeof(buf));
}
if (params->set_begin) {
snprintf(tmp, sizeof(tmp), "-b %llu ", (unsigned long long)params->begin);
- strncat(buf, tmp, sizeof(buf));
+ StrnAppend(buf, tmp, sizeof(buf));
}
if (params->set_size) {
snprintf(tmp, sizeof(tmp), "-s %llu ", (unsigned long long)params->size);
- strncat(buf, tmp, sizeof(buf));
+ StrnAppend(buf, tmp, sizeof(buf));
}
if (params->set_type) {
GuidToStr(¶ms->type_guid, tmp, sizeof(tmp));
- strncat(buf, "-t ", sizeof(buf));
- strncat(buf, tmp, sizeof(buf));
- strncat(buf, " ", sizeof(buf));
+ StrnAppend(buf, "-t ", sizeof(buf));
+ StrnAppend(buf, tmp, sizeof(buf));
+ StrnAppend(buf, " ", sizeof(buf));
}
if (params->set_unique) {
GuidToStr(¶ms->unique_guid, tmp, sizeof(tmp));
- strncat(buf, "-u ", sizeof(buf));
- strncat(buf, tmp, sizeof(buf));
- strncat(buf, " ", sizeof(buf));
+ StrnAppend(buf, "-u ", sizeof(buf));
+ StrnAppend(buf, tmp, sizeof(buf));
+ StrnAppend(buf, " ", sizeof(buf));
}
if (params->set_successful) {
snprintf(tmp, sizeof(tmp), "-S %d ", params->successful);
- strncat(buf, tmp, sizeof(buf));
+ StrnAppend(buf, tmp, sizeof(buf));
}
if (params->set_tries) {
snprintf(tmp, sizeof(tmp), "-T %d ", params->tries);
- strncat(buf, tmp, sizeof(buf));
+ StrnAppend(buf, tmp, sizeof(buf));
}
if (params->set_priority) {
snprintf(tmp, sizeof(tmp), "-P %d ", params->priority);
- strncat(buf, tmp, sizeof(buf));
+ StrnAppend(buf, tmp, sizeof(buf));
}
if (params->set_raw) {
snprintf(tmp, sizeof(tmp), "-A 0x%x ", params->raw_value);
- strncat(buf, tmp, sizeof(buf));
+ StrnAppend(buf, tmp, sizeof(buf));
}
- strncat(buf, "\n", sizeof(buf));
+ StrnAppend(buf, "\n", sizeof(buf));
return buf;
}