/*
- * Babeltrace common functions
+ * SPDX-License-Identifier: MIT
*
* Copyright 2016 Philippe Proulx <pproulx@efficios.com>
*
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Babeltrace common functions
*/
#define BT_LOG_OUTPUT_LEVEL log_level
#include "common/macros.h"
#include "common/common.h"
#include "compat/unistd.h"
+#include "compat/limits.h"
#ifndef __MINGW32__
#include <pwd.h>
BT_ASSERT_DBG(input);
for (ch = input; *ch != '\0'; ch++) {
- if (!isprint(*ch) && *ch != '\n' && *ch != '\r' &&
+ if (!isprint((unsigned char) *ch) && *ch != '\n' && *ch != '\r' &&
*ch != '\t' && *ch != '\v') {
printable = false;
goto end;
size_t _tmp_fmt_size = (size_t) (fmt_ch - *out_fmt_ch); \
strncpy(_tmp_fmt, *out_fmt_ch, _tmp_fmt_size); \
_tmp_fmt[_tmp_fmt_size] = '\0'; \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") \
_count = snprintf(*buf_ch, _size, _tmp_fmt, __VA_ARGS__); \
- BT_ASSERT_DBG(_count >= 0); \
+ _Pragma("GCC diagnostic pop") \
+ BT_ASSERT_DBG(_count >= 0); \
*buf_ch += MIN(_count, _size); \
} while (0)