Re: Echo removal



On Wed, 2012-02-15 at 21:15 +0100, Aleksander Morgado wrote:
> +        if (response->data[i] == '\r' && response->data[i + 1] ==
> '\n') {
> +            if (i > 0)
> +                g_byte_array_remove_range (response, 0, i);
> +            else
> +                /* good, we're already started with <CR><LF> */
> +            break; 

The else + comment there doesn't quite do what you want since the
compiler actually ignores the comment and considers the 'break' as part
of the else {} block.  So I'd either just kill the else + comment or put
the comment within braces {}.  As-is, if the response starts with \r\n
it'll actually end up running through the whole string and and running
the g_byte_array_remove_range() for any additional \r\n sequences it
sees.

In any case, I can't find a device that doesn't prefix the actual reply
with <CR><LF>, even disgusting evil old devices and braindead phones, so
this is a go for master and MM_05 after the else/comment fix.

Thanks!
Dan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]