diff --git a/src/array.c b/src/array.c index 7f3d9055fd5176251b40edb440d90f9ff145fcd6..b1274c4b26ffab34dc8d034072995c53ea457d11 100644 --- a/src/array.c +++ b/src/array.c @@ -21,7 +21,7 @@ #include "main.h" #include "security.h" -RCSID("$Id: array.c,v 1.52 1999/08/17 22:00:00 hubbe Exp $"); +RCSID("$Id: array.c,v 1.53 1999/08/21 23:21:06 noring Exp $"); struct array empty_array= { @@ -173,7 +173,7 @@ void simple_array_index_no_free(struct svalue *s, tmp.type=T_ARRAY; tmp.u.array=a; if (a->size) { - index_error(0,0,0,&tmp,ind,"Index %d is out of range 0 - %d.\n", i, a->size-1); + index_error(0,0,0,&tmp,ind,"Index %d is out of array range 0 - %d.\n", i, a->size-1); } else { index_error(0,0,0,&tmp,ind,"Attempt to index the empty array with %d.\n", i); } @@ -245,7 +245,7 @@ void simple_set_index(struct array *a,struct svalue *ind,struct svalue *s) if(i<0) i+=a->size; if(i<0 || i>=a->size) { if (a->size) { - error("Index %d is out of range 0 - %d.\n", i, a->size-1); + error("Index %d is out of array range 0 - %d.\n", i, a->size-1); } else { error("Attempt to index the empty array with %d.\n", i); } @@ -950,7 +950,7 @@ union anything *array_get_item_ptr(struct array *a, if(i<0) i+=a->size; if(i<0 || i>=a->size) { if (a->size) { - error("Index %d is out of range 0 - %d.\n", i, a->size-1); + error("Index %d is out of array range 0 - %d.\n", i, a->size-1); } else { error("Attempt to index the empty array with %d.\n", i); } diff --git a/src/opcodes.c b/src/opcodes.c index 6516896b6a989b7d789fbb8a166de4bf6bdee1bf..3697f834ce92b37eefd7693773bb75ff9ec87c39 100644 --- a/src/opcodes.c +++ b/src/opcodes.c @@ -23,7 +23,7 @@ #include "module_support.h" #include "security.h" -RCSID("$Id: opcodes.c,v 1.42 1999/07/27 16:41:37 mirar Exp $"); +RCSID("$Id: opcodes.c,v 1.43 1999/08/21 23:21:07 noring Exp $"); void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind) { @@ -63,8 +63,13 @@ void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind) if(i<0) i+=what->u.string->len; if(i<0 || i>=what->u.string->len) - error("Index %d is out of range 0 - %d.\n", i, what->u.string->len-1); - else + { + if(what->u.string->len == 0) + error("Attempt to index the empty string with %d.\n", i); + else + error("Index %d is out of string range 0 - %d.\n", + i, what->u.string->len-1); + } else i=index_shared_string(what->u.string,i); to->type=T_INT; to->subtype=NUMBER_NUMBER;