core-foundation.strings: prevent creating CFString from characters in range 0xd800-0xdfff.
parent
d9e1f20286
commit
62bf4194c2
|
@ -1,9 +1,11 @@
|
||||||
! Copyright (C) 2008, 2010 Slava Pestov.
|
! Copyright (C) 2008, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien.c-types alien.data alien.syntax alien.strings
|
USING: alien alien.c-types alien.data alien.strings alien.syntax
|
||||||
io.encodings.string kernel sequences byte-arrays
|
byte-arrays combinators.short-circuit core-foundation
|
||||||
io.encodings.utf8 math core-foundation core-foundation.arrays
|
core-foundation.arrays core-foundation.data destructors fry
|
||||||
core-foundation.data destructors parser fry alien words ;
|
io.encodings.string io.encodings.utf8 kernel math math.order
|
||||||
|
parser sequences words ;
|
||||||
|
|
||||||
IN: core-foundation.strings
|
IN: core-foundation.strings
|
||||||
|
|
||||||
TYPEDEF: void* CFStringRef
|
TYPEDEF: void* CFStringRef
|
||||||
|
@ -65,7 +67,7 @@ FUNCTION: CFStringRef CFCopyTypeIDDescription ( CFTypeID type_id ) ;
|
||||||
|
|
||||||
: prepare-CFString ( string -- byte-array )
|
: prepare-CFString ( string -- byte-array )
|
||||||
[
|
[
|
||||||
dup 0x10ffff >
|
dup { [ 0x10ffff > ] [ 0xd800 0xdfff between? ] } 1||
|
||||||
[ drop 0xfffd ] when
|
[ drop 0xfffd ] when
|
||||||
] map utf8 encode ;
|
] map utf8 encode ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue