mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-21 06:45:21 -06:00
Fix for gcc 8.2 warnings.
Replace strncat with memcpy to placate gcc 8.2. Also fix issue in tempfileplus. Issue #192.
This commit is contained in:
parent
d4819bc3a3
commit
4310da6075
2 changed files with 8 additions and 8 deletions
|
|
@ -153,19 +153,19 @@ _escape_attributes(struct xml_attribute *attribute)
|
|||
while (*p_attr) {
|
||||
switch (*p_attr) {
|
||||
case '&':
|
||||
strncat(p_encoded, LXW_AMP, sizeof(LXW_AMP) - 1);
|
||||
memcpy(p_encoded, LXW_AMP, sizeof(LXW_AMP) - 1);
|
||||
p_encoded += sizeof(LXW_AMP) - 1;
|
||||
break;
|
||||
case '<':
|
||||
strncat(p_encoded, LXW_LT, sizeof(LXW_LT) - 1);
|
||||
memcpy(p_encoded, LXW_LT, sizeof(LXW_LT) - 1);
|
||||
p_encoded += sizeof(LXW_LT) - 1;
|
||||
break;
|
||||
case '>':
|
||||
strncat(p_encoded, LXW_GT, sizeof(LXW_GT) - 1);
|
||||
memcpy(p_encoded, LXW_GT, sizeof(LXW_GT) - 1);
|
||||
p_encoded += sizeof(LXW_GT) - 1;
|
||||
break;
|
||||
case '"':
|
||||
strncat(p_encoded, LXW_QUOT, sizeof(LXW_QUOT) - 1);
|
||||
memcpy(p_encoded, LXW_QUOT, sizeof(LXW_QUOT) - 1);
|
||||
p_encoded += sizeof(LXW_QUOT) - 1;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -195,15 +195,15 @@ lxw_escape_data(const char *data)
|
|||
while (*data) {
|
||||
switch (*data) {
|
||||
case '&':
|
||||
strncat(p_encoded, LXW_AMP, sizeof(LXW_AMP) - 1);
|
||||
memcpy(p_encoded, LXW_AMP, sizeof(LXW_AMP) - 1);
|
||||
p_encoded += sizeof(LXW_AMP) - 1;
|
||||
break;
|
||||
case '<':
|
||||
strncat(p_encoded, LXW_LT, sizeof(LXW_LT) - 1);
|
||||
memcpy(p_encoded, LXW_LT, sizeof(LXW_LT) - 1);
|
||||
p_encoded += sizeof(LXW_LT) - 1;
|
||||
break;
|
||||
case '>':
|
||||
strncat(p_encoded, LXW_GT, sizeof(LXW_GT) - 1);
|
||||
memcpy(p_encoded, LXW_GT, sizeof(LXW_GT) - 1);
|
||||
p_encoded += sizeof(LXW_GT) - 1;
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
2
third_party/tmpfileplus/tmpfileplus.c
vendored
2
third_party/tmpfileplus/tmpfileplus.c
vendored
|
|
@ -169,7 +169,7 @@ static char *getenv_save(const char *varname, char *buf, size_t bufsize)
|
|||
buf[0] = '\0';
|
||||
if (ptr)
|
||||
{
|
||||
strncpy(buf, ptr, bufsize);
|
||||
strncpy(buf, ptr, bufsize-1);
|
||||
buf[bufsize-1] = '\0';
|
||||
return buf;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue