Skip to content

Commit d4e71fe

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent ba0bfc0 commit d4e71fe

9 files changed

Lines changed: 46 additions & 52 deletions

File tree

src/libical/icalmemory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ void icalmemory_append_char(char **buf, char **pos, size_t *buf_size, char ch)
450450
*
451451
* Note that comma IS actually safe in vCard but we will quote it anyway
452452
*/
453-
#define UNSAFE_CHARS ";:,"
453+
#define UNSAFE_CHARS ";:,"
454454

455455
static bool icalmemory_is_safe_char(unsigned char character, bool quoted)
456456
{

src/libicalvcard/vcardcomponent.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ void vcardcomponent_normalize(vcardcomponent *comp)
767767
comp->components = sorted_comps;
768768
}
769769

770-
#define UUID_PREFIX "urn:uuid:"
770+
#define UUID_PREFIX "urn:uuid:"
771771
#define UUID_PREFIX_LEN 9
772772

773773
static void comp_to_v4(vcardcomponent *impl)
@@ -961,8 +961,7 @@ static void comp_to_v4(vcardcomponent *impl)
961961
value->kind = VCARD_URI_VALUE;
962962
vcardproperty_remove_parameter_by_kind(prop,
963963
VCARD_VALUE_PARAMETER);
964-
}
965-
else {
964+
} else {
966965
/* Otherwise, treat it as TEXT */
967966
value->kind = VCARD_TEXT_VALUE;
968967
}
@@ -974,7 +973,7 @@ static void comp_to_v4(vcardcomponent *impl)
974973
const char *xname = vcardproperty_get_x_name(prop);
975974

976975
if (!strncasecmp(xname, "X-ADDRESSBOOKSERVER-", 20)) {
977-
vcardproperty_kind kind = vcardproperty_string_to_kind(xname+20);
976+
vcardproperty_kind kind = vcardproperty_string_to_kind(xname + 20);
978977
const char *valstr = vcardvalue_as_vcard_string(value);
979978
vcardproperty *new;
980979
char *buf = NULL, *buf_ptr;
@@ -994,7 +993,7 @@ static void comp_to_v4(vcardcomponent *impl)
994993
valstr = buf;
995994

996995
_fallthrough();
997-
996+
998997
case VCARD_KIND_PROPERTY:
999998
new = vcardproperty_new(kind);
1000999
vcardproperty_set_value_from_string(new, valstr, "NO");
@@ -1015,7 +1014,6 @@ static void comp_to_v4(vcardcomponent *impl)
10151014
default:
10161015
break;
10171016
}
1018-
10191017
}
10201018
}
10211019

@@ -1132,9 +1130,9 @@ static void comp_to_v3(vcardcomponent *impl)
11321130
}
11331131
if (lat && lon) {
11341132
strncpy(geo.coords.lat, lat, VCARD_GEO_LEN - 1);
1135-
geo.coords.lat[VCARD_GEO_LEN-1] = '\0';
1133+
geo.coords.lat[VCARD_GEO_LEN - 1] = '\0';
11361134
strncpy(geo.coords.lon, lon, VCARD_GEO_LEN - 1);
1137-
geo.coords.lon[VCARD_GEO_LEN-1] = '\0';
1135+
geo.coords.lon[VCARD_GEO_LEN - 1] = '\0';
11381136
} else {
11391137
geo.coords.lat[0] = '\0';
11401138
geo.coords.lon[0] = '\0';
@@ -1252,7 +1250,6 @@ static void comp_to_v3(vcardcomponent *impl)
12521250
default:
12531251
break;
12541252
}
1255-
12561253
}
12571254

12581255
/* Add TYPE=PREF for each most preferred property */

src/libicalvcard/vcardparser.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ static int _parse_param_value(struct vcardparser_state *state)
410410
is_structured,
411411
is_multivalued)) == PE_QSTRING_EOV) {
412412
vcardparameter_add_value_from_string(state->param,
413-
buf_cstring(&state->buf));
413+
buf_cstring(&state->buf));
414414

415415
buf_reset(&state->buf);
416416
INC(1);
@@ -604,10 +604,10 @@ static int _parse_prop_name(struct vcardparser_state *state)
604604
break;
605605

606606
case VCARD_X_PROPERTY:
607-
state->value_kind =
608-
xprop_value_kind_func ? xprop_value_kind_func(name, xprop_value_kind_data)
609-
: VCARD_X_VALUE;
610-
break;
607+
state->value_kind =
608+
xprop_value_kind_func ? xprop_value_kind_func(name, xprop_value_kind_data)
609+
: VCARD_X_VALUE;
610+
break;
611611

612612
default:
613613
state->value_kind = vcardproperty_kind_to_value_kind(kind);

src/libicalvcard/vcardparser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LIBICAL_VCARD_EXPORT const char *vcardparser_errstr(int err);
3131
*
3232
* @see vcardparser_set_xprop_value_kind() how to set the callback.
3333
*/
34-
typedef vcardvalue_kind(*vcard_xprop_value_kind_func)(const char *name, void *data);
34+
typedef vcardvalue_kind (*vcard_xprop_value_kind_func)(const char *name, void *data);
3535

3636
/**
3737
* @brief Registers a parser callback to override the default value type of an

src/libicalvcard/vcardtextlist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ vcardstrarray *vcardtextlist_new_from_string(const char *str, char sep)
2121
icalerror_check_arg_rz(sep != 0, "sep");
2222

2323
vcardstrarray *array = vcardstrarray_new(2);
24-
char sep_str[2] = { sep, 0 };
24+
char sep_str[2] = {sep, 0};
2525

2626
do {
2727
char *dequoted_str = vcardvalue_strdup_and_dequote_text(&str, sep_str);

src/libicalvcard/vcardvalue.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ static bool simple_str_to_doublestr(const char *from, char *result, int result_l
343343
return false;
344344
}
345345

346-
347346
static vcardvalue *vcardvalue_new_from_string_with_error(vcardvalue_kind kind,
348347
const char *str,
349348
vcardproperty **error)
@@ -789,7 +788,9 @@ char *vcardstructured_as_vcard_string_r(const vcardstructuredtype *st, bool is_p
789788
vcardstrarray *array = vcardstructured_field_at(st, i);
790789

791790
if (i) {
792-
if (buf_ptr > buf) buf_ptr -= 1; // backup to \0
791+
if (buf_ptr > buf) {
792+
buf_ptr -= 1; // backup to \0
793+
}
793794
icalmemory_append_char(&buf, &buf_ptr, &buf_size, ';');
794795
}
795796

@@ -851,7 +852,7 @@ static char *vcardvalue_geo_as_vcard_string_r(const vcardvalue *value)
851852
size_t max_len = 2 * VCARD_GEO_LEN;
852853
char *str = (char *)icalmemory_new_buffer(max_len);
853854
snprintf(str, max_len, "%s;%s",
854-
value->data.v_geo.coords.lat, value->data.v_geo.coords.lon);
855+
value->data.v_geo.coords.lat, value->data.v_geo.coords.lon);
855856
str[max_len - 1] = '\0';
856857
return str;
857858
}

src/libicalvcard/vcardvalueimpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ struct vcardvalue_impl {
2424

2525
union data {
2626
vcardstructuredtype *v_structured;
27-
/*char *v_name; */ /* use v_structured field[0-4] only */
28-
/*char *v_adr; */ /* use v_structured field[0-6] */
27+
/*char *v_name; */ /* use v_structured field[0-4] only */
28+
/*char *v_adr; */ /* use v_structured field[0-6] */
2929

3030
/*char *v_nickname; */ /* use v_textlist */
3131
/*char *v_gender; */ /* use v_textlist */

src/test/libicalvcard/vcard_test_encode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static void test_prop_x(void)
184184
static vcardvalue_kind my_xprop_value_kind_func(const char *name, void *data)
185185
{
186186
(void)(data); // make CI happy, reporting unused parameter otherwise
187-
assert(data == (void*) 0x1234);
187+
assert(data == (void *)0x1234);
188188
return !strcasecmp(name, "X-PROP-A") ? VCARD_TEXT_VALUE : VCARD_X_VALUE;
189189
}
190190

@@ -216,7 +216,7 @@ static void test_prop_x_value_kind(void)
216216
vcardcomponent_free(card);
217217

218218
/* Parse X-PROP-A property as TEXT value, others as X value */
219-
vcardparser_set_xprop_value_kind(my_xprop_value_kind_func, (void*) 0x1234);
219+
vcardparser_set_xprop_value_kind(my_xprop_value_kind_func, (void *)0x1234);
220220

221221
card = vcardparser_parse_string(input);
222222
prop = vcardcomponent_get_first_property(card, VCARD_X_PROPERTY);
@@ -287,7 +287,7 @@ static void test_param_structured(void)
287287
"BEGIN:VCARD\r\n"
288288
"VERSION:4.0\r\n"
289289
"X-PROP;JSCOMPS=\";a;b,c;d\\,e\":foo\r\n"
290-
"X-PROP;JSCOMPS=a:foo\r\n" // non-standard
290+
"X-PROP;JSCOMPS=a:foo\r\n" // non-standard
291291
"X-PROP;JSCOMPS=a,b:foo\r\n" // non-standard
292292
"END:VCARD\r\n";
293293

src/test/regression.c

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6886,13 +6886,10 @@ static void test_internal_limits(void)
68866886
void test_icaldurationtype_normalize(void)
68876887
{
68886888
#define assert_normalized_duration(input, want) \
6889-
str_is("normalize(" input ")=" want, want, \
6890-
icaldurationtype_as_ical_string( \
6891-
icaldurationtype_normalize( \
6892-
icaldurationtype_from_string(input) \
6893-
) \
6894-
) \
6895-
)
6889+
str_is("normalize(" input ")=" want, want, \
6890+
icaldurationtype_as_ical_string( \
6891+
icaldurationtype_normalize( \
6892+
icaldurationtype_from_string(input))))
68966893

68976894
assert_normalized_duration("PT0S", "PT0S");
68986895
assert_normalized_duration("PT59S", "PT59S");
@@ -6974,26 +6971,26 @@ static void test_icalcomponent_remove_property_by_kind(void)
69746971

69756972
static void test_icalcomponent_get_duration(void)
69766973
{
6977-
#define assert_icalcomponent_get_duration(desc, want, ctlines) \
6978-
{ \
6979-
const char *str = \
6980-
"BEGIN:VCALENDAR\r\n" \
6981-
"VERSION:2.0\r\n" \
6982-
"PRODID:-//foo/bar//v1.0//EN\r\n" \
6983-
"BEGIN:VEVENT\r\n" \
6984-
"UID:4dba9882-e4a2-43e6-9944-b93e726fa6d3\r\n" \
6985-
"DTSTAMP:20060102T030405Z\r\n" \
6986-
ctlines \
6987-
"END:VEVENT\r\n" \
6988-
"END:VCALENDAR\r\n"; \
6989-
icalcomponent *ical = icalcomponent_new_from_string(str); \
6990-
ok("Parsed iCalendar object", (ical != NULL)); \
6991-
icalcomponent *comp = icalcomponent_get_first_real_component(ical); \
6974+
#define assert_icalcomponent_get_duration(desc, want, ctlines) \
6975+
{ \
6976+
const char *str = \
6977+
"BEGIN:VCALENDAR\r\n" \
6978+
"VERSION:2.0\r\n" \
6979+
"PRODID:-//foo/bar//v1.0//EN\r\n" \
6980+
"BEGIN:VEVENT\r\n" \
6981+
"UID:4dba9882-e4a2-43e6-9944-b93e726fa6d3\r\n" \
6982+
"DTSTAMP:20060102T030405Z\r\n" ctlines \
6983+
"END:VEVENT\r\n" \
6984+
"END:VCALENDAR\r\n"; \
6985+
icalcomponent *ical = icalcomponent_new_from_string(str); \
6986+
ok("Parsed iCalendar object", (ical != NULL)); \
6987+
icalcomponent *comp = icalcomponent_get_first_real_component(ical); \
69926988
ok("Parsed VEVENT component", icalcomponent_isa(comp) == ICAL_VEVENT_COMPONENT); \
6993-
str_is(desc, \
6994-
icaldurationtype_as_ical_string(\
6995-
icalcomponent_get_duration(comp)), want); \
6996-
icalcomponent_free(ical); \
6989+
str_is(desc, \
6990+
icaldurationtype_as_ical_string( \
6991+
icalcomponent_get_duration(comp)), \
6992+
want); \
6993+
icalcomponent_free(ical); \
69976994
}
69986995

69996996
assert_icalcomponent_get_duration(
@@ -7058,7 +7055,6 @@ static void test_icalcomponent_get_duration(void)
70587055
#undef assert_icalcomponent_get_duration
70597056
}
70607057

7061-
70627058
int main(int argc, const char *argv[])
70637059
{
70647060
#if !defined(HAVE_UNISTD_H)

0 commit comments

Comments
 (0)