Update of /cvsroot/jake2/jake2/src/jake2/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3566/src/jake2/util
Modified Files:
Lib.java
Log Message:
bugfix in atov and some beatification
Index: Lib.java
===================================================================
RCS file: /cvsroot/jake2/jake2/src/jake2/util/Lib.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Lib.java 26 May 2005 16:56:31 -0000 1.13
--- Lib.java 12 Dec 2005 21:50:02 -0000 1.14
***************
*** 97,112 ****
}
}
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()));
!
return res;
}
public static int strlen(char in[]) {
for (int i = 0; i < in.length; i++)
--- 97,111 ----
}
}
+
public static float[] atov(String v) {
float[] res = { 0, 0, 0 };
! 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++)
***************
*** 115,118 ****
--- 114,118 ----
return in.length;
}
+
public static int strlen(byte in[]) {
for (int i = 0; i < in.length; i++)
***************
*** 132,135 ****
--- 132,136 ----
return hexDump(buf, len, false);
}
+
// dump data as hexstring
public static String hexDump(byte data1[], int len, boolean showAddress) {
|