![]() |
[ATF]$repeat caused memory leak and system hang
If you use $repeat(a,b), and b is less than zero, then this problem occurs. Winamp will request almost infinite memory, and that's the problem.
This problem is realistic, for I use %artist%$repeat(<space>,$mul(2,$add(4,-$len(%artist%)))) to display the artist name, and to make my playlist editor looks tidy. I use Chinese, so I have to multiply this by two, and I can't use $padcut to do so... If the length of %artist% is greater than 4, then the problem occurs. I suppose that this is caused by the comparing. The program decreases the second parameter, and checks if it equals to zero. If not, it adds an "a" to the end of the string. In this bug, for the second parameter was already below zero, this will go forever or at least 2^31 times... I have a temporary solution, that add $max(0,0,0,...) to the $mul, but I don't think it's a good idea. I think this bug exists in any version of winamp that supports ATF. I'm using Windows XP SP2, I reproduced this bug on Winamp 5.21 and Winamp 5.23, and I think this bug does not relate to plugins. Sorry for my poor English. |
I understand your bug, but I have a few questions about ATF support with Chinese characters.
What do you mean by this: Quote:
|
Chinese characters' sizes are 2 times of English characters.
So if %artist%=AA and AA are two Chinese character, then their width is as long as 4 English characters, but the $padcut think they are 2 characters wide, so if I use $padcut(AA,5) it will add 3 spaces at the end of the string, so the result is AA___, and if I use $padcut(A,5) the result is A____. For A is 2 characters wide, their lengths are different, the first is 7, and the second is 6, but I want them to be equal. So I use %artist%$repeat( ,$mul(2,$add(5,-$len(%artist%)))), and this will always give me a string of length 10, on condition that %artist% only contains Chinese characters. ... But this is also not perfect, for if %artist% contains English characters, the result will be longer than I hoped... So I hope if $padcut can think Chinese characters as 2 English characters, not one. |
| All times are GMT. The time now is 06:24. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.