[haiku-commits] Re: haiku: hrev48017 - src/data/mime_db/text

  • From: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 15 Oct 2014 08:13:15 +1300

On 15/10/2014 12:12 AM, "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx> wrote:
>
> Am 14.10.2014 13:06, schrieb Adrien Destugues:
>
>> On Tue, Oct 14, 2014 at 12:39:39PM +0200, Axel Dörfler wrote:
>>>
>>> Am 14.10.2014 11:22, schrieb Adrien Destugues:
>>>>
>>>> \\000 is unescaped once by the rdef parser to \000. It is then escaped
>>>> a second time by the MIME sniffing rule parser to a null character.
>>>
>>> But three zeros? :-)
>>
>> Right, I read the parser code again and it looks like this is not
>> needed. Since the format for sniffing rules isn't completely documented,
>> I wasn't sure about that. However \0x would be mistaken for an hex
>> string start marker, whereas \00x is not (and \000x is not either). And
>> \0x0x or \x0x may parse correctly, but are quite confusing. So I think
sticking
>> to 3 char to encode an octal byte everywhere is the safest/most readable
>> solution here.
>
>
> If \00x works okay, I'd prefer that.

\000 is actually pretty common in many string handling functions. The other
examples given certainly aren't. Changing to \00x actually looks entirely
ambiguous.

Other related posts: