comparison src/sound.c @ 25356:1cde96e768e4 v8.2.3215

patch 8.2.3215: Vim9: argument types are not checked at compile time Commit: https://github.com/vim/vim/commit/5bca906b307728fa74a112914dc55b424d512d39 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sat Jul 24 21:33:26 2021 +0200 patch 8.2.3215: Vim9: argument types are not checked at compile time Problem: Vim9: argument types are not checked at compile time. Solution: Add several more type checks. Sort the argument lists. (Yegappan Lakshmanan, closes #8626)
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Jul 2021 21:45:04 +0200
parents 237dace53473
children e8e2c4d33b9b
comparison
equal deleted inserted replaced
25355:efef27c0f8a0 25356:1cde96e768e4
177 } 177 }
178 178
179 static void 179 static void
180 sound_play_common(typval_T *argvars, typval_T *rettv, int playfile) 180 sound_play_common(typval_T *argvars, typval_T *rettv, int playfile)
181 { 181 {
182 if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
183 return;
184
182 if (context == NULL) 185 if (context == NULL)
183 ca_context_create(&context); 186 ca_context_create(&context);
184 if (context != NULL) 187 if (context != NULL)
185 { 188 {
186 soundcb_T *soundcb = get_sound_callback(&argvars[1]); 189 soundcb_T *soundcb = get_sound_callback(&argvars[1]);
349 void 352 void
350 f_sound_playevent(typval_T *argvars, typval_T *rettv) 353 f_sound_playevent(typval_T *argvars, typval_T *rettv)
351 { 354 {
352 WCHAR *wp; 355 WCHAR *wp;
353 356
357 if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
358 return;
359
354 wp = enc_to_utf16(tv_get_string(&argvars[0]), NULL); 360 wp = enc_to_utf16(tv_get_string(&argvars[0]), NULL);
355 if (wp == NULL) 361 if (wp == NULL)
356 return; 362 return;
357 363
358 if (PlaySoundW(wp, NULL, SND_ASYNC | SND_ALIAS)) 364 if (PlaySoundW(wp, NULL, SND_ASYNC | SND_ALIAS))
369 WCHAR *wp; 375 WCHAR *wp;
370 soundcb_T *soundcb; 376 soundcb_T *soundcb;
371 char buf[32]; 377 char buf[32];
372 MCIERROR err; 378 MCIERROR err;
373 379
380 if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
381 return;
382
374 esc = vim_strsave_shellescape(tv_get_string(&argvars[0]), FALSE, FALSE); 383 esc = vim_strsave_shellescape(tv_get_string(&argvars[0]), FALSE, FALSE);
375 384
376 len = STRLEN(esc) + 5 + 18 + 1; 385 len = STRLEN(esc) + 5 + 18 + 1;
377 p = alloc(len); 386 p = alloc(len);
378 if (p == NULL) 387 if (p == NULL)