Solaris build fixes: use memset instead of bzero

This commit is contained in:
David Adam 2014-12-08 14:17:44 +08:00
parent 11bece80a8
commit 9cec0ad02c
2 changed files with 8 additions and 8 deletions

View file

@ -6,7 +6,7 @@
bool rgb_color_t::try_parse_special(const wcstring &special) bool rgb_color_t::try_parse_special(const wcstring &special)
{ {
bzero(&data, sizeof data); memset(&data, 0, sizeof data);
const wchar_t *name = special.c_str(); const wchar_t *name = special.c_str();
if (! wcscasecmp(name, L"normal")) if (! wcscasecmp(name, L"normal"))
{ {
@ -102,7 +102,7 @@ static unsigned char convert_color(const unsigned char rgb[3], const uint32_t *c
bool rgb_color_t::try_parse_rgb(const wcstring &name) bool rgb_color_t::try_parse_rgb(const wcstring &name)
{ {
bzero(&data, sizeof data); memset(&data, 0, sizeof data);
/* We support the following style of rgb formats (case insensitive): /* We support the following style of rgb formats (case insensitive):
#FA3 #FA3
#F3A035 #F3A035
@ -184,7 +184,7 @@ wcstring_list_t rgb_color_t::named_color_names(void)
bool rgb_color_t::try_parse_named(const wcstring &str) bool rgb_color_t::try_parse_named(const wcstring &str)
{ {
bzero(&data, sizeof data); memset(&data, 0, sizeof data);
size_t max = sizeof named_colors / sizeof *named_colors; size_t max = sizeof named_colors / sizeof *named_colors;
for (size_t idx=0; idx < max; idx++) for (size_t idx=0; idx < max; idx++)
{ {
@ -333,7 +333,7 @@ void rgb_color_t::parse(const wcstring &str)
if (! success) success = try_parse_rgb(str); if (! success) success = try_parse_rgb(str);
if (! success) if (! success)
{ {
bzero(&this->data, sizeof this->data); memset(&this->data, 0, sizeof this->data);
this->type = type_none; this->type = type_none;
} }
} }

View file

@ -217,14 +217,14 @@ static wcstring str2wcs_internal(const char *in, const size_t in_len)
wc = ENCODE_DIRECT_BASE + (unsigned char)in[in_pos]; wc = ENCODE_DIRECT_BASE + (unsigned char)in[in_pos];
result.push_back(wc); result.push_back(wc);
in_pos++; in_pos++;
bzero(&state, sizeof state); memset(&state, 0, sizeof state);
} }
else if (ret == 0) else if (ret == 0)
{ {
/* Embedded null byte! */ /* Embedded null byte! */
result.push_back(L'\0'); result.push_back(L'\0');
in_pos++; in_pos++;
bzero(&state, sizeof state); memset(&state, 0, sizeof state);
} }
else else
{ {
@ -315,7 +315,7 @@ std::string wcs2string(const wcstring &input)
} }
else else
{ {
bzero(converted, sizeof converted); memset(converted, 0, sizeof converted);
size_t len = wcrtomb(converted, wc, &state); size_t len = wcrtomb(converted, wc, &state);
if (len == (size_t)(-1)) if (len == (size_t)(-1))
{ {
@ -1996,7 +1996,7 @@ void format_size_safe(char buff[128], unsigned long long sz)
{ {
const size_t buff_size = 128; const size_t buff_size = 128;
const size_t max_len = buff_size - 1; //need to leave room for a null terminator const size_t max_len = buff_size - 1; //need to leave room for a null terminator
bzero(buff, buff_size); memset(buff, 0, buff_size);
size_t idx = 0; size_t idx = 0;
const char * const sz_name[]= const char * const sz_name[]=
{ {