Merge pull request #1803 from elmart/small-fixes

Small fixes.
This commit is contained in:
Justin M. Keyes 2015-01-16 09:27:09 -05:00
commit 401d738597
3 changed files with 7 additions and 2 deletions

View File

@ -5,6 +5,7 @@ include(CheckIncludeFiles)
check_type_size("int" SIZEOF_INT) check_type_size("int" SIZEOF_INT)
check_type_size("long" SIZEOF_LONG) check_type_size("long" SIZEOF_LONG)
check_type_size("intmax_t" SIZEOF_INTMAX_T)
check_type_size("off_t" SIZEOF_OFF_T) check_type_size("off_t" SIZEOF_OFF_T)
check_type_size("void *" SIZEOF_VOID_PTR) check_type_size("void *" SIZEOF_VOID_PTR)

View File

@ -1695,7 +1695,9 @@ intmax_t getdigits(char_u **pp)
int getdigits_int(char_u **pp) int getdigits_int(char_u **pp)
{ {
intmax_t number = getdigits(pp); intmax_t number = getdigits(pp);
#if SIZEOF_INTMAX_T > SIZEOF_INT
assert(number >= INT_MIN && number <= INT_MAX); assert(number >= INT_MIN && number <= INT_MAX);
#endif
return (int)number; return (int)number;
} }
@ -1705,7 +1707,9 @@ int getdigits_int(char_u **pp)
long getdigits_long(char_u **pp) long getdigits_long(char_u **pp)
{ {
intmax_t number = getdigits(pp); intmax_t number = getdigits(pp);
#if SIZEOF_INTMAX_T > SIZEOF_LONG
assert(number >= LONG_MIN && number <= LONG_MAX); assert(number >= LONG_MIN && number <= LONG_MAX);
#endif
return (long)number; return (long)number;
} }

View File

@ -14,6 +14,7 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdint.h>
#include "nvim/vim.h" #include "nvim/vim.h"
#include "nvim/ascii.h" #include "nvim/ascii.h"
@ -726,8 +727,7 @@ void ex_hardcopy(exarg_T *eap)
if (got_int || settings.user_abort) if (got_int || settings.user_abort)
goto print_fail; goto print_fail;
assert(prtpos.bytes_printed == 0 assert(prtpos.bytes_printed <= SIZE_MAX / 100);
|| prtpos.bytes_printed * 100 > prtpos.bytes_printed);
sprintf((char *)IObuff, _("Printing page %d (%zu%%)"), sprintf((char *)IObuff, _("Printing page %d (%zu%%)"),
page_count + 1 + side, page_count + 1 + side,
prtpos.bytes_printed * 100 / bytes_to_print); prtpos.bytes_printed * 100 / bytes_to_print);