Sign in to follow this  
Followers 0
Rigor O'Mortis

Funny "%" bug

3 posts in this topic

Ony of my more pervert friends has discovered a funny bug in ApexDC beta 4. I have no idea whether or nit it's present in the new DC++ as well, but, still, it was funny enough to be worth posting here.

Try entering away mode, but with this:

/away Hibernating 69%

(my friend is somewhat obsessed with 69, but that's a different matter)

You will notice a very strange away message... and the most code-experienced of you will quickly realize that the "%" is causing this.

Share this post


Link to post
Share on other sites

yeah it's a bug in formatting time variables... in your case there is no valid variable after % so that's why this happens to use %-sign you should do %% :)

Share this post


Link to post
Share on other sites

Added a workaround for this one, ie.

		for(string::size_type i = ret.find("%"); i != string::npos; i = ret.find("%", i)) {
if(string("aAbBcdHIjmMpSUwWxXyYzZ%").find(ret[i+1]) == string::npos) {
ret.replace(i, 1, "%%");
}
i += 2;
}

If anyone comes up with a better solution (other than telling users to learn to escape their % signs) feel free to tell :)

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0