Re: Echo removal



>> +        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.

Haha, yeah, stupid mistake :-), the else should go into the comment of
course.

> 
> 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.
> 

I fixed the else/comment thing, and added some more unit tests that
could have detected the issue. The fix is already pushed to both master
and MM_05.

Cheers!

-- 
Aleksander


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