projects
/
fw
/
altos
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6ac34f9
)
altosui: Elide nul bytes at end of telemetry string values
author
Keith Packard
<keithp@keithp.com>
Wed, 6 Jul 2011 06:35:50 +0000
(23:35 -0700)
committer
Keith Packard
<keithp@keithp.com>
Wed, 6 Jul 2011 06:35:50 +0000
(23:35 -0700)
All telemetry fields are fixed length, so any embedded strings are
padded with nul bytes.
Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/Altos.java
patch
|
blob
|
history
diff --git
a/altosui/Altos.java
b/altosui/Altos.java
index 37a4f67bfdb278188b7a78c42dcd6091f2edd098..364908448e2d2fcbdab39d32f71abf0f74281394 100644
(file)
--- a/
altosui/Altos.java
+++ b/
altosui/Altos.java
@@
-240,9
+240,15
@@
public class Altos {
}
}
}
}
+ int i;
+ for (i = l - 1; i >= 0; i--)
+ if (bytes[s+i] != 0)
+ break;
+
+ l = i + 1;
byte[] b = new byte[l];
byte[] b = new byte[l];
- for (i
nt i
= 0; i < l; i++)
+ for (i = 0; i < l; i++)
b[i] = (byte) bytes[s+i];
String n = new String(b, unicode_set);
return n;
b[i] = (byte) bytes[s+i];
String n = new String(b, unicode_set);
return n;