Skip to contentSkip to conversation

PATCH-add "0X" hexadecimal prefix to simple_strtoul

U-Boot Rob Alexander 6 participants 8 messages Feb 8, 2011 – Feb 10, 2011

lore
Share & tools
lore
#0 lore raw

Added support to simple_strtoul to support the standard 0X hex notation. This issue was causing operational bug in U-boot console commands where "0X" hex numbers were being misinterpreted as decimal.

vsprintf.c renamed from vsprintf.org.c +5 -3
@@ -41,8 +41,9 @@
  	unsigned long result = 0,value;
 
  	if (*cp == '0') {
-		cp++;
-		if ((*cp == 'x')&&  isxdigit(cp[1])) {
+		cp++;
+		//support both 0X and 0x notation
+		if ((tolower(*cp) == 'x')&&  isxdigit(cp[1])) {
  			base = 16;
  			cp++;
  		}
@@ -99,7 +100,8 @@
 
  	if (*cp == '0') {
  		cp++;
-		if ((*cp == 'x')&&  isxdigit (cp[1])) {
+    //support both 0X and 0x notation
+		if ((tolower(*cp) == 'x')&&  isxdigit(cp[1]))
  			base = 16;
  			cp++;
  		}
#1 lore raw

Dear Rob Alexander,

Quoted 3 lines · In message <[email protected]> you wrote:

Added support to simple_strtoul to support the standard 0X hex notation. This issue was causing operational bug in U-boot console commands where "0X" hex numbers were being misinterpreted as decimal.

Can you please provide an example where such problems happened?

vsprintf.c line 45

Quoted 11 lines
vsprintf.c renamed from vsprintf.org.c +2 -2
@@ -41,8 +41,9 @@
  	unsigned long result = 0,value;
 
  	if (*cp == '0') {
-		cp++;
-		if ((*cp == 'x')&&  isxdigit(cp[1])) {
+		cp++;
+		//support both 0X and 0x notation

ERROR: do not use C99 // comments

vsprintf.c line 46

Quoted 1 line
vsprintf.c renamed from vsprintf.org.c +1 -0
+		if ((tolower(*cp) == 'x')&&  isxdigit(cp[1])) {

ERROR: spaces required around that '&&' (ctx:VxW)

vsprintf.c line 104

Quoted 10 lines
vsprintf.c renamed from vsprintf.org.c +2 -1
  			base = 16;
  			cp++;
  		}
@@ -99,7 +100,8 @@
 
  	if (*cp == '0') {
  		cp++;
-		if ((*cp == 'x')&&  isxdigit (cp[1])) {
+    //support both 0X and 0x notation
+		if ((tolower(*cp) == 'x')&&  isxdigit(cp[1]))

Ditto.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Reader, suppose you were an idiot. And suppose you were a  member  of
Congress. But I repeat myself.                           - Mark Twain
#2 lore raw

Hi,

Le 08/02/2011 20:14, Wolfgang Denk a ?crit :

Quoted 7 lines

Dear Rob Alexander,

vsprintf.c line 46

Quoted 1 line · In message<[email protected]> you wrote:
vsprintf.c renamed from vsprintf.org.c +1 -0
+		if ((tolower(*cp) == 'x')&&   isxdigit(cp[1])) {

ERROR: spaces required around that '&&' (ctx:VxW)

I suspect that this could be the Thunderbird problem that Albert noticed the other day.
Some versions of TB seem to eat the space before an '&' character and IIRC also before at least one of the '<' and '>' characters :(

I also noticed this in some of my (rare) posts.
I am using TB 3.1.5.
I am too ashamed to admit my OS ;-)

A nonsense test case written with correct spacing: a = (b > (c >> 1)) && ((d < ((e & 1) << 1)));
If you receive this correctly then please excuse me for the noise :(

Cheers,
Chris

#3 lore raw

Le 09/02/2011 07:19, Chris Moore a ?crit :

Quoted 7 lines

Hi,

Le 08/02/2011 20:14, Wolfgang Denk a ?crit :

Quoted 4 lines

Dear Rob Alexander,

In message<[email protected]> you wrote:

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

+ if ((tolower(*cp) == 'x')&& isxdigit(cp[1])) {

ERROR: spaces required around that '&&' (ctx:VxW)

I suspect that this could be the Thunderbird problem that Albert noticed the other day.
Some versions of TB seem to eat the space before an '&' character and IIRC also before at least one of the '<' and '>' characters :(

Not only. From time to time I see spaces missing between simple words in the subjects pane of the UI while the actual message does have the space, meaning TB wrongly removes spaces at the receiving end, not the sending end.

Quoted 7 lines

I also noticed this in some of my (rare) posts.
I am using TB 3.1.5.
I am too ashamed to admit my OS ;-)

A nonsense test case written with correct spacing: a = (b > (c >> 1)) && ((d < ((e & 1) << 1)));
If you receive this correctly then please excuse me for the noise :(

Received correctly. :)

In Rob's case I am not sure that the issue is due to TB eating selected spaces upon reception; my own TB (3.1.7), using ^U to display the raw message from Rob, shows missing spaces are actually in what was sent, and I think Wolfgang does not use TB at all.

Amicalement,

Signature · 1 line
Albert.
#4 lore raw
Quoted 9 lines · On Wed, 9 Feb 2011 07:40:44 +0100 Albert ARIBAUD <[email protected]> wrote:

Le 09/02/2011 07:19, Chris Moore a ?crit :

Quoted 7 lines

I also noticed this in some of my (rare) posts.
I am using TB 3.1.5.
I am too ashamed to admit my OS ;-)

A nonsense test case written with correct spacing: a = (b > (c >> 1)) && ((d < ((e & 1) << 1)));
If you receive this correctly then please excuse me for the noise :(

Quoted 6 lines

Received correctly. :)

In Rob's case I am not sure that the issue is due to TB eating selected spaces upon reception; my own TB (3.1.7), using ^U to display the raw message from Rob, shows missing spaces are actually in what was sent, and I think Wolfgang does not use TB at all.

It's when quoting a message for a reply that Thunderbird does this mangling.

-Scott

#5 lore raw

[U-Boot] Thunderbird bug (was PATCH-add "0X" hexadecimal prefix to simple_strtoul)

Hi,

Le 09/02/2011 22:17, Scott Wood a ?crit :

Quoted 11 lines
Quoted 8 lines · On Wed, 9 Feb 2011 07:40:44 +0100 Albert ARIBAUD<[email protected]> wrote:

Le 09/02/2011 07:19, Chris Moore a ?crit :

Quoted 7 lines

I also noticed this in some of my (rare) posts.
I am using TB 3.1.5.
I am too ashamed to admit my OS ;-)

A nonsense test case written with correct spacing: a = (b> (c>> 1))&& ((d< ((e& 1)<< 1)));
If you receive this correctly then please excuse me for the noise :(

Quoted 8 lines
Quoted 6 lines

Received correctly. :)

In Rob's case I am not sure that the issue is due to TB eating selected spaces upon reception; my own TB (3.1.7), using ^U to display the raw message from Rob, shows missing spaces are actually in what was sent, and I think Wolfgang does not use TB at all.

It's when quoting a message for a reply that Thunderbird does this mangling.

Right, that would seem to be this bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=448198
I have certainly encountered this one when quoting :(

But there is also: https://bugzilla.mozilla.org/show_bug.cgi?id=597181
I wonder if I haven't run into this one too :(

Cheers,
Chris

#6 lore raw

[U-Boot] Thunderbird bug (was PATCH-add "0X" hexadecimal prefix to simple_strtoul)

Hi,

Me again.

Le 10/02/2011 07:16, Chris Moore a ?crit :

Quoted 20 lines

Hi,

Le 09/02/2011 22:17, Scott Wood a ?crit :

Quoted 17 lines
Quoted 14 lines · On Wed, 9 Feb 2011 07:40:44 +0100 Albert ARIBAUD<[email protected]>…

Le 09/02/2011 07:19, Chris Moore a ?crit :

Quoted 7 lines

I also noticed this in some of my (rare) posts.
I am using TB 3.1.5.
I am too ashamed to admit my OS ;-)

A nonsense test case written with correct spacing: a = (b> (c>> 1))&&
((d< ((e& 1)<< 1)));
If you receive this correctly then please excuse me for the noise :(

Received correctly. :)

In Rob's case I am not sure that the issue is due to TB eating selected spaces upon reception; my own TB (3.1.7), using ^U to display the raw message from Rob, shows missing spaces are actually in what was sent, and I think Wolfgang does not use TB at all.

Quoted 8 lines
Quoted 2 lines

It's when quoting a message for a reply that Thunderbird does this mangling.

Right, that would seem to be this bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=448198
I have certainly encountered this one when quoting :(

But there is also: https://bugzilla.mozilla.org/show_bug.cgi?id=597181
I wonder if I haven't run into this one too :(

Note that my reply introduced the quoted text bug in my test case above :(

Cheers,
Chris

#7 lore raw

[U-Boot] Thunderbird bug (was PATCH-add "0X" hexadecimal prefix to simple_strtoul)

Dear Chris Moore,

Quoted 27 lines

Hi,

Me again.

Le 10/02/2011 07:16, Chris Moore a ?crit :

Quoted 22 lines

Hi,

Le 09/02/2011 22:17, Scott Wood a ?crit :

Quoted 19 lines
Quoted 8 lines · On Wed, 9 Feb 2011 07:40:44 +0100 Albert ARIBAUD<[email protected]>…

Le 09/02/2011 07:19, Chris Moore a ?crit :

Quoted 7 lines

I also noticed this in some of my (rare) posts.
I am using TB 3.1.5.
I am too ashamed to admit my OS ;-)

A nonsense test case written with correct spacing: a = (b> (c>> 1))&&
((d< ((e& 1)<< 1)));
If you receive this correctly then please excuse me for the noise :(

Quoted 6 lines

Received correctly. :)

In Rob's case I am not sure that the issue is due to TB eating selected spaces upon reception; my own TB (3.1.7), using ^U to display the raw message from Rob, shows missing spaces are actually in what was sent, and I think Wolfgang does not use TB at all.

It's when quoting a message for a reply that Thunderbird does this mangling.

Quoted 8 lines
Quoted 6 lines

Right, that would seem to be this bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=448198
I have certainly encountered this one when quoting :(

But there is also: https://bugzilla.mozilla.org/show_bug.cgi?id=597181
I wonder if I haven't run into this one too :(

Note that my reply introduced the quoted text bug in my test case above :(

The space mangling even happens when one saves an e-mail (e.g. a patch). I am glad we now have patchwork to download patches... Before I used an old (theoretical insecure) thunderbird version to do that.

Best Regards,
Reinhard