summaryrefslogtreecommitdiff
path: root/src/bin/embryo
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-07-13 13:16:34 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-07-13 13:19:01 +0900
commit3d16cdc67e66642e12279edeb5c90438e9dc7f21 (patch)
treeec13abdd6cc8c55bef967fed019a75f13496f9c6 /src/bin/embryo
parentbed1e28d8505f9c013ef3f7b5edeb284c2736855 (diff)
embro_cc: Shut up some coverity warning
CID 1039677 1039678 1039679 The expression's value does not depend on the operands; often, this represents an inadvertent logic error. In doarg: An operation with non-constant operands that computes a result with constant value (CWE-569) cell is defined as an int, not a long, so it can't be > INT_MAX.
Diffstat (limited to 'src/bin/embryo')
-rw-r--r--src/bin/embryo/embryo_cc_amx.h1
-rw-r--r--src/bin/embryo/embryo_cc_sc1.c6
2 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/embryo/embryo_cc_amx.h b/src/bin/embryo/embryo_cc_amx.h
index 0118e2d2af..5a00e525f8 100644
--- a/src/bin/embryo/embryo_cc_amx.h
+++ b/src/bin/embryo/embryo_cc_amx.h
@@ -47,6 +47,7 @@
47 typedef unsigned int ucell; 47 typedef unsigned int ucell;
48 typedef int cell; 48 typedef int cell;
49#endif 49#endif
50#define CELL_MAX INT_MAX /* assume cell is always int */
50 51
51 struct tagAMX; 52 struct tagAMX;
52 typedef cell(*AMX_NATIVE) (struct tagAMX * amx, 53 typedef cell(*AMX_NATIVE) (struct tagAMX * amx,
diff --git a/src/bin/embryo/embryo_cc_sc1.c b/src/bin/embryo/embryo_cc_sc1.c
index b53693495e..2ca1aaf559 100644
--- a/src/bin/embryo/embryo_cc_sc1.c
+++ b/src/bin/embryo/embryo_cc_sc1.c
@@ -1071,7 +1071,7 @@ declglb(char *firstname, int firsttag, int fpublic, int fstatic,
1071 error(52); /* only last dimension may be variable length */ 1071 error(52); /* only last dimension may be variable length */
1072 size = needsub(&idxtag[numdim]); /* get size; size==0 for 1072 size = needsub(&idxtag[numdim]); /* get size; size==0 for
1073 * "var[]" */ 1073 * "var[]" */
1074#if INT_MAX < LONG_MAX 1074#if INT_MAX < CELL_MAX
1075 if (size > INT_MAX) 1075 if (size > INT_MAX)
1076 error(105); /* overflow, exceeding capacity */ 1076 error(105); /* overflow, exceeding capacity */
1077#endif 1077#endif
@@ -1212,7 +1212,7 @@ declloc(int fstatic)
1212 if (numdim > 0 && dim[numdim - 1] == 0) 1212 if (numdim > 0 && dim[numdim - 1] == 0)
1213 error(52); /* only last dimension may be variable length */ 1213 error(52); /* only last dimension may be variable length */
1214 size = needsub(&idxtag[numdim]); /* get size; size==0 for "var[]" */ 1214 size = needsub(&idxtag[numdim]); /* get size; size==0 for "var[]" */
1215#if INT_MAX < LONG_MAX 1215#if INT_MAX < CELL_MAX
1216 if (size > INT_MAX) 1216 if (size > INT_MAX)
1217 error(105); /* overflow, exceeding capacity */ 1217 error(105); /* overflow, exceeding capacity */
1218#endif 1218#endif
@@ -2668,7 +2668,7 @@ doarg(char *name, int ident, int offset, int tags[], int numtags,
2668 */ 2668 */
2669 size = needsub(&idxtag[arg->numdim]); /* may be zero here, 2669 size = needsub(&idxtag[arg->numdim]); /* may be zero here,
2670 *it is a pointer anyway */ 2670 *it is a pointer anyway */
2671#if INT_MAX < LONG_MAX 2671#if INT_MAX < CELL_MAX
2672 if (size > INT_MAX) 2672 if (size > INT_MAX)
2673 error(105); /* overflow, exceeding capacity */ 2673 error(105); /* overflow, exceeding capacity */
2674#endif 2674#endif