From e359998d099dab3d4d54f83ff47d207e4ad78c73 Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Mon, 29 Sep 2014 20:56:17 +0400 Subject: [PATCH] =?UTF-8?q?s'assurer=20dans=20tous=20les=20contexte=20que?= =?UTF-8?q?=20l'on=20a=20bien=20un=20entier,=20pour=20=C3=A9viter=20des=20?= =?UTF-8?q?erreurs=20de=20comparaisons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ulib/base | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/ulib/base b/lib/ulib/base index 8e6f852..b1dc42a 100644 --- a/lib/ulib/base +++ b/lib/ulib/base @@ -1715,6 +1715,7 @@ function array_new(dest) { function array_newsize(dest, size, i) { dest[0] = 0 # forcer awk à considérer dest comme un tableau delete dest + size = int(size) for (i = 1; i <= size; i++) { dest[i] = "" } @@ -1744,11 +1745,12 @@ function array_add(dest, value, lastindex) { dest[lastindex + 1] = value } function array_deli(dest, i, l) { + i = int(i) if (i == 0) return l = length(dest) while (i < l) { dest[i] = dest[i + 1] - i = i + 1 + i++ } delete dest[l] } @@ -1804,11 +1806,11 @@ function key_index(value, values, ignoreCase, i) { if (ignoreCase) { value = tolower(value) for (i in values) { - if (tolower(values[i]) == value) return i + if (tolower(values[i]) == value) return int(i) } } else { for (i in values) { - if (values[i] == value) return i + if (values[i] == value) return int(i) } } return 0 @@ -1823,7 +1825,7 @@ function array2s(values, prefix, sep, suffix, noindices, first, i, s) { if (first) first = 0 else s = s sep if (!noindices) s = s "[" i "]=" - s = values[i] + s = s values[i] } s = s suffix return s