#209 large.c fix oversized arrays by 0-filling; const args, casts

This commit is contained in:
gitlost 2021-02-11 13:51:07 +00:00
parent 4875a3bcac
commit ebcd0a0d6d
4 changed files with 37 additions and 34 deletions

View file

@ -2,7 +2,7 @@
/*
libzint - the open source barcode library
Copyright (C) 2008 - 2020 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008 - 2021 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -54,24 +54,24 @@ typedef struct { uint64_t lo; uint64_t hi; } large_int;
/* Set 128-bit `t` from 64-bit `s` */
#define large_load_u64(t, s) do { (t)->lo = (s); (t)->hi = 0; } while (0)
INTERNAL void large_load_str_u64(large_int *t, const unsigned char *s, int length);
INTERNAL void large_load_str_u64(large_int *t, const unsigned char *s, const int length);
INTERNAL void large_add(large_int *t, const large_int *s);
INTERNAL void large_add_u64(large_int *t, uint64_t s);
INTERNAL void large_add_u64(large_int *t, const uint64_t s);
INTERNAL void large_sub_u64(large_int *t, uint64_t s);
INTERNAL void large_sub_u64(large_int *t, const uint64_t s);
INTERNAL void large_mul_u64(large_int *t, uint64_t s);
INTERNAL void large_mul_u64(large_int *t, const uint64_t s);
INTERNAL uint64_t large_div_u64(large_int *t, uint64_t v);
INTERNAL void large_unset_bit(large_int *t, int bit);
INTERNAL void large_unset_bit(large_int *t, const int bit);
INTERNAL void large_uint_array(const large_int *t, unsigned int *uint_array, int size, int bits);
INTERNAL void large_uchar_array(const large_int *t, unsigned char *uchar_array, int size, int bits);
INTERNAL void large_uint_array(const large_int *t, unsigned int *uint_array, const int size, int bits);
INTERNAL void large_uchar_array(const large_int *t, unsigned char *uchar_array, const int size, int bits);
INTERNAL void large_print(large_int *t);
INTERNAL char *large_dump(large_int *t, char *buf);
INTERNAL void large_print(const large_int *t);
INTERNAL char *large_dump(const large_int *t, char *buf);
#ifdef __cplusplus
}