Hello.

On 02/17/2014 09:53 PM, Krzysztof Opasiak wrote:

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.opas...@samsung.com>
---
  src/usbg.c |   20 ++++++++++++++++----
  1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/usbg.c b/src/usbg.c
index e62eb01..2264e7c 100644
--- a/src/usbg.c
+++ b/src/usbg.c
@@ -617,7 +617,10 @@ 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 +633,10 @@ 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 +649,10 @@ 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 +767,10 @@ 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);
+       }

I guess you haven't run your patch via scripts/checkpatch.pl, otherwise you would have seen it protesting against single statement *if* arms in {}.
Well, some common sense applies as well since {} are completely unnecessary.

WBR, Sergei

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

Reply via email to