You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2021/09/01 20:31:43 UTC
[qpid-proton] branch main updated (35f7f02 -> 061c3cf)
This is an automated email from the ASF dual-hosted git repository.
astitcher pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git.
from 35f7f02 PROTON-2424: Fix the C++ example runners to work under valgrind
new 57836e6 PROTON-2425: [C] Tweak pn_buffer code to use memcpy
new 061c3cf PROTON-2426: [C] Fix off by one error in pn_quote_data
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
c/src/core/buffer.c | 12 ++++++------
c/src/core/util.c | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[qpid-proton] 01/02: PROTON-2425: [C] Tweak pn_buffer code to use
memcpy
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
commit 57836e6773fed271724e6db1757550adfc7b066a
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Tue Jun 22 15:50:13 2021 -0400
PROTON-2425: [C] Tweak pn_buffer code to use memcpy
It's guaranteed that the memory in these operations can't overlap so
use memcpy not memmove.
---
c/src/core/buffer.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/c/src/core/buffer.c b/c/src/core/buffer.c
index f571e26..07491e7 100644
--- a/c/src/core/buffer.c
+++ b/c/src/core/buffer.c
@@ -176,8 +176,8 @@ int pn_buffer_append(pn_buffer_t *buf, const char *bytes, size_t size)
size_t tail_space = pni_buffer_tail_space(buf);
size_t n = pn_min(tail_space, size);
- memmove(buf->bytes + tail, bytes, n);
- memmove(buf->bytes, bytes + n, size - n);
+ memcpy(buf->bytes + tail, bytes, n);
+ memcpy(buf->bytes, bytes + n, size - n);
buf->size += size;
@@ -193,8 +193,8 @@ int pn_buffer_prepend(pn_buffer_t *buf, const char *bytes, size_t size)
size_t head_space = pni_buffer_head_space(buf);
size_t n = pn_min(head_space, size);
- memmove(buf->bytes + head - n, bytes + size - n, n);
- memmove(buf->bytes + buf->capacity - (size - n), bytes, size - n);
+ memcpy(buf->bytes + head - n, bytes + size - n, n);
+ memcpy(buf->bytes + buf->capacity - (size - n), bytes, size - n);
if (buf->start >= size) {
buf->start -= size;
@@ -233,8 +233,8 @@ size_t pn_buffer_get(pn_buffer_t *buf, size_t offset, size_t size, char *dst)
sz2 = 0;
}
- memmove(dst, buf->bytes + start, sz1);
- memmove(dst + sz1, buf->bytes, sz2);
+ memcpy(dst, buf->bytes + start, sz1);
+ memcpy(dst + sz1, buf->bytes, sz2);
return sz1 + sz2;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[qpid-proton] 02/02: PROTON-2426: [C] Fix off by one error in
pn_quote_data
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
commit 061c3cf2ac1c5047cf9adaf771b030a1605b357b
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Tue Jun 22 16:39:48 2021 -0400
PROTON-2426: [C] Fix off by one error in pn_quote_data
---
c/src/core/util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/c/src/core/util.c b/c/src/core/util.c
index 18a9464..bed2a54 100644
--- a/c/src/core/util.c
+++ b/c/src/core/util.c
@@ -46,7 +46,7 @@ ssize_t pn_quote_data(char *dst, size_t capacity, const char *src, size_t size)
dst[idx++] = c;
} else {
if (idx > 0) {
- dst[idx - 1] = '\0';
+ dst[idx] = '\0';
}
return PN_OVERFLOW;
}
@@ -55,7 +55,7 @@ ssize_t pn_quote_data(char *dst, size_t capacity, const char *src, size_t size)
idx += sprintf(dst + idx, "\\x%.2x", c);
} else {
if (idx > 0) {
- dst[idx - 1] = '\0';
+ dst[idx] = '\0';
}
return PN_OVERFLOW;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org