Hi,

2015/7/18 Sat 2:27:42 UTC+9 rexdf wrote:
> What's the difference between `vim_snprintf` and `snprintf`?
> 
> Only patch 786 in option.c has snprintf. And it fails on VC build.
> 
> 
> option.obj : error LNK2001: unresolved external symbol snprintf
> gvim.exe : fatal error LNK1120: 1 unresolved externals
> NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 
> 12.0
> \VC\BIN\amd64\link.EXE"' : return code '0x460'

I think vim_snprintf should be used instead of snprintf.


--- a/src/option.c
+++ b/src/option.c
@@ -8314,9 +8314,9 @@ set_bool_option(opt_idx, varp, value, op
     if (!starting)
     {
        char_u buf_old[2], buf_new[2], buf_type[7];
-       snprintf((char *)buf_old, 2, "%d", old_value ? TRUE: FALSE);
-       snprintf((char *)buf_new, 2, "%d", value ? TRUE: FALSE);
-       sprintf((char *)buf_type, "%s", (opt_flags & OPT_LOCAL) ? "local" : 
"global");
+       vim_snprintf((char *)buf_old, 2, "%d", old_value ? TRUE: FALSE);
+       vim_snprintf((char *)buf_new, 2, "%d", value ? TRUE: FALSE);
+       vim_snprintf((char *)buf_type, 7, "%s", (opt_flags & OPT_LOCAL) ? 
"local" : "global");
        set_vim_var_string(VV_OPTION_NEW, buf_new, -1);
        set_vim_var_string(VV_OPTION_OLD, buf_old, -1);
        set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
@@ -8864,9 +8864,9 @@ set_num_option(opt_idx, varp, value, err
     if (!starting && errmsg == NULL)
     {
        char_u buf_old[11], buf_new[11], buf_type[7];
-       snprintf((char *)buf_old, 10, "%ld", old_value);
-       snprintf((char *)buf_new, 10, "%ld", value);
-       snprintf((char *)buf_type, 7, "%s", (opt_flags & OPT_LOCAL) ? "local" : 
"global");
+       vim_snprintf((char *)buf_old, 10, "%ld", old_value);
+       vim_snprintf((char *)buf_new, 10, "%ld", value);
+       vim_snprintf((char *)buf_type, 7, "%s", (opt_flags & OPT_LOCAL) ? 
"local" : "global");
        set_vim_var_string(VV_OPTION_NEW, buf_new, -1);
        set_vim_var_string(VV_OPTION_OLD, buf_old, -1);
        set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);

Regards,
Ken Takata

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui