unrustify UPDATE move to version 0.76
diff --git a/src/common.c b/src/common.c
index 8edeb33..38f51ea 100644
--- a/src/common.c
+++ b/src/common.c
@@ -458,6 +458,7 @@
while (to_read > 0) {
ssize_t n = read(fd, buf, to_read);
+
if (n == 0) {
return LY_SUCCESS;
} else if (n < 0) {
diff --git a/src/json.c b/src/json.c
index ba711e1..5c45c8c 100644
--- a/src/json.c
+++ b/src/json.c
@@ -164,6 +164,7 @@
* (one-char) entities and character references */
if (len + offset + 4 >= size) {
size_t increment;
+
for (increment = BUFSIZE_STEP; len + offset + 4 >= size + increment; increment += BUFSIZE_STEP) {}
buf = ly_realloc(buf, size + increment);
LY_CHECK_ERR_RET(!buf, LOGMEM(jsonctx->ctx), LY_EMEM);
@@ -488,7 +489,7 @@
/* Final position of decimal point in the buf. */
int32_t dp_position;
/* Exponent as integer. */
- long long int e_val;
+ long long e_val;
/* Byte for the decimal point. */
int8_t dot;
/* Required additional byte for the minus sign. */
diff --git a/src/parser_common.c b/src/parser_common.c
index 92b7b29..6fe068b 100644
--- a/src/parser_common.c
+++ b/src/parser_common.c
@@ -333,8 +333,10 @@
#elif defined _WIN32
HANDLE h = _get_osfhandle(in->method.fd);
FILE_NAME_INFO info;
+
if (GetFileInformationByHandleEx(h, FileNameInfo, &info, sizeof info)) {
char *buf = calloc(info.FileNameLength + 1 /* trailing NULL */, MB_CUR_MAX);
+
len = wcstombs(buf, info.FileName, info.FileNameLength * MB_CUR_MAX);
lydict_insert(ctx, buf, len, filepath);
}
@@ -914,8 +916,8 @@
{
size_t arg_len;
char *ptr = NULL;
- long long int num = 0;
- unsigned long long int unum = 0;
+ long long num = 0;
+ unsigned long long unum = 0;
if (*flags & LYS_SET_VALUE) {
LOGVAL_PARSER(ctx, LY_VCODE_DUPSTMT, lyplg_ext_stmt2str(stmt->kw));
@@ -1055,7 +1057,7 @@
{
char *ptr;
size_t arg_len;
- unsigned long long int num;
+ unsigned long long num;
if (*fracdig) {
LOGVAL_PARSER(ctx, LY_VCODE_DUPSTMT, "fraction-digits");
@@ -1946,7 +1948,7 @@
{
size_t arg_len;
char *ptr;
- unsigned long long int num;
+ unsigned long long num;
if (*flags & LYS_SET_MAX) {
LOGVAL_PARSER(ctx, LY_VCODE_DUPSTMT, "max-elements");
@@ -2012,7 +2014,7 @@
{
size_t arg_len;
char *ptr;
- unsigned long long int num;
+ unsigned long long num;
if (*flags & LYS_SET_MIN) {
LOGVAL_PARSER(ctx, LY_VCODE_DUPSTMT, "min-elements");
diff --git a/src/parser_yang.c b/src/parser_yang.c
index d250c00..dd84480 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -1788,8 +1788,8 @@
LY_ERR ret = LY_SUCCESS;
char *buf = NULL, *word, *ptr;
size_t word_len;
- long long int num = 0;
- unsigned long long int unum = 0;
+ long long num = 0;
+ unsigned long long unum = 0;
enum ly_stmt kw;
if (enm->flags & LYS_SET_VALUE) {
@@ -1941,7 +1941,7 @@
LY_ERR ret = LY_SUCCESS;
char *buf = NULL, *word, *ptr;
size_t word_len;
- unsigned long long int num;
+ unsigned long long num;
enum ly_stmt kw;
if (type->fraction_digits) {
@@ -2382,7 +2382,7 @@
LY_ERR ret = LY_SUCCESS;
char *buf = NULL, *word, *ptr;
size_t word_len;
- unsigned long long int num;
+ unsigned long long num;
enum ly_stmt kw;
if (*flags & LYS_SET_MAX) {
@@ -2454,7 +2454,7 @@
LY_ERR ret = LY_SUCCESS;
char *buf = NULL, *word, *ptr;
size_t word_len;
- unsigned long long int num;
+ unsigned long long num;
enum ly_stmt kw;
if (*flags & LYS_SET_MIN) {
diff --git a/src/parser_yin.c b/src/parser_yin.c
index 6b5ff77..fa44968 100644
--- a/src/parser_yin.c
+++ b/src/parser_yin.c
@@ -202,7 +202,7 @@
name = in->current;
ly_in_free(in, 0);
- if (name - start == (long int)name_len) {
+ if (name - start == (long)name_len) {
/* this is done because of collision in yang statement value and yang argument mapped to yin element value */
if ((kw == LY_STMT_VALUE) && (parent == LY_STMT_ERROR_MESSAGE)) {
return LY_STMT_ARG_VALUE;
@@ -707,7 +707,7 @@
{
const char *temp_val = NULL;
char *ptr;
- unsigned long long int num;
+ unsigned long long num;
LY_CHECK_RET(lyxml_ctx_next(ctx->xmlctx));
LY_CHECK_RET(yin_parse_attribute(ctx, YIN_ARG_VALUE, &temp_val, Y_STR_ARG, LY_STMT_FRACTION_DIGITS));
@@ -1132,8 +1132,8 @@
LY_ERR ret = LY_SUCCESS;
const char *temp_val = NULL;
char *ptr;
- long long int num = 0;
- unsigned long long int unum = 0;
+ long long num = 0;
+ unsigned long long unum = 0;
assert(parent_stmt == LY_STMT_POSITION || parent_stmt == LY_STMT_VALUE);
@@ -1363,7 +1363,7 @@
LY_ERR ret = LY_SUCCESS;
const char *temp_val = NULL;
char *ptr;
- unsigned long long int num;
+ unsigned long long num;
struct yin_subelement subelems[] = {
{LY_STMT_EXTENSION_INSTANCE, NULL, 0},
};
@@ -1415,7 +1415,7 @@
{
const char *temp_val = NULL;
char *ptr;
- unsigned long long int num;
+ unsigned long long num;
struct yin_subelement subelems[] = {
{LY_STMT_EXTENSION_INSTANCE, NULL, 0},
};
diff --git a/src/plugins_types.c b/src/plugins_types.c
index 5ffbc6d..cb4b896 100644
--- a/src/plugins_types.c
+++ b/src/plugins_types.c
@@ -499,6 +499,7 @@
if ((rc != PCRE2_ERROR_NOMATCH) && (rc < 0)) {
PCRE2_UCHAR pcre2_errmsg[LY_PCRE2_MSG_LIMIT] = {0};
+
pcre2_get_error_message(rc, pcre2_errmsg, LY_PCRE2_MSG_LIMIT);
return ly_err_new(err, LY_ESYS, 0, NULL, NULL, "%s", (const char *)pcre2_errmsg);
@@ -510,6 +511,7 @@
return ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, eapptag, "%s", patterns[u]->emsg);
} else {
const char *inverted = patterns[u]->inverted ? "inverted " : "";
+
return ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, eapptag,
LY_ERRMSG_NOPATTERN, (int)str_len, str, inverted, patterns[u]->expr);
}
diff --git a/src/printer_yang.c b/src/printer_yang.c
index aaf1d64..ea643ac 100644
--- a/src/printer_yang.c
+++ b/src/printer_yang.c
@@ -354,7 +354,7 @@
static void
ypr_unsigned(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, void *exts,
- unsigned long int attr_value, ly_bool *flag)
+ unsigned long attr_value, ly_bool *flag)
{
char *str;
@@ -368,7 +368,7 @@
}
static void
-ypr_signed(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, void *exts, signed long int attr_value,
+ypr_signed(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, void *exts, long attr_value,
ly_bool *flag)
{
char *str;
diff --git a/src/printer_yin.c b/src/printer_yin.c
index 0a9312d..74e0f0e 100644
--- a/src/printer_yin.c
+++ b/src/printer_yin.c
@@ -205,7 +205,7 @@
}
static void
-ypr_unsigned(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, void *exts, unsigned long int attr_value)
+ypr_unsigned(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, void *exts, unsigned long attr_value)
{
char *str;
@@ -218,7 +218,7 @@
}
static void
-ypr_signed(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, void *exts, signed long int attr_value)
+ypr_signed(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, void *exts, long attr_value)
{
char *str;
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index 9364554..0b64dcb 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -1328,6 +1328,7 @@
&err_code, &err_offset, NULL);
if (!code_local) {
PCRE2_UCHAR err_msg[LY_PCRE2_MSG_LIMIT] = {0};
+
pcre2_get_error_message(err_code, err_msg, LY_PCRE2_MSG_LIMIT);
LOGVAL(ctx, LY_VCODE_INREGEXP, pattern, perl_regex + err_offset, err_msg);
free(perl_regex);