Review: adium 3497:ab9a06c5cc58: Bonjour bytes

Peter Hosey boredzo at adium.im
Tue Nov 9 07:47:02 UTC 2010


On Nov 8, 2010, at 23:00:18, Ryan Govostes wrote:
>> 1. Use strlen instead of sizeof.
> 
> No, this would not work since there are null bytes.

Good catch. Strike #1.

>> 2. Declare an enum symbol for the desired number of characters, and use each symbol both to declare the length of the corresponding array and to replace the sizeof expressions.
> 
> Would this suffice?
> 
>> const char subn[] = "subn\x00\x00\x00\x01";
> 
> -->
> 
>> const char subn[] = { 's', 'u', 'b', 'n', '\x00', '\x00', '\x00', '\x01'};

Yup. Let's call that solution #3.





More information about the devel mailing list