Re: [PATCH 1/2] commit: reject invalid UTF-8 codepoints
- From
Peter Krefting <peter@softwolves.pp.se>
- Date
- Jul 1, 2013, 07:12 UTC
- Message-ID
- <alpine.DEB.2.00.1307010811090.21709@ds9.cixit.se>
- In-Reply-To
- <20130629174023.GB226907@vauxhall.crustytoothpaste.net>
brian m. carlson:
> + /* Check the value here */ > + if (codepoint >= 0xd800 && codepoint <= 0xdfff) > + return bad_offset;
if ((x & 0xFFFFF800) == 0xD800)
is slightly shorter, albeit a bit more difficult to read.
Please also consider adding some commentary as to what you are checking here, as it is not obvious unless you know Unicode well.
-- \\// Peter - http://www.softwolves.pp.se/