Mercurial > vim
comparison src/ui.c @ 29109:c1c795a61545 v8.2.5075
patch 8.2.5075: clang gives an out of bounds warning
Commit: https://github.com/vim/vim/commit/b74e04649168aec579183dfef70b8784d2afe993
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jun 10 14:52:35 2022 +0100
patch 8.2.5075: clang gives an out of bounds warning
Problem: Clang gives an out of bounds warning.
Solution: adjust conditional expression (John Marriott)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 10 Jun 2022 16:00:05 +0200 |
parents | d0241e74bfdb |
children | 71137f73c94d |
comparison
equal
deleted
inserted
replaced
29108:e5b1a1fd25b6 | 29109:c1c795a61545 |
---|---|
895 fill_input_buf(TRUE); | 895 fill_input_buf(TRUE); |
896 if (maxlen > inbufcount) | 896 if (maxlen > inbufcount) |
897 maxlen = inbufcount; | 897 maxlen = inbufcount; |
898 mch_memmove(buf, inbuf, (size_t)maxlen); | 898 mch_memmove(buf, inbuf, (size_t)maxlen); |
899 inbufcount -= maxlen; | 899 inbufcount -= maxlen; |
900 if (inbufcount) | 900 // check "maxlen" to avoid clang warning |
901 if (inbufcount > 0 && maxlen > 0) | |
901 mch_memmove(inbuf, inbuf + maxlen, (size_t)inbufcount); | 902 mch_memmove(inbuf, inbuf + maxlen, (size_t)inbufcount); |
902 return (int)maxlen; | 903 return (int)maxlen; |
903 } | 904 } |
904 | 905 |
905 void | 906 void |