[neovim] 05/08: Use PRId64 to format Integer when calling api_set_error

James McCoy jamessan at debian.org
Mon Nov 13 02:55:42 UTC 2017


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch debian/sid
in repository neovim.

commit c744a834d483ea52b02363751d50c65417778d70
Author: James McCoy <jamessan at jamessan.com>
Date:   Sat Nov 11 10:48:04 2017 -0500

    Use PRId64 to format Integer when calling api_set_error
    
    Integer is a 64-bit type so using %d can produce incorrect results.
    
        test/functional/api/highlight_spec.lua @ 35: highlight api nvim_get_hl_by_id
        ...W7Xi/neovim-0.2.1/test/functional/api/highlight_spec.lua:46: Expected objects to be the same.
        Passed in:
        (string) 'Invalid highlight id: 7671724'
        Expected:
        (string) 'Invalid highlight id: 30000'
---
 src/nvim/api/vim.c | 3 ++-
 src/nvim/syntax.c  | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index e5ec018..d2b0e32 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -89,7 +89,8 @@ Dictionary nvim_get_hl_by_id(Integer hl_id, Boolean rgb, Error *err)
 {
   Dictionary dic = ARRAY_DICT_INIT;
   if (syn_get_final_id((int)hl_id) == 0) {
-    api_set_error(err, kErrorTypeException, "Invalid highlight id: %d", hl_id);
+    api_set_error(err, kErrorTypeException,
+                  "Invalid highlight id: %" PRId64, hl_id);
     return dic;
   }
   int attrcode = syn_id2attr((int)hl_id);
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 913fd05..6549076 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -8256,7 +8256,7 @@ Dictionary hl_get_attr_by_id(Integer attr_id, Boolean rgb, Error *err)
   attrentry_T *aep = syn_cterm_attr2entry((int)attr_id);
   if (!aep) {
     api_set_error(err, kErrorTypeException,
-                  "Invalid attribute id: %d", attr_id);
+                  "Invalid attribute id: %" PRId64, attr_id);
     return dic;
   }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vim/neovim.git



More information about the pkg-vim-maintainers mailing list