aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/util/Lib.java
diff options
context:
space:
mode:
authorRene Stoeckel <[email protected]>2005-12-12 21:50:02 +0000
committerRene Stoeckel <[email protected]>2005-12-12 21:50:02 +0000
commit356614526103eb549fb5d02794efe76478b677ce (patch)
tree6324453887417af1e5d97a0d905172d50d247103 /src/jake2/util/Lib.java
parentebee2d2c1e7bacdb7e80d75ad1811a86bf8f8a6d (diff)
bugfix in atov and some beatification
Diffstat (limited to 'src/jake2/util/Lib.java')
-rw-r--r--src/jake2/util/Lib.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/jake2/util/Lib.java b/src/jake2/util/Lib.java
index 51829c1..29829d4 100644
--- a/src/jake2/util/Lib.java
+++ b/src/jake2/util/Lib.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 09.12.2003 by RST.
-// $Id: Lib.java,v 1.13 2005-05-26 16:56:31 hzi Exp $
+// $Id: Lib.java,v 1.14 2005-12-12 21:50:02 salomo Exp $
package jake2.util;
@@ -96,24 +96,24 @@ public class Lib {
}
}
}
+
public static float[] atov(String v) {
float[] res = { 0, 0, 0 };
-
- int i1 = v.indexOf(" ");
- int i2 = v.indexOf(" ", i1 + 1);
-
- res[0] = atof(v.substring(0, i1));
- res[1] = atof(v.substring(i1 + 1, i2));
- res[2] = atof(v.substring(i2 + 1, v.length()));
-
+ String strres[] = v.split(" ");
+ for (int n=0; n < 3 && n < strres.length; n++)
+ {
+ res[n] = atof(strres[n]);
+ }
return res;
}
+
public static int strlen(char in[]) {
for (int i = 0; i < in.length; i++)
if (in[i] == 0)
return i;
return in.length;
}
+
public static int strlen(byte in[]) {
for (int i = 0; i < in.length; i++)
if (in[i] == 0)
@@ -131,6 +131,7 @@ public class Lib {
return hexDump(buf, len, false);
}
+
// dump data as hexstring
public static String hexDump(byte data1[], int len, boolean showAddress) {
StringBuffer result = new StringBuffer();