diff -Nru lcrq-0.1.0/CHANGELOG.md lcrq-0.1.1/CHANGELOG.md --- lcrq-0.1.0/CHANGELOG.md 2023-07-21 21:05:10.000000000 +0000 +++ lcrq-0.1.1/CHANGELOG.md 2023-08-16 15:24:18.000000000 +0000 @@ -4,6 +4,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.1] - 2023-08-16 + +Minor bugfixes. + +### Added +- added arc4random_uniform() support to rq_random_esi() + +### Fixed +- install/uninstall targets use ABI version correctly +- fix realclean make target - remove all built files +- rq_random_esi(): bugfix: ensure value is >= min and <= RQ_ESI_MAX when reading from /dev/urandom +- fix time_t overflow on 32 bit systems +- remove `time` from make speedtest target (not a builtin) +- rq_decode: check return value of rq_encode_symbol +- configure: test if clock_gettime() requires -lrt +- fix warning in example program +- fixing compiler warnings + ## [0.1.0] - 2023-07-21 ### Added diff -Nru lcrq-0.1.0/configure lcrq-0.1.1/configure --- lcrq-0.1.0/configure 2023-07-21 21:05:10.000000000 +0000 +++ lcrq-0.1.1/configure 2023-08-16 15:24:18.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for lcrq 0.1.0. +# Generated by GNU Autoconf 2.71 for lcrq 0.1.1. # # Report bugs to . # @@ -614,8 +614,8 @@ # Identity of this package. PACKAGE_NAME='lcrq' PACKAGE_TARNAME='lcrq' -PACKAGE_VERSION='0.1.0' -PACKAGE_STRING='lcrq 0.1.0' +PACKAGE_VERSION='0.1.1' +PACKAGE_STRING='lcrq 0.1.1' PACKAGE_BUGREPORT='bugs@librecast.net' PACKAGE_URL='' @@ -1282,7 +1282,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures lcrq 0.1.0 to adapt to many kinds of systems. +\`configure' configures lcrq 0.1.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1348,7 +1348,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of lcrq 0.1.0:";; + short | recursive ) echo "Configuration of lcrq 0.1.1:";; esac cat <<\_ACEOF @@ -1440,7 +1440,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -lcrq configure 0.1.0 +lcrq configure 0.1.1 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1819,7 +1819,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by lcrq $as_me 0.1.0, which was +It was created by lcrq $as_me 0.1.1, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3754,6 +3754,71 @@ # Checks for libraries. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 +printf %s "checking for library containing clock_gettime... " >&6; } +if test ${ac_cv_search_clock_gettime+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (void); +int +main (void) +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_clock_gettime=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_clock_gettime+y} +then : + break +fi +done +if test ${ac_cv_search_clock_gettime+y} +then : + +else $as_nop + ac_cv_search_clock_gettime=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 +printf "%s\n" "$ac_cv_search_clock_gettime" >&6; } +ac_res=$ac_cv_search_clock_gettime +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5 printf %s "checking for dlsym in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlsym+y} @@ -3801,6 +3866,71 @@ fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing arc4random_uniform" >&5 +printf %s "checking for library containing arc4random_uniform... " >&6; } +if test ${ac_cv_search_arc4random_uniform+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char arc4random_uniform (void); +int +main (void) +{ +return arc4random_uniform (); + ; + return 0; +} +_ACEOF +for ac_lib in '' libbsd +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_arc4random_uniform=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_arc4random_uniform+y} +then : + break +fi +done +if test ${ac_cv_search_arc4random_uniform+y} +then : + +else $as_nop + ac_cv_search_arc4random_uniform=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_arc4random_uniform" >&5 +printf "%s\n" "$ac_cv_search_arc4random_uniform" >&6; } +ac_res=$ac_cv_search_arc4random_uniform +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + # Check whether --with-sodium was given. if test ${with_sodium+y} @@ -4711,6 +4841,12 @@ fi +ac_fn_c_check_func "$LINENO" "arc4random_uniform" "ac_cv_func_arc4random_uniform" +if test "x$ac_cv_func_arc4random_uniform" = xyes +then : + printf "%s\n" "#define HAVE_ARC4RANDOM_UNIFORM 1" >>confdefs.h + +fi ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" if test "x$ac_cv_func_clock_gettime" = xyes then : @@ -5274,7 +5410,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by lcrq $as_me 0.1.0, which was +This file was extended by lcrq $as_me 0.1.1, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5338,7 +5474,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -lcrq config.status 0.1.0 +lcrq config.status 0.1.1 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff -Nru lcrq-0.1.0/configure.ac lcrq-0.1.1/configure.ac --- lcrq-0.1.0/configure.ac 2023-07-21 21:05:10.000000000 +0000 +++ lcrq-0.1.1/configure.ac 2023-08-16 15:24:18.000000000 +0000 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.71]) -AC_INIT([lcrq],[0.1.0],[bugs@librecast.net]) +AC_INIT([lcrq],[0.1.1],[bugs@librecast.net]) AC_SUBST(PACKAGE_ABIVERS, 0.0) AC_COPYRIGHT(Copyright (c) 2022-2023 Brett Sheffield See COPYING for license details. @@ -26,7 +26,9 @@ AC_SUBST([TESTRUNNER],[$testrunner]) # Checks for libraries. +AC_SEARCH_LIBS([clock_gettime], [rt]) AC_CHECK_LIB([dl], [dlsym], AC_SUBST([LIBDL], ["-ldl"])) +AC_SEARCH_LIBS([arc4random_uniform], [libbsd]) AC_ARG_WITH(sodium, AS_HELP_STRING([--with-sodium], [use libsodium for encryption and \ hashing (default is yes, if available)]), @@ -71,7 +73,7 @@ AC_FUNC_MALLOC AC_FUNC_MMAP AC_FUNC_REALLOC -AC_CHECK_FUNCS([clock_gettime floor getrandom memset munmap]) +AC_CHECK_FUNCS([arc4random_uniform clock_gettime floor getrandom memset munmap]) # Required only for example programs AC_TYPE_MODE_T diff -Nru lcrq-0.1.0/debian/changelog lcrq-0.1.1/debian/changelog --- lcrq-0.1.0/debian/changelog 2023-07-22 02:09:59.000000000 +0000 +++ lcrq-0.1.1/debian/changelog 2023-08-16 17:03:12.000000000 +0000 @@ -1,3 +1,10 @@ +lcrq (0.1.1-1) unstable; urgency=medium + + * New upstream bugfix release. + * debian/rules: Pass "speedtest" to dh_auto_test. + + -- Vagrant Cascadian Wed, 16 Aug 2023 10:03:12 -0700 + lcrq (0.1.0-1) unstable; urgency=medium * New upstream release. diff -Nru lcrq-0.1.0/debian/rules lcrq-0.1.1/debian/rules --- lcrq-0.1.0/debian/rules 2023-03-25 04:26:53.000000000 +0000 +++ lcrq-0.1.1/debian/rules 2023-08-10 19:38:38.000000000 +0000 @@ -8,7 +8,7 @@ dh $@ override_dh_auto_test: - dh_auto_test --no-parallel + dh_auto_test --no-parallel -- speedtest override_dh_auto_install: dh_auto_install -- PREFIX=/usr diff -Nru lcrq-0.1.0/doc/Makefile.in lcrq-0.1.1/doc/Makefile.in --- lcrq-0.1.0/doc/Makefile.in 2023-07-21 21:05:10.000000000 +0000 +++ lcrq-0.1.1/doc/Makefile.in 2023-08-16 15:24:18.000000000 +0000 @@ -1,6 +1,6 @@ PREFIX ?= /usr/local -.PHONY: doc install +.PHONY: clean doc install realclean doc: install @@ -9,3 +9,8 @@ install *.3 $(DESTDIR)$(PREFIX)/share/man/man3/ install -d $(DESTDIR)$(PREFIX)/share/man/man7 install *.7 $(DESTDIR)$(PREFIX)/share/man/man7/ + +clean: + +realclean: clean + $(RM) -f Makefile diff -Nru lcrq-0.1.0/examples/Makefile.in lcrq-0.1.1/examples/Makefile.in --- lcrq-0.1.0/examples/Makefile.in 2023-07-21 21:05:10.000000000 +0000 +++ lcrq-0.1.1/examples/Makefile.in 2023-08-16 15:24:18.000000000 +0000 @@ -10,6 +10,8 @@ .PHONY: clean realclean clean: - rm -f $(PROGRAMS) + $(RM) -f $(PROGRAMS) realclean: clean + $(RM) -f Makefile + diff -Nru lcrq-0.1.0/examples/params.c lcrq-0.1.1/examples/params.c --- lcrq-0.1.0/examples/params.c 2023-07-21 21:05:10.000000000 +0000 +++ lcrq-0.1.1/examples/params.c 2023-08-16 15:24:18.000000000 +0000 @@ -7,9 +7,10 @@ #include #include -int usage(const char *progname) +int usage(const char *progname, int rc) { fprintf(stderr, "usage: `%s F T` (F = object size, T = symbol size)\n", progname); + return rc; } int main(int argc, char *argv[]) @@ -19,7 +20,7 @@ uint16_t T, K, KP, N, Z; uint8_t Al; - if (argc != 3) return usage(argv[0]); + if (argc != 3) return usage(argv[0], EXIT_FAILURE); F = atoll(argv[1]); T = atoll(argv[2]); diff -Nru lcrq-0.1.0/Makefile.in lcrq-0.1.1/Makefile.in --- lcrq-0.1.0/Makefile.in 2023-07-21 21:05:10.000000000 +0000 +++ lcrq-0.1.1/Makefile.in 2023-08-16 15:24:18.000000000 +0000 @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only -# Copyright (c) 2022 Brett Sheffield +# Copyright (c) 2022-2023 Brett Sheffield PREFIX ?= /usr/local export PREFIX @@ -29,11 +29,11 @@ all: src install: all doc - cd src && $(MAKE) $@ - cd doc && $(MAKE) $@ + $(MAKE) -C src $@ + $(MAKE) -C doc $@ uninstall: - cd src && $(MAKE) $@ + $(MAKE) -C src $@ .PHONY: clean realclean src test sparse examples @@ -49,20 +49,23 @@ speedtest: src $(MAKE) -C test $@ -clean realclean: +clean: $(MAKE) -C src $@ $(MAKE) -C test $@ - rm -rf ./$(COVERITY_DIR) - rm -f $(COVERITY_TGZ) -check test sanitize: src - cd test && $(MAKE) $@ +realclean: clean + $(MAKE) -C src $@ + $(MAKE) -C test $@ + $(RM) -r ./$(COVERITY_DIR) + $(RM) $(COVERITY_TGZ) + $(RM) Makefile + $(RM) config.{log,status} + $(RM) include/lcrq.h -%.test %.check %.debug: src - cd test && $(MAKE) $@ +check sanitize: src + $(MAKE) -C test $@ -test sanitize: src - $(MAKE) -C libs $@ +%.test %.check %.debug: src $(MAKE) -C test $@ test memcheck: src @@ -75,5 +78,5 @@ coverity: clean - PATH=$(PATH):../coverity/bin/ cov-build --dir cov-int $(MAKE) src + PATH=$(PATH):../../coverity/bin/ cov-build --dir cov-int $(MAKE) src tar czvf $(COVERITY_TGZ) $(COVERITY_DIR) diff -Nru lcrq-0.1.0/src/config.h.in lcrq-0.1.1/src/config.h.in --- lcrq-0.1.0/src/config.h.in 2023-07-21 21:05:10.000000000 +0000 +++ lcrq-0.1.1/src/config.h.in 2023-08-16 15:24:18.000000000 +0000 @@ -3,6 +3,9 @@ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD +/* Define to 1 if you have the `arc4random_uniform' function. */ +#undef HAVE_ARC4RANDOM_UNIFORM + /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H diff -Nru lcrq-0.1.0/src/lcrq.c lcrq-0.1.1/src/lcrq.c --- lcrq-0.1.0/src/lcrq.c 2023-07-21 21:05:10.000000000 +0000 +++ lcrq-0.1.1/src/lcrq.c 2023-08-16 15:24:18.000000000 +0000 @@ -40,6 +40,7 @@ } /* return number of bits set in bitmap (Hamming Weight / popcount) */ +#ifdef RQ_TRACK_COMPONENTS inline static unsigned int hamm(const unsigned char *map, size_t len) { unsigned int c = 0; @@ -50,6 +51,7 @@ #endif return c; } +#endif /* convert ESI to ISI (5.3.1) */ inline static uint32_t esi2isi(const rq_t *rq, const uint32_t esi) @@ -149,9 +151,11 @@ static uint32_t rq_random_esi(uint32_t min) { /* NB: ESI is a 24-bit unsigned integer (3.2) */ - uint32_t esi; + uint32_t esi = UINT32_MAX; #ifdef HAVE_LIBSODIUM esi = randombytes_uniform(RQ_ESI_MAX - min) + min; +#elif defined (HAVE_ARC4RANDOM_UNIFORM) + esi = arc4random_uniform(RQ_ESI_MAX - min) + min; #else /* read 24 bits (3 bytes) from /dev/random */ ssize_t byt, len = 3; @@ -163,14 +167,16 @@ while ((byt = getrandom(a, len, 0)) != len) { #else static int f; /* we'll keep the handle until program exit */ - if (!f) f = open("/dev/urandom", O_RDONLY); + if (!f) { + f = open("/dev/urandom", O_RDONLY); + if (f == -1) return (f = 0), esi; + } while ((byt = read(f, a, len)) != len) { #endif if (byt == -1) break; a += byt; len -= byt; } - esi += min; - esi &= RQ_ESI_MAX; /* mask overflow */ + esi = min + (esi % (RQ_ESI_MAX - min)); #endif return esi; } @@ -190,6 +196,7 @@ matrix_t C = rq_matrix_C_by_SBN(rq, sbn); if ((flags & RQ_RAND) == RQ_RAND) { esi = rq_random_esi(rq->K); + if (esi == UINT32_MAX) return NULL; *pid = rq_pidsetesi(*pid, esi); } else esi = rq_pid2esi(*pid); @@ -514,7 +521,9 @@ matrix_free(&D); matrix_new(&Cm, rq->L, rq->T, C, 0); for (int esi = 0; esi < rq->K; esi++) { - rq_encode_symbol(rq, &Cm, esi, dec + rq->T * esi); + if (!rq_encode_symbol(rq, &Cm, esi, dec + rq->T * esi)) { + rc = -1; break; + } } free(C); fail: diff -Nru lcrq-0.1.0/src/Makefile.in lcrq-0.1.1/src/Makefile.in --- lcrq-0.1.0/src/Makefile.in 2023-07-21 21:05:10.000000000 +0000 +++ lcrq-0.1.1/src/Makefile.in 2023-08-16 15:24:18.000000000 +0000 @@ -5,6 +5,10 @@ LIBNAME := @PACKAGE_NAME@ VERSION := @PACKAGE_VERSION@ ABIVERS := @PACKAGE_ABIVERS@ +ABIPARTS = $(subst ., ,$(ABIVERS)) +SOMAJOR := $(word 1, $(ABIPARTS)) +SOMINOR := $(word 2, $(ABIPARTS)) +SOBUILD := $(word 3, $(ABIPARTS)) .SUFFIXES: .SUFFIXES: .c .o CFLAGS += -fPIC @@ -33,17 +37,18 @@ install: $(SOFILES) $(INSTALL) -d $(LIBDIR) $(INSTALL) -d $(INCLUDEDIR) - $(INSTALL_DATA) lib$(LIBNAME).so $(LIBDIR)/lib$(LIBNAME).so.$(VERSION) + $(INSTALL_DATA) lib$(LIBNAME).so $(LIBDIR)/lib$(LIBNAME).so.$(ABIVERS) cp -r ../include/*.h $(INCLUDEDIR) ln -sf lib$(LIBNAME).so.$(ABIVERS) $(LIBDIR)/lib$(LIBNAME).so - ln -sf lib$(LIBNAME).so.$(VERSION) $(LIBDIR)/lib$(LIBNAME).so.$(ABIVERS) + ln -sf lib$(LIBNAME).so.$(ABIVERS) $(LIBDIR)/lib$(LIBNAME).so.$(SOMAJOR) .PHONY: clean realclean uninstall uninstall: - cd $(LIBDIR) && rm -f lib$(LIBNAME).so lib$(LIBNAME).so.$(ABIVERS) lib$(LIBNAME).so.$(VERSION) + cd $(LIBDIR) && $(RM) lib$(LIBNAME).so lib$(LIBNAME).so.$(ABIVERS) lib$(LIBNAME).so.$(SOMAJOR) clean: $(RM) *.o $(SOFILES) $(ABIFILES) realclean: clean + $(RM) Makefile config.h diff -Nru lcrq-0.1.0/test/0000-0022.c lcrq-0.1.1/test/0000-0022.c --- lcrq-0.1.0/test/0000-0022.c 2023-07-21 21:05:10.000000000 +0000 +++ lcrq-0.1.1/test/0000-0022.c 2023-08-16 15:24:18.000000000 +0000 @@ -9,7 +9,7 @@ static uint64_t F = 16; static uint16_t T = 4; -static void dump_buffer(const rq_t *rq, const uint8_t *sym, FILE *stream) +static void dump_buffer(const uint8_t *sym, FILE *stream) { for (uint64_t i = 0; i < F; i++) { fprintf(stream, " %02x", sym[i]); @@ -54,8 +54,8 @@ rq_free(rq); /* log results */ - fprintf(stderr, "orig: "); dump_buffer(rq, data, stderr); - fprintf(stderr, "copy: "); dump_buffer(rq, copy, stderr); + fprintf(stderr, "orig: "); dump_buffer(data, stderr); + fprintf(stderr, "copy: "); dump_buffer(copy, stderr); /* and compare */ test_assert(!memcmp(data, copy, F), "regenerated data matches original"); diff -Nru lcrq-0.1.0/test/Makefile.in lcrq-0.1.1/test/Makefile.in --- lcrq-0.1.0/test/Makefile.in 2023-07-21 21:05:10.000000000 +0000 +++ lcrq-0.1.1/test/Makefile.in 2023-08-16 15:24:18.000000000 +0000 @@ -50,7 +50,7 @@ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) speedtest: speedtest.00 - time ./speedtest.00 32768 1024 1000 + ./speedtest.00 32768 1024 1000 rm -f gmon.out %.test: %.c $(OBJS) @@ -91,11 +91,12 @@ fi clean: - rm -f *.o *.test testlog-?????? $(LASTLOG) + $(RM) *.o *.test testlog-?????? $(LASTLOG) + $(RM) speedtest.00 realclean: clean - rm -f lsdb-test-?????? ????-????.test.valgrind - rm -rf ????-????.tmp.* *core* - rm -rf ????-????.*.tmp* - rm -f gmon.out - rm -f speedtest.00 + $(RM) lsdb-test-?????? ????-????.test.valgrind + $(RM) -r ????-????.tmp.* *core* + $(RM) ????-????.*.tmp* + $(RM) gmon.out + $(RM) Makefile diff -Nru lcrq-0.1.0/test/speedtest.00.c lcrq-0.1.1/test/speedtest.00.c --- lcrq-0.1.0/test/speedtest.00.c 2023-07-21 21:05:10.000000000 +0000 +++ lcrq-0.1.1/test/speedtest.00.c 2023-08-16 15:24:18.000000000 +0000 @@ -17,7 +17,7 @@ #define DECODER_RFC 1 #define DECODER_DEFAULT DECODER_RFC -#define NANO 1000000000 +#define NANO 1000000000ULL #define DEFAULT_REPS 1 #define DEFAULT_F 42 @@ -136,8 +136,8 @@ clock_gettime(CLOCK_REALTIME, &ts_enc_end); /* encoder stats */ - uint64_t ensec = (ts_enc_end.tv_sec * NANO + ts_enc_end.tv_nsec); - ensec -= (ts_enc_start.tv_sec * NANO + ts_enc_start.tv_nsec); + uint64_t ensec = ((uint64_t)ts_enc_end.tv_sec * NANO + (uint64_t)ts_enc_end.tv_nsec); + ensec -= ((uint64_t)ts_enc_start.tv_sec * NANO + (uint64_t)ts_enc_start.tv_nsec); double edsec = (double)ensec / NANO; bytes_total_encoder += F; s_total_encoder += edsec; @@ -157,8 +157,8 @@ free(dec); /* decoder stats */ - uint64_t dnsec = (ts_dec_end.tv_sec * NANO + ts_dec_end.tv_nsec); - dnsec -= (ts_dec_start.tv_sec * NANO + ts_dec_start.tv_nsec); + uint64_t dnsec = ((uint64_t)ts_dec_end.tv_sec * NANO + (uint64_t)ts_dec_end.tv_nsec); + dnsec -= ((uint64_t)ts_dec_start.tv_sec * NANO + (uint64_t)ts_dec_start.tv_nsec); double ddsec = (double)dnsec / NANO; s_total_decoder += ddsec; if (ok == 0) bytes_total_decoder += F;