0
0
mirror of https://github.com/vim/vim.git synced 2025-08-27 20:13:38 -04:00

patch 9.1.0879: source is not consistently formatted

Problem:  source is not consistently formatted
Solution: reformat sign.c and sound.c
          (Luca Saccarola)

closes: #16019

Signed-off-by: Luca Saccarola <github.e41mv@aleeas.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Luca Saccarola 2024-11-19 22:55:13 +01:00 committed by Christian Brabandt
parent 8bc4d25abe
commit 3cf094edaf
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
3 changed files with 1570 additions and 1607 deletions

View File

@ -1,4 +1,4 @@
/* vi:set ts=8 sts=4 sw=4 noet:
/* vi:set ts=8 sts=4 sw=4 et:
*
* VIM - Vi IMproved by Bram Moolenaar
*
@ -43,8 +43,7 @@ static int next_sign_typenr = 1;
static void sign_list_defined(sign_T *sp);
static void sign_undefine(sign_T *sp, sign_T *sp_prev);
static char *cmds[] = {
"define",
static char *cmds[] = { "define",
# define SIGNCMD_DEFINE 0
"undefine",
# define SIGNCMD_UNDEFINE 1
@ -141,10 +140,10 @@ sign_group_unref(char_u *groupname)
static int
sign_in_group(sign_entry_T *sign, char_u *group)
{
return ((group != NULL && STRCMP(group, "*") == 0)
|| (group == NULL && sign->se_group == NULL)
|| (group != NULL && sign->se_group != NULL
&& STRCMP(group, sign->se_group->sg_name) == 0));
return ((group != NULL && STRCMP(group, "*") == 0) ||
(group == NULL && sign->se_group == NULL) ||
(group != NULL && sign->se_group != NULL &&
STRCMP(group, sign->se_group->sg_name) == 0));
}
/*
@ -154,8 +153,8 @@ sign_in_group(sign_entry_T *sign, char_u *group)
static int
sign_group_for_window(sign_entry_T *sign, win_T *wp)
{
int for_popup = sign->se_group != NULL
&& STRNCMP("PopUp", sign->se_group->sg_name, 5) == 0;
int for_popup = sign->se_group != NULL &&
STRNCMP("PopUp", sign->se_group->sg_name, 5) == 0;
return WIN_IS_POPUP(wp) ? for_popup : !for_popup;
}
@ -208,8 +207,7 @@ sign_group_get_next_signid(buf_T *buf, char_u *groupname)
* 'next' signs.
*/
static void
insert_sign(
buf_T *buf, // buffer to store sign in
insert_sign(buf_T *buf, // buffer to store sign in
sign_entry_T *prev, // previous sign entry
sign_entry_T *next, // next sign entry
int id, // sign ID
@ -269,8 +267,7 @@ insert_sign(
* Insert a new sign sorted by line number and sign priority.
*/
static void
insert_sign_by_lnum_prio(
buf_T *buf, // buffer to store sign in
insert_sign_by_lnum_prio(buf_T *buf, // buffer to store sign in
sign_entry_T *prev, // previous sign entry
int id, // sign ID
char_u *group, // sign group; NULL for global group
@ -331,8 +328,9 @@ sign_get_info(sign_entry_T *sign)
if ((d = dict_alloc_id(aid_sign_getinfo)) == NULL)
return NULL;
dict_add_number(d, "id", sign->se_id);
dict_add_string(d, "group", (sign->se_group == NULL) ?
(char_u *)"" : sign->se_group->sg_name);
dict_add_string(d, "group",
(sign->se_group == NULL) ? (char_u *)""
: sign->se_group->sg_name);
dict_add_number(d, "lnum", sign->se_lnum);
dict_add_string(d, "name", sign_typenr2name(sign->se_typenr));
dict_add_number(d, "priority", sign->se_priority);
@ -352,12 +350,10 @@ sign_sort_by_prio_on_line(buf_T *buf, sign_entry_T *sign)
// If there is only one sign in the buffer or only one sign on the line or
// the sign is already sorted by priority, then return.
if ((sign->se_prev == NULL
|| sign->se_prev->se_lnum != sign->se_lnum
|| sign->se_prev->se_priority > sign->se_priority)
&& (sign->se_next == NULL
|| sign->se_next->se_lnum != sign->se_lnum
|| sign->se_next->se_priority < sign->se_priority))
if ((sign->se_prev == NULL || sign->se_prev->se_lnum != sign->se_lnum ||
sign->se_prev->se_priority > sign->se_priority) &&
(sign->se_next == NULL || sign->se_next->se_lnum != sign->se_lnum ||
sign->se_next->se_priority < sign->se_priority))
return;
// One or more signs on the same line as 'sign'
@ -365,8 +361,8 @@ sign_sort_by_prio_on_line(buf_T *buf, sign_entry_T *sign)
// First search backward for a sign with higher priority on the same line
p = sign;
while (p->se_prev != NULL && p->se_prev->se_lnum == sign->se_lnum
&& p->se_prev->se_priority <= sign->se_priority)
while (p->se_prev != NULL && p->se_prev->se_lnum == sign->se_lnum &&
p->se_prev->se_priority <= sign->se_priority)
p = p->se_prev;
if (p == sign)
@ -374,8 +370,8 @@ sign_sort_by_prio_on_line(buf_T *buf, sign_entry_T *sign)
// Sign not found. Search forward for a sign with priority just before
// 'sign'.
p = sign->se_next;
while (p->se_next != NULL && p->se_next->se_lnum == sign->se_lnum
&& p->se_next->se_priority > sign->se_priority)
while (p->se_next != NULL && p->se_next->se_lnum == sign->se_lnum &&
p->se_next->se_priority > sign->se_priority)
p = p->se_next;
}
@ -416,8 +412,7 @@ sign_sort_by_prio_on_line(buf_T *buf, sign_entry_T *sign)
* Add the sign into the signlist. Find the right spot to do it though.
*/
static void
buf_addsign(
buf_T *buf, // buffer to store sign in
buf_addsign(buf_T *buf, // buffer to store sign in
int id, // sign ID
char_u *groupname, // sign group
int prio, // sign priority
@ -430,8 +425,8 @@ buf_addsign(
prev = NULL;
FOR_ALL_SIGNS_IN_BUF(buf, sign)
{
if (lnum == sign->se_lnum && id == sign->se_id
&& sign_in_group(sign, groupname))
if (lnum == sign->se_lnum && id == sign->se_id &&
sign_in_group(sign, groupname))
{
// Update an existing sign
sign->se_typenr = typenr;
@ -441,8 +436,8 @@ buf_addsign(
}
else if (lnum < sign->se_lnum)
{
insert_sign_by_lnum_prio(buf, prev, id, groupname, prio,
lnum, typenr);
insert_sign_by_lnum_prio(buf, prev, id, groupname, prio, lnum,
typenr);
return;
}
prev = sign;
@ -457,8 +452,7 @@ buf_addsign(
* Returns the line number of the sign, or zero if the sign is not found.
*/
static linenr_T
buf_change_sign_type(
buf_T *buf, // buffer to store sign in
buf_change_sign_type(buf_T *buf, // buffer to store sign in
int markId, // sign ID
char_u *group, // sign group
int typenr, // typenr of sign we are adding
@ -528,9 +522,9 @@ buf_get_signattrs(win_T *wp, linenr_T lnum, sign_attrs_T *sattr)
// If there is another sign next with the same priority, may
// combine the text and the line highlighting.
if (sign->se_next != NULL
&& sign->se_next->se_priority == sign->se_priority
&& sign->se_next->se_lnum == sign->se_lnum)
if (sign->se_next != NULL &&
sign->se_next->se_priority == sign->se_priority &&
sign->se_next->se_lnum == sign->se_lnum)
{
sign_T *next_sp = find_sign_by_typenr(sign->se_next->se_typenr);
@ -570,8 +564,7 @@ buf_get_signattrs(win_T *wp, linenr_T lnum, sign_attrs_T *sattr)
* then returns the line number of the last sign deleted.
*/
linenr_T
buf_delsign(
buf_T *buf, // buffer sign is stored in
buf_delsign(buf_T *buf, // buffer sign is stored in
linenr_T atlnum, // sign at this line, 0 - at any line
int id, // sign id
char_u *group) // sign group
@ -586,9 +579,9 @@ buf_delsign(
for (sign = buf->b_signlist; sign != NULL; sign = next)
{
next = sign->se_next;
if ((id == 0 || sign->se_id == id)
&& (atlnum == 0 || sign->se_lnum == atlnum)
&& sign_in_group(sign, group))
if ((id == 0 || sign->se_id == id) &&
(atlnum == 0 || sign->se_lnum == atlnum) &&
sign_in_group(sign, group))
{
*lastp = next;
@ -604,9 +597,8 @@ buf_delsign(
// If deleting a sign with a specific identifier in a particular
// group or deleting any sign at a particular line number, delete
// only one sign.
if (group == NULL
|| (*group != '*' && id != 0)
|| (*group == '*' && atlnum != 0))
if (group == NULL || (*group != '*' && id != 0) ||
(*group == '*' && atlnum != 0))
break;
}
else
@ -624,15 +616,13 @@ buf_delsign(
return lnum;
}
/*
* Find the line number of the sign with the requested id in group 'group'. If
* the sign does not exist, return 0 as the line number. This will still let
* the correct file get loaded.
*/
int
buf_findsign(
buf_T *buf, // buffer to store sign in
buf_findsign(buf_T *buf, // buffer to store sign in
int id, // sign ID
char_u *group) // sign group
{
@ -650,8 +640,7 @@ buf_findsign(
* not found at the line. If 'groupname' is NULL, searches in the global group.
*/
static sign_entry_T *
buf_getsign_at_line(
buf_T *buf, // buffer whose sign we are searching for
buf_getsign_at_line(buf_T *buf, // buffer whose sign we are searching for
linenr_T lnum, // line number of sign
char_u *groupname) // sign group name
{
@ -675,8 +664,7 @@ buf_getsign_at_line(
* Return the identifier of the sign at line number 'lnum' in buffer 'buf'.
*/
int
buf_findsign_id(
buf_T *buf, // buffer whose sign we are searching for
buf_findsign_id(buf_T *buf, // buffer whose sign we are searching for
linenr_T lnum, // line number of sign
char_u *groupname) // sign group name
{
@ -694,8 +682,7 @@ buf_findsign_id(
* See if a given type of sign exists on a specific line.
*/
int
buf_findsigntype_id(
buf_T *buf, // buffer whose sign we are searching for
buf_findsigntype_id(buf_T *buf, // buffer whose sign we are searching for
linenr_T lnum, // line number of sign
int typenr) // sign type number
{
@ -715,7 +702,6 @@ buf_findsigntype_id(
return 0;
}
# if defined(FEAT_SIGN_ICONS) || defined(PROTO)
/*
* Return the number of icons on the given line.
@ -833,11 +819,7 @@ sign_list_placed(buf_T *rbuf, char_u *sign_group)
* Adjust a placed sign for inserted/deleted lines.
*/
void
sign_mark_adjust(
linenr_T line1,
linenr_T line2,
long amount,
long amount_after)
sign_mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after)
{
sign_entry_T *sign; // a sign in a b_signlist
linenr_T new_lnum;
@ -870,8 +852,7 @@ sign_mark_adjust(
* "*end_cmd" must be writable.
*/
static int
sign_cmd_idx(
char_u *begin_cmd, // begin of sign subcmd
sign_cmd_idx(char_u *begin_cmd, // begin of sign subcmd
char_u *end_cmd) // just after sign subcmd
{
int idx;
@ -1041,8 +1022,7 @@ sign_define_init_text(sign_T *sp, char_u *text)
* Define a new sign or update an existing sign
*/
int
sign_define_by_name(
char_u *name,
sign_define_by_name(char_u *name,
char_u *icon,
char_u *linehl,
char_u *text,
@ -1174,10 +1154,9 @@ may_force_numberwidth_recompute(buf_T *buf, int unplace)
win_T *wp;
FOR_ALL_TAB_WINDOWS(tp, wp)
if (wp->w_buffer == buf
&& (wp->w_p_nu || wp->w_p_rnu)
&& (unplace || wp->w_nrwidth_width < 2)
&& (*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u'))
if (wp->w_buffer == buf && (wp->w_p_nu || wp->w_p_rnu) &&
(unplace || wp->w_nrwidth_width < 2) &&
(*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u'))
wp->w_nrwidth_line_count = 0;
}
@ -1185,8 +1164,7 @@ may_force_numberwidth_recompute(buf_T *buf, int unplace)
* Place a sign at the specified file location or update a sign.
*/
int
sign_place(
int *sign_id,
sign_place(int *sign_id,
char_u *sign_group,
char_u *sign_name,
buf_T *buf,
@ -1400,7 +1378,8 @@ sign_define_cmd(char_u *sign_name, char_u *cmdline)
}
if (!failed)
sign_define_by_name(sign_name, icon, linehl, text, texthl, culhl, numhl, prio);
sign_define_by_name(sign_name, icon, linehl, text, texthl, culhl, numhl,
prio);
vim_free(icon);
vim_free(text);
@ -1414,8 +1393,7 @@ sign_define_cmd(char_u *sign_name, char_u *cmdline)
* ":sign place" command
*/
static void
sign_place_cmd(
buf_T *buf,
sign_place_cmd(buf_T *buf,
linenr_T lnum,
char_u *sign_name,
int id,
@ -1434,8 +1412,7 @@ sign_place_cmd(
// :sign place
// :sign place group={group}
// :sign place group=*
if (lnum >= 0 || sign_name != NULL
|| (group != NULL && *group == '\0'))
if (lnum >= 0 || sign_name != NULL || (group != NULL && *group == '\0'))
emsg(_(e_invalid_argument));
else
sign_list_placed(buf, group);
@ -1443,8 +1420,8 @@ sign_place_cmd(
else
{
// Place a new sign
if (sign_name == NULL || buf == NULL
|| (group != NULL && *group == '\0'))
if (sign_name == NULL || buf == NULL ||
(group != NULL && *group == '\0'))
{
emsg(_(e_invalid_argument));
return;
@ -1458,8 +1435,7 @@ sign_place_cmd(
* ":sign unplace" command
*/
static void
sign_unplace_cmd(
buf_T *buf,
sign_unplace_cmd(buf_T *buf,
linenr_T lnum,
char_u *sign_name,
int id,
@ -1527,8 +1503,7 @@ sign_unplace_cmd(
* :sign jump {id} group={group} buffer={nr}
*/
static void
sign_jump_cmd(
buf_T *buf,
sign_jump_cmd(buf_T *buf,
linenr_T lnum,
char_u *sign_name,
int id,
@ -1540,8 +1515,8 @@ sign_jump_cmd(
return;
}
if (buf == NULL || (group != NULL && *group == '\0')
|| lnum >= 0 || sign_name != NULL)
if (buf == NULL || (group != NULL && *group == '\0') || lnum >= 0 ||
sign_name != NULL)
{
// File or buffer is not specified or an empty group is used
// or a line number or a sign name is specified.
@ -1558,8 +1533,7 @@ sign_jump_cmd(
* priority={prio} and file={fname} or buffer={nr}.
*/
static int
parse_sign_cmd_args(
int cmd,
parse_sign_cmd_args(int cmd,
char_u *arg,
char_u **sign_name,
int *signid,
@ -1663,8 +1637,8 @@ parse_sign_cmd_args(
// If the filename is not supplied for the sign place or the sign jump
// command, then use the current buffer.
if (filename == NULL && ((cmd == SIGNCMD_PLACE && lnum_arg)
|| cmd == SIGNCMD_JUMP))
if (filename == NULL &&
((cmd == SIGNCMD_PLACE && lnum_arg) || cmd == SIGNCMD_JUMP))
*buf = curwin->w_buffer;
return OK;
@ -1738,8 +1712,8 @@ ex_sign(exarg_T *eap)
int prio = -1;
// Parse command line arguments
if (parse_sign_cmd_args(idx, arg, &sign_name, &id, &group, &prio,
&buf, &lnum) == FAIL)
if (parse_sign_cmd_args(idx, arg, &sign_name, &id, &group, &prio, &buf,
&lnum) == FAIL)
return;
if (idx == SIGNCMD_PLACE)
@ -1846,8 +1820,7 @@ get_buffer_signs(buf_T *buf, list_T *l)
* Return information about all the signs placed in a buffer
*/
static void
sign_get_placed_in_buf(
buf_T *buf,
sign_get_placed_in_buf(buf_T *buf,
linenr_T lnum,
int sign_id,
char_u *sign_group,
@ -1872,10 +1845,10 @@ sign_get_placed_in_buf(
{
if (!sign_in_group(sign, sign_group))
continue;
if ((lnum == 0 && sign_id == 0)
|| (sign_id == 0 && lnum == sign->se_lnum)
|| (lnum == 0 && sign_id == sign->se_id)
|| (lnum == sign->se_lnum && sign_id == sign->se_id))
if ((lnum == 0 && sign_id == 0) ||
(sign_id == 0 && lnum == sign->se_lnum) ||
(lnum == 0 && sign_id == sign->se_id) ||
(lnum == sign->se_lnum && sign_id == sign->se_id))
{
if ((sdict = sign_get_info(sign)) != NULL)
list_append_dict(l, sdict);
@ -1889,8 +1862,7 @@ sign_get_placed_in_buf(
* placed in 'buf'. If 'buf' is NULL, return signs placed in all the buffers.
*/
static void
sign_get_placed(
buf_T *buf,
sign_get_placed(buf_T *buf,
linenr_T lnum,
int sign_id,
char_u *sign_group,
@ -2016,8 +1988,7 @@ sign_undefine(sign_T *sp, sign_T *sp_prev)
# if defined(FEAT_SIGN_ICONS) || defined(PROTO)
void *
sign_get_image(
int typenr) // the attribute which may have a sign
sign_get_image(int typenr) // the attribute which may have a sign
{
sign_T *sp;
@ -2108,28 +2079,19 @@ get_sign_name(expand_T *xp UNUSED, int idx)
return (char_u *)cmds[idx];
case EXP_DEFINE:
{
char *define_arg[] =
{
"culhl=", "icon=", "linehl=", "numhl=", "text=", "texthl=", "priority=",
NULL
};
char *define_arg[] = { "culhl=", "icon=", "linehl=", "numhl=",
"text=", "texthl=", "priority=", NULL };
return (char_u *)define_arg[idx];
}
case EXP_PLACE:
{
char *place_arg[] =
{
"line=", "name=", "group=", "priority=", "file=",
"buffer=", NULL
};
char *place_arg[] = { "line=", "name=", "group=", "priority=",
"file=", "buffer=", NULL };
return (char_u *)place_arg[idx];
}
case EXP_LIST:
{
char *list_arg[] =
{
"group=", "file=", "buffer=", NULL
};
char *list_arg[] = { "group=", "file=", "buffer=", NULL };
return (char_u *)list_arg[idx];
}
case EXP_UNPLACE:
@ -2189,7 +2151,8 @@ set_context_in_sign_cmd(expand_T *xp, char_u *arg)
p = skipwhite(p);
last = p;
p = skiptowhite(p);
} while (*p != NUL);
}
while (*p != NUL);
p = vim_strchr(last, '=');
@ -2235,10 +2198,10 @@ set_context_in_sign_cmd(expand_T *xp, char_u *arg)
switch (cmd_idx)
{
case SIGNCMD_DEFINE:
if (STRNCMP(last, "texthl", 6) == 0
|| STRNCMP(last, "linehl", 6) == 0
|| STRNCMP(last, "culhl", 5) == 0
|| STRNCMP(last, "numhl", 5) == 0)
if (STRNCMP(last, "texthl", 6) == 0 ||
STRNCMP(last, "linehl", 6) == 0 ||
STRNCMP(last, "culhl", 5) == 0 ||
STRNCMP(last, "numhl", 5) == 0)
xp->xp_context = EXPAND_HIGHLIGHT;
else if (STRNCMP(last, "icon", 4) == 0)
xp->xp_context = EXPAND_FILES;
@ -2308,7 +2271,8 @@ sign_define_from_dict(char_u *name_arg, dict_T *dict)
prio = dict_get_number_def(dict, "priority", -1);
}
if (sign_define_by_name(name, icon, linehl, text, texthl, culhl, numhl, prio) == OK)
if (sign_define_by_name(name, icon, linehl, text, texthl, culhl, numhl,
prio) == OK)
retval = 0;
cleanup:
@ -2352,9 +2316,8 @@ f_sign_define(typval_T *argvars, typval_T *rettv)
{
char_u *name;
if (in_vim9script()
&& (check_for_string_or_list_arg(argvars, 0) == FAIL
|| check_for_opt_dict_arg(argvars, 1) == FAIL))
if (in_vim9script() && (check_for_string_or_list_arg(argvars, 0) == FAIL ||
check_for_opt_dict_arg(argvars, 1) == FAIL))
return;
if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
@ -2377,8 +2340,8 @@ f_sign_define(typval_T *argvars, typval_T *rettv)
if (check_for_opt_dict_arg(argvars, 1) == FAIL)
return;
rettv->vval.v_number = sign_define_from_dict(name,
argvars[1].v_type == VAR_DICT ? argvars[1].vval.v_dict : NULL);
rettv->vval.v_number = sign_define_from_dict(
name, argvars[1].v_type == VAR_DICT ? argvars[1].vval.v_dict : NULL);
}
/*
@ -2418,10 +2381,9 @@ f_sign_getplaced(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc_id(rettv, aid_sign_getplaced) == FAIL)
return;
if (in_vim9script()
&& (check_for_opt_buffer_arg(argvars, 0) == FAIL
|| (argvars[0].v_type != VAR_UNKNOWN
&& check_for_opt_dict_arg(argvars, 1) == FAIL)))
if (in_vim9script() && (check_for_opt_buffer_arg(argvars, 0) == FAIL ||
(argvars[0].v_type != VAR_UNKNOWN &&
check_for_opt_dict_arg(argvars, 1) == FAIL)))
return;
if (argvars[0].v_type != VAR_UNKNOWN)
@ -2478,10 +2440,9 @@ f_sign_jump(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = -1;
if (in_vim9script()
&& (check_for_number_arg(argvars, 0) == FAIL
|| check_for_string_arg(argvars, 1) == FAIL
|| check_for_buffer_arg(argvars, 2) == FAIL))
if (in_vim9script() && (check_for_number_arg(argvars, 0) == FAIL ||
check_for_string_arg(argvars, 1) == FAIL ||
check_for_buffer_arg(argvars, 2) == FAIL))
return;
// Sign identifier
@ -2523,8 +2484,7 @@ cleanup:
* identifier if successfully placed, otherwise returns 0.
*/
static int
sign_place_from_dict(
typval_T *id_tv,
sign_place_from_dict(typval_T *id_tv,
typval_T *group_tv,
typval_T *name_tv,
typval_T *buf_tv,
@ -2651,12 +2611,11 @@ f_sign_place(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = -1;
if (in_vim9script()
&& (check_for_number_arg(argvars, 0) == FAIL
|| check_for_string_arg(argvars, 1) == FAIL
|| check_for_string_arg(argvars, 2) == FAIL
|| check_for_buffer_arg(argvars, 3) == FAIL
|| check_for_opt_dict_arg(argvars, 4) == FAIL))
if (in_vim9script() && (check_for_number_arg(argvars, 0) == FAIL ||
check_for_string_arg(argvars, 1) == FAIL ||
check_for_string_arg(argvars, 2) == FAIL ||
check_for_buffer_arg(argvars, 3) == FAIL ||
check_for_opt_dict_arg(argvars, 4) == FAIL))
return;
if (argvars[4].v_type != VAR_UNKNOWN)
@ -2729,8 +2688,7 @@ f_sign_undefine(typval_T *argvars, typval_T *rettv)
{
char_u *name;
if (in_vim9script()
&& check_for_opt_string_or_list_arg(argvars, 0) == FAIL)
if (in_vim9script() && check_for_opt_string_or_list_arg(argvars, 0) == FAIL)
return;
if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
@ -2874,8 +2832,8 @@ f_sign_unplace(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = -1;
if ((check_for_string_arg(argvars, 0) == FAIL
|| check_for_opt_dict_arg(argvars, 1) == FAIL))
if ((check_for_string_arg(argvars, 0) == FAIL ||
check_for_opt_dict_arg(argvars, 1) == FAIL))
return;
if (argvars[1].v_type != VAR_UNKNOWN)

View File

@ -19,7 +19,8 @@ static long sound_id = 0;
// soundcb_T is typedef'ed in proto/sound.pro
struct soundcb_S {
struct soundcb_S
{
callback_T snd_callback;
# ifdef MSWIN
MCIDEVICEID snd_device_id;
@ -120,7 +121,8 @@ static ca_context *context = NULL;
// Structure to store info about a sound callback to be invoked soon.
typedef struct soundcb_queue_S soundcb_queue_T;
struct soundcb_queue_S {
struct soundcb_queue_S
{
soundcb_queue_T *scb_next;
uint32_t scb_id; // ID of the sound
int scb_result; // CA_ value
@ -136,8 +138,7 @@ static soundcb_queue_T *callback_queue = NULL;
* another sound function may cause trouble.
*/
static void
sound_callback(
ca_context *c UNUSED,
sound_callback(ca_context *c UNUSED,
uint32_t id,
int error_code,
void *userdata)
@ -152,9 +153,10 @@ sound_callback(
callback_queue = scb;
scb->scb_id = id;
scb->scb_result = error_code == CA_SUCCESS ? 0
: error_code == CA_ERROR_CANCELED
|| error_code == CA_ERROR_DESTROYED
? 1 : 2;
: error_code == CA_ERROR_CANCELED ||
error_code == CA_ERROR_DESTROYED
? 1
: 2;
scb->scb_callback = soundcb;
}
@ -206,10 +208,10 @@ sound_play_common(typval_T *argvars, typval_T *rettv, int playfile)
if (soundcb == NULL)
{
res = ca_context_play(context, sound_id,
playfile ? CA_PROP_MEDIA_FILENAME : CA_PROP_EVENT_ID,
playfile ? CA_PROP_MEDIA_FILENAME
: CA_PROP_EVENT_ID,
tv_get_string(&argvars[0]),
CA_PROP_CANBERRA_CACHE_CONTROL, "volatile",
NULL);
CA_PROP_CANBERRA_CACHE_CONTROL, "volatile", NULL);
}
else
{
@ -325,12 +327,12 @@ sound_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
mciSendStringA(buf, NULL, 0, 0);
long result = wParam == MCI_NOTIFY_SUCCESSFUL ? 0
: wParam == MCI_NOTIFY_ABORTED ? 1 : 2;
: wParam == MCI_NOTIFY_ABORTED ? 1
: 2;
call_sound_callback(p, p->snd_id, result);
delete_sound_callback(p);
redraw_after_callback(TRUE, FALSE);
}
break;
}
@ -344,11 +346,11 @@ sound_window(void)
if (g_hWndSound == NULL)
{
LPCSTR clazz = "VimSound";
WNDCLASS wndclass = {
0, sound_wndproc, 0, 0, g_hinst, NULL, 0, 0, NULL, clazz };
WNDCLASS wndclass = { 0, sound_wndproc, 0, 0, g_hinst, NULL, 0,
0, NULL, clazz };
RegisterClass(&wndclass);
g_hWndSound = CreateWindow(clazz, NULL, 0, 0, 0, 0, 0,
HWND_MESSAGE, NULL, g_hinst, NULL);
g_hWndSound = CreateWindow(clazz, NULL, 0, 0, 0, 0, 0, HWND_MESSAGE,
NULL, g_hinst, NULL);
}
return g_hWndSound;
@ -393,7 +395,8 @@ f_sound_playfile(typval_T *argvars, typval_T *rettv)
{
return;
}
vim_snprintf((char *)p, len, "open \"%s\" alias sound%06ld", filename, newid);
vim_snprintf((char *)p, len, "open \"%s\" alias sound%06ld", filename,
newid);
wp = enc_to_utf16((char_u *)p, NULL);
free(p);

View File

@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
879,
/**/
878,
/**/