Re: [PATCH 05/25] libusbg: Update strings only when writting US English strings.

2014-02-18 Thread Sergei Shtylyov

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


Re: [PATCH 05/25] libusbg: Update strings only when writting US English strings.

2014-02-18 Thread Sergei Shtylyov

Hello.

On 02/19/2014 02:07 AM, Sergei Shtylyov 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

[...]


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.


   Ah, I have initially overlooked that it's libusbg patch -- libusbg may 
have its own style peculiarities.


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


RE: [PATCH 05/25] libusbg: Update strings only when writting US English strings.

2014-02-18 Thread Krzysztof Opasiak
 -Original Message-
 From: Sergei Shtylyov [mailto:sergei.shtyl...@cogentembedded.com]
 Sent: Wednesday, February 19, 2014 12:10 AM
 To: Krzysztof Opasiak; mpor...@linaro.org; linux-
 u...@vger.kernel.org
 Cc: Andrzej Pietrasiewicz; Karol Lewandowski; Stanislaw Wadas;
 Aleksander Zdyb; ty317@samsung.com; Marek Szyprowski; Robert
 Baldyga
 Subject: Re: [PATCH 05/25] libusbg: Update strings only when
 writting US English strings.
 
 Hello.
 
 On 02/19/2014 02:07 AM, Sergei Shtylyov 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
 [...]
 
  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.
 
 Ah, I have initially overlooked that it's libusbg patch --
 libusbg may
 have its own style peculiarities.

Assuming Matt prefer kernel style comments, rest of the coding
style should be also consistent with kernel. I have been using some
framework which surrounds single if statements with {}, so I was used to
that style. I will fix this for v2.

Thank you for your remarks.

-- 
Krzysztof Opasiak
Samsung RD Institute Poland
Samsung Electronics
k.opas...@samsung.com




--
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