format and printf bug in SAMP 0.3c R3-1
#1

Hello, I found bug..

Код:
public OnGameModeInit()
{
	new test = 0, test2 = 122, test3 = 0b101011, tmp[16];
	
	printf("test:  %d | %b | %x", test, test, test);
	printf("test2: %d | %b | %x", test2, test2, test2);
	printf("test3: %d | %b | %x", test3, test3, test3);
	
	format(tmp, 16, "Output: %b %b %b", test, test2, test3);
	print(tmp);
}
Log:
Код:
[01:39:13] test:  0 | b | 0
[01:39:13] test2: 122 | b | 7A
[01:39:13] test3: 43 | b | 2B
[01:39:13] Output: b b b
In 0.3c R2 and older %b works.
Reply
#2

I can confirm this.
Reply
#3

Confirmed. I have a similar problem. Turned from this:


Into this:


No changes to that part whatsoever.
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
Confirmed. I have a similar problem. Turned from this:
http://i53.tinypic.com/29elysi.jpg

Into this:
http://i55.tinypic.com/vo0dj9.png

No changes to that part whatsoever.
Are you running R3 or R3-1 server?
Reply
#5

Quote:
Originally Posted by dugi
Посмотреть сообщение
Are you running R3 or R3-1 server?
Ah sorry, didn't notice there was a hotfix already. Solved, thanks.
Reply
#6

Vince's bug solved, but problem with binary in format/printf not solved..
Reply
#7

Floating point precision specifier works as long as you specify if fully = %0.1f for example.

As for %b, who ever used that?
Reply
#8

Thanks for the detailed report. I plan to release a 0.3c R4 server shortly to address this and some other minor issues.

Left is ******'s original 0.3c R1/R2 format test, right is the same code tested in 0.3c R4 server.

0.3c R1/R20.3c R4
"101010" "101010"
"0101010""0101010"
" 101010"" 101010"
"101010""101010"
"2A""2A"
"0002A""0002A"
" 2A"" 2A"
"2A""2A"
"2A""2A"
"0002A""0002A"
" 2A"" 2A"
"2A""2A"
"42""42"
"00042""00042"
" 42"" 42"
"42""42"
"hello""hello"
"hel ""hel "
"hello""hello"
"hel""hel"
"57.000000""57.000000"
" 57.000000""00057.000000"
" 57.000000"" 57.000000"
"57.000""57.000"
"101010""101010"
"0101010""0101010"
" 101010"" 101010"
"101010""101010"
"2A""2A"
"0002A""0002A"
" 2A"" 2A"
"2A""2A"
"2A""2A"
"0002A""0002A"
" 2A"" 2A"
"2A""2A"
"42""42"
"00042""00042"
" 42"" 42"
"42""42"
"hello""hello"
"hel ""hel "
"hello""hello"
"hel""hel"
"57.000000""57.000000"
" 57.000000""00057.000000"
" 57.000000"" 57.000000"
"57.000""57.000"
"101010""101010"
"0101010""0101010"
" 101010"" 101010"
"101010""101010"
"2A""2A"
"0002A""0002A"
" 2A"" 2A"
"2A""2A"
"2A""2A"
"0002A""0002A"
" 2A"" 2A"
"2A""2A"
"42""42"
"00042""00042"
" 42"" 42"
"42""42"
"hello""hello"
"hel ""hel "
"hello""hello"
"hel""hel"
"57.000000""57.000000"
" 57.000000""00057.000000"
" 57.000000"" 57.000000"
"57.000""57.000"
Summary of fixes:
- Fixed problem with padding for float specifier. Added support for 0 padding in floats.
- Fixed problem where arbitrary precision (.*) would be interpreted as padding.
- Readded support for the binary specifier, even though I think it has no practical purpose in SA-MP.
Reply
#9

As we are talking about those bugs now, how about the string-bug in Timers and some other Functions?
pawn Код:
new teststring[4];
public OnFilterScriptInit()
{
    teststring = "Hi!";
    CallLocalFunction("print", "s", teststring); // does not work
    SetTimerEx("print", 1000, 0, "s", teststring); // does not work
    SetTimerEx("Func", 2000, 0, "d", 0); // works
    SetTimerEx("Func", 3000, 0, "d", 1); // works
}

forward Func(text);
public Func(text)
{
    if(text)
    {
        printf("_%s_", teststring);
    }
    else
    {
        print(teststring);
    }
}
Output:
Код:
_Hi!_
Hi!
Expected Output:
Код:
Hi!
Hi!
_Hi!_
Hi!
Reply
#10

Oh, never saw that it isn't a public function
Actually I meant another bug ... I'll try to explain it in a few minutes

EDIT: This is, what I wanted to show:
pawn Код:
new teststring[4];
public OnFilterScriptInit()
{
    teststring = "Foo";
    SetTimerEx("Func", 1000, 0, "s", teststring);
    SetTimerEx("Func", 1500, 0, "s", "Moo");
}

forward Func(text[]);
public Func(text[])
{
    print(text);
}
Output:
Код:
(null)
(null)
Expected:
Код:
Foo
Moo
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)