Truncating text in hal_util_get_string_from_file
Richard Hughes
hughsient at gmail.com
Fri Oct 31 02:50:22 PDT 2008
Attached is a patch that removes the forced '\0' from the last char in
the string.
While doing some patches for OLPC, all the OFW firmware strings are not
terminated with \n\0 just with \0.
This means that we get results like "OLP" when we should be getting
"OLPC".
data = OLPC0
index = 01234
len = 4
data[len-1] = C
data = IBMn0
index = 01234
len = 4
data[len-1] = \n
Now, the isspace check checks for \n, so we can remove the explicit \0
termination, and rely on the code three lines down. Removing the
explicit code allows non-newline terminated strings to be got with
hal_util_get_string_from_file().
Okay to commit?
Richard.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal-dont-truncate-strings.patch
Type: text/x-patch
Size: 503 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20081031/22b481fa/attachment.bin
More information about the hal
mailing list