summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-05-26 04:33:54 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-05-26 04:33:54 +0100
commitf4ff12406c9ff4ecf6ebae42b213defff5e92018 (patch)
tree2c8ed30e4ad3c613cc73c0b031a3294f2034ecc7 /src
parent11e4cad03ea7b9863991dfaa86d597ba4640bc43 (diff)
downloadefl-f4ff12406c9ff4ecf6ebae42b213defff5e92018.tar.gz
embryo - embryo_cc - silence some new gcc warnings
lets us focus on real errors in warnings if we have silence
Diffstat (limited to 'src')
-rw-r--r--src/bin/embryo/embryo_cc_sc1.c17
-rw-r--r--src/bin/embryo/embryo_cc_sc5.scp2
-rw-r--r--src/bin/embryo/embryo_cc_sc7.scp2
3 files changed, 16 insertions, 5 deletions
diff --git a/src/bin/embryo/embryo_cc_sc1.c b/src/bin/embryo/embryo_cc_sc1.c
index 8f25be75b5..baaecc5fcd 100644
--- a/src/bin/embryo/embryo_cc_sc1.c
+++ b/src/bin/embryo/embryo_cc_sc1.c
@@ -3032,11 +3032,22 @@ insert_constval(constvalue * prev, constvalue * next, char *name,
cell val, short idx)
{
constvalue *cur;
+ char *s, *d;
- if (!(cur = (constvalue *)malloc(sizeof(constvalue))))
+ if (!(cur = calloc(1, sizeof(constvalue))))
error(103); /* insufficient memory (fatal error) */
- memset(cur, 0, sizeof(constvalue));
- strncpy(cur->name, name, sizeof(cur->name) - 1);
+// strncpy(cur->name, name, sizeof(cur->name) - 1);
+// I'm forced to do the below as new gcc warnings I can't seem to shut up
+// complain so implement in full to get some silence.
+ for (d = cur->name, s = name; ; )
+ {
+ *d++ = *s;
+ if ((size_t)(s - name) < (size_t)(sizeof(cur->name) - 1))
+ {
+ if (*s) s++;
+ }
+ else break;
+ }
cur->name[sizeof(cur->name) - 1] = 0;
cur->value = val;
cur->index = idx;
diff --git a/src/bin/embryo/embryo_cc_sc5.scp b/src/bin/embryo/embryo_cc_sc5.scp
index bf0a606dc8..2ff958fb4a 100644
--- a/src/bin/embryo/embryo_cc_sc5.scp
+++ b/src/bin/embryo/embryo_cc_sc5.scp
@@ -26,7 +26,7 @@ int strexpand(char *dest, unsigned char *source, int maxlen,
#define SCPACK_TABLE errstr_table
/*-*SCPACK start of pair table, do not change or remove this line */
-unsigned char errstr_table[][2] = {
+unsigned char errstr_table[128][2] = {
{101, 32}, {116, 32}, {111, 110}, {105, 110}, {97, 114}, {100, 32}, {105,
130},
{101, 114}, {101, 110}, {115, 32}, {97, 108}, {97, 116}, {117, 110}, {115,
diff --git a/src/bin/embryo/embryo_cc_sc7.scp b/src/bin/embryo/embryo_cc_sc7.scp
index 38f784d3cc..618a68fbd5 100644
--- a/src/bin/embryo/embryo_cc_sc7.scp
+++ b/src/bin/embryo/embryo_cc_sc7.scp
@@ -29,7 +29,7 @@ int strexpand(char *dest, unsigned char *source, int maxlen,
#define SCPACK_TABLE sequences_table
/*-*SCPACK start of pair table, do not change or remove this line */
-unsigned char sequences_table[][2] = {
+unsigned char sequences_table[128][2] = {
{32, 37}, {114, 105}, {112, 129}, {46, 130}, {49, 33}, {128, 132}, {97, 100},
{46, 97}, {135, 108}, {136, 116}, {111, 134}, {108, 138}, {50, 33}, {115,
104},