Skip to content
Snippets Groups Projects
Commit c31cbd7f authored by Tilghman Lesher's avatar Tilghman Lesher
Browse files

Don't pass a negative to an unsigned type and expect things to work correctly.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164168 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent c0fc8edb
No related branches found
No related tags found
No related merge requests found
......@@ -477,11 +477,11 @@ attribute_pure char *ast_str_buffer(struct ast_str *buf),
)
AST_INLINE_API(
char *ast_str_truncate(struct ast_str *buf, size_t len),
char *ast_str_truncate(struct ast_str *buf, ssize_t len),
{
#ifdef DEBUG_OPAQUE
if (len < 0) {
buf->used2 += len;
buf->used2 += (ssize_t) abs(len) > buf->used2 ? -buf->used2 : len;
} else {
buf->used2 = len;
}
......@@ -489,7 +489,7 @@ char *ast_str_truncate(struct ast_str *buf, size_t len),
return buf->str2;
#else
if (len < 0) {
buf->used += len;
buf->used += (ssize_t) abs(len) > buf->used ? -buf->used : len;
} else {
buf->used = len;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment