This fixes compilation with -Wstrict-overflow=2
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Mar 21 04:25:39 CET 2018 on sn-devel-144
* @see srprs_val_name
*/
static int cbuf_print_value_assign(cbuf* ost, const char* name) {
- int ret, n;
+ size_t ret = 0;
+ int n;
if (*name == '\0') {
- ret = cbuf_putc(ost, '@');
+ n = cbuf_putc(ost, '@');
} else {
- ret = cbuf_print_quoted_string(ost, name);
+ n = cbuf_print_quoted_string(ost, name);
}
-
- if (ret<0) {
- return ret;
+ if (n < 0) {
+ return n;
}
+ ret += n;
n = cbuf_putc(ost, '=');
if (n < 0) {
static int
cbuf_print_keyname(cbuf* ost, const char* key[], int n, const struct fmt_key* fmt)
{
- int r, ret=0;
+ int r;
+ size_t ret = 0;
size_t pos = cbuf_getpos(ost);
bool hive = true;