Re: Fix workaround skipping leading 'x' for ModelNumStr
Yasuhiro MATSUMOTO <[email protected]> Fri, 28 Feb 2014 12:49:16 +0900
| Newsgroups | gmane.comp.ipod.gtkpod |
|---|---|
| Message-ID | <CAJc+XFOT27UWGA7sH+ViAahH3ZZ3MV+sVbUmU_5KCtexgU1eUA@mail.gmail.com> |
--===============6310364424679950590== Content-Type: multipart/alternative; boundary=001a113aabac6a1bc704f36f527e --001a113aabac6a1bc704f36f527e Content-Type: text/plain; charset=UTF-8 Hi I think that it's better to skip if model_name is just 'x'. On Thu, Feb 27, 2014 at 8:46 PM, Daniele Forsi <[email protected]> wrote: > 2014-02-27 8:21 GMT+01:00 Yasuhiro MATSUMOTO: > > > Currently, some application (sorry i don't know) wrote SysInfo in below. > > /iPod_Control/Device/SysInfo > > And it seems that gtkpod expect xY000 like string. > > But some times this leading 'x' doesn't set. Maybe it depend on > > libmodiledevice or another libraries? > > Below is a patch for getting ModelNumStr old workaround. > > Please check and include. > > > > - Yasuhiro Matsumoto > > > > > > diff --git a/src/itdb_device.c b/src/itdb_device.c > > index 80995de..4f10675 100644 > > --- a/src/itdb_device.c > > +++ b/src/itdb_device.c > > @@ -2113,7 +2113,8 @@ get_ipod_info_from_model_number (const char > > *model_number) > > g_return_val_if_fail (model_number != NULL, NULL); > > > > model_table = get_model_table (); > > - if(isalpha(model_number[0])) { > > + /* Fix workarounds skipping leading 'x' */ > > + if(model_number[0] == 'x' && model_number[1] != '\0') { > > why are you testing model_number[1]? the original code didn't test it > > if you want the leading 'x' if present I would remove the comment and > just do that: > - if(isalpha(model_number[0])) { > + if (model_number[0] == 'x') { > > for consistency, it's better to add a space between "if" and the > opening parens (there are only 2 lines in this file where "if" isn't > followed by a space and 76 where it is followed by a space) > > -- > Daniele Forsi > > > ------------------------------------------------------------------------------ > Flow-based real-time traffic analytics software. Cisco certified tool. > Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer > Customize your own dashboards, set traffic alerts and generate reports. > Network behavioral analysis & security monitoring. All-in-one tool. > > http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk > _______________________________________________ > Gtkpod-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/gtkpod-devel > -- - Yasuhiro Matsumoto --001a113aabac6a1bc704f36f527e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Hi<div><br></div><div>I think that it's better to skip= if model_name is just 'x'.</div><div><br></div></div><div class=3D= "gmail_extra"><br><br><div class=3D"gmail_quote">On Thu, Feb 27, 2014 at 8:= 46 PM, Daniele Forsi <span dir=3D"ltr"><<a href=3D"mailto:[email protected]= om" target=3D"_blank">[email protected]</a>></span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex">2014-02-27 8:21 GMT+01:00 Yasuhiro MATSUMOTO= :<br> <div class=3D""><br> > Currently, some application (sorry i don't know) wrote SysInfo in = below.<br> > =C2=A0 /iPod_Control/Device/SysInfo<br> > And it seems that gtkpod expect xY000 like string.<br> > But some times this leading 'x' doesn't set. Maybe it depe= nd on<br> > libmodiledevice or another libraries?<br> > Below is a patch for getting ModelNumStr old workaround.<br> > Please check and include.<br> ><br> > - Yasuhiro Matsumoto<br> ><br> ><br> > diff --git a/src/itdb_device.c b/src/itdb_device.c<br> > index 80995de..4f10675 100644<br> > --- a/src/itdb_device.c<br> > +++ b/src/itdb_device.c<br> > @@ -2113,7 +2113,8 @@ get_ipod_info_from_model_number (const char<br> > *model_number)<br> > =C2=A0 =C2=A0 =C2=A0g_return_val_if_fail (model_number !=3D NULL, NULL= );<br> ><br> > =C2=A0 =C2=A0 =C2=A0model_table =3D get_model_table ();<br> > - =C2=A0 =C2=A0if(isalpha(model_number[0])) {<br> > + =C2=A0 =C2=A0/* Fix workarounds skipping leading 'x' */<br> > + =C2=A0 =C2=A0if(model_number[0] =3D=3D 'x' && model_= number[1] !=3D '\0') {<br> <br> </div>why are you testing model_number[1]? the original code didn't tes= t it<br> <br> if you want the leading 'x' if present I would remove the comment a= nd<br> just do that:<br> - =C2=A0 =C2=A0if(isalpha(model_number[0])) {<br> + =C2=A0 =C2=A0if (model_number[0] =3D=3D 'x') {<br> <br> for consistency, it's better to add a space between "if" and = the<br> opening parens (there are only 2 lines in this file where "if" is= n't<br> followed by a space and 76 where it is followed by a space)<br> <br> --<br> Daniele Forsi<br> <br> ---------------------------------------------------------------------------= ---<br> Flow-based real-time traffic analytics software. Cisco certified tool.<br> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer<br> Customize your own dashboards, set traffic alerts and generate reports.<br> Network behavioral analysis & security monitoring. All-in-one tool.<br> <a href=3D"http://pubads.g.doubleclick.net/gampad/clk?id=3D126839071&iu= =3D/4140/ostg.clktrk" target=3D"_blank">http://pubads.g.doubleclick.net/gam= pad/clk?id=3D126839071&iu=3D/4140/ostg.clktrk</a><br> _______________________________________________<br> Gtkpod-devel mailing list<br> <a href=3D"mailto:[email protected]">[email protected]= urceforge.net</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/gtkpod-devel" targe= t=3D"_blank">https://lists.sourceforge.net/lists/listinfo/gtkpod-devel</a><= br> </blockquote></div><br><br clear=3D"all"><div><br></div>-- <br>- Yasuhiro M= atsumoto<br> </div> --001a113aabac6a1bc704f36f527e-- --===============6310364424679950590== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Flow-based real-time traffic analytics software. Cisco certified tool. Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer Customize your own dashboards, set traffic alerts and generate reports. Network behavioral analysis & security monitoring. All-in-one tool. http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk --===============6310364424679950590== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Gtkpod-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gtkpod-devel --===============6310364424679950590==--