aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hv
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2011-11-17 16:42:19 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-18 13:51:01 -0500
commit0720a06a7518c9d0c0125bd5d1f3b6264c55c3dd (patch)
tree6895ca20afb24b38f0246b370cba7dc6e72764cb /drivers/hv
parentb7463c71fbbff7111d0c879d2f64fe2b08f51848 (diff)
NLS: improve UTF8 -> UTF16 string conversion routine
The utf8s_to_utf16s conversion routine needs to be improved. Unlike its utf16s_to_utf8s sibling, it doesn't accept arguments specifying the maximum length of the output buffer or the endianness of its 16-bit output. This patch (as1501) adds the two missing arguments, and adjusts the only two places in the kernel where the function is called. A follow-on patch will add a third caller that does utilize the new capabilities. The two conversion routines are still annoyingly inconsistent in the way they handle invalid byte combinations. But that's a subject for a different patch. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hv')
-rw-r--r--drivers/hv/hv_kvp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c
index 89f52440fcf4..0e8343f585bb 100644
--- a/drivers/hv/hv_kvp.c
+++ b/drivers/hv/hv_kvp.c
@@ -212,11 +212,13 @@ kvp_respond_to_host(char *key, char *value, int error)
212 * The windows host expects the key/value pair to be encoded 212 * The windows host expects the key/value pair to be encoded
213 * in utf16. 213 * in utf16.
214 */ 214 */
215 keylen = utf8s_to_utf16s(key_name, strlen(key_name), 215 keylen = utf8s_to_utf16s(key_name, strlen(key_name), UTF16_HOST_ENDIAN,
216 (wchar_t *)kvp_data->data.key); 216 (wchar_t *) kvp_data->data.key,
217 HV_KVP_EXCHANGE_MAX_KEY_SIZE / 2);
217 kvp_data->data.key_size = 2*(keylen + 1); /* utf16 encoding */ 218 kvp_data->data.key_size = 2*(keylen + 1); /* utf16 encoding */
218 valuelen = utf8s_to_utf16s(value, strlen(value), 219 valuelen = utf8s_to_utf16s(value, strlen(value), UTF16_HOST_ENDIAN,
219 (wchar_t *)kvp_data->data.value); 220 (wchar_t *) kvp_data->data.value,
221 HV_KVP_EXCHANGE_MAX_VALUE_SIZE / 2);
220 kvp_data->data.value_size = 2*(valuelen + 1); /* utf16 encoding */ 222 kvp_data->data.value_size = 2*(valuelen + 1); /* utf16 encoding */
221 223
222 kvp_data->data.value_type = REG_SZ; /* all our values are strings */ 224 kvp_data->data.value_type = REG_SZ; /* all our values are strings */