From 3b9abf4ae92a090243f7d582ac3f5001103854be Mon Sep 17 00:00:00 2001 From: Simen Gaure Date: Thu, 23 Aug 2018 08:31:19 +0200 Subject: [PATCH] Fix complaint from cran about truncation --- DESCRIPTION | 2 +- src/config.h | 5 +++++ src/demean.c | 7 ++++++- src/kaczmarz.c | 7 ++++++- 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 src/config.h diff --git a/DESCRIPTION b/DESCRIPTION index ce12a46..ed75c01 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: lfe -Version: 2.8-1 +Version: 2.8-2 Date: 2018-08-22 Title: Linear Group Fixed Effects Authors@R: person("Simen", "Gaure", email="Simen.Gaure@frisch.uio.no", role=c("aut","cre")) diff --git a/src/config.h b/src/config.h new file mode 100644 index 0000000..4e47c77 --- /dev/null +++ b/src/config.h @@ -0,0 +1,5 @@ +/* src/config.h. Generated from config.h.in by configure. */ +#define HAVE_SEM 1 +/* #undef NOTHREADS */ +/* #undef HUGE_INT */ +#define HAVE_THREADNAME 1 diff --git a/src/demean.c b/src/demean.c index c96391c..5fd3eca 100644 --- a/src/demean.c +++ b/src/demean.c @@ -279,7 +279,12 @@ static void *demeanlist_thr(void *varg) { #ifdef HAVE_THREADNAME #ifndef USEOMP char thrname[16]; - snprintf(thrname,16, "Ct %5d/%5d",vecnum+1, arg->K); + char buf[256]; + // snprintf(thrname,16, "Ct %d/%d",vecnum+1, arg->K); + // cran whines about truncation + snprintf(buf,256,"Ct %d/%d",vecnum+1, arg->K); + buf[15] = 0; + memcpy(thrname,buf,16); STNAME(thrname); #endif #endif diff --git a/src/kaczmarz.c b/src/kaczmarz.c index 7785f89..222218a 100644 --- a/src/kaczmarz.c +++ b/src/kaczmarz.c @@ -217,7 +217,12 @@ static void *kaczmarz_thr(void *varg) { if(vecnum >= arg->numvec) break; #ifdef HAVE_THREADNAME char thrname[16]; - snprintf(thrname, 16, "Kz %5d/%5d",vecnum+1, arg->numvec); + // cran whines about truncation here, that's the &%#@/%! purpose + //snprintf(thrname, 16, "Kz %d/%d",vecnum+1, arg->numvec); + char buf[256]; + snprintf(buf,256,"Kz %d/%d",vecnum+1, arg->numvec); + buf[15] = 0; + memcpy(thrname,buf,16); STNAME(thrname); #endif