[PATCH v2 05/26] libusbg: Update strings only when writting US English strings.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Strings in current verison of library are hardcoded to
US English. Functions which set strings are generic and
allow to set other languages, but internal library structures
should be update only when setting US English strings.

Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
---
 src/usbg.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/usbg.c b/src/usbg.c
index 753b930..974077f 100644
--- a/src/usbg.c
+++ b/src/usbg.c
@@ -617,7 +617,9 @@ void usbg_set_gadget_serial_number(struct gadget *g, int lang, char *serno)
 
 	mkdir(path, S_IRWXU|S_IRWXG|S_IRWXO);
 
-	strcpy(g->strs.str_ser, serno);
+	/* strings in library are hardcoded to US English for now */
+	if (lang == LANG_US_ENG)
+		strcpy(g->strs.str_ser, serno);
 
 	usbg_write_string(path, "", "serialnumber", serno);
 }
@@ -630,7 +632,9 @@ void usbg_set_gadget_manufacturer(struct gadget *g, int lang, char *mnf)
 
 	mkdir(path, S_IRWXU|S_IRWXG|S_IRWXO);
 
-	strcpy(g->strs.str_mnf, mnf);
+	/* strings in library are hardcoded to US English for now */
+	if (lang == LANG_US_ENG)
+		strcpy(g->strs.str_mnf, mnf);
 
 	usbg_write_string(path, "", "manufacturer", mnf);
 }
@@ -643,7 +647,9 @@ void usbg_set_gadget_product(struct gadget *g, int lang, char *prd)
 
 	mkdir(path, S_IRWXU|S_IRWXG|S_IRWXO);
 
-	strcpy(g->strs.str_prd, prd);
+	/* strings in library are hardcoded to US English for now */
+	if (lang == LANG_US_ENG)
+		strcpy(g->strs.str_prd, prd);
 
 	usbg_write_string(path, "", "product", prd);
 }
@@ -758,7 +764,9 @@ void usbg_set_config_string(struct config *c, int lang, char *str)
 
 	mkdir(path, S_IRWXU|S_IRWXG|S_IRWXO);
 
-	strcpy(c->str_cfg, str);
+	/* strings in library are hardcoded to US English for now */
+	if (lang == LANG_US_ENG)
+		strcpy(c->str_cfg, str);
 
 	usbg_write_string(path, "", "configuration", str);
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux