[pcre-dev] [Bug 1049] Add support for UTF-16

Startseite
Nachricht löschen
Autor: Philip Hazel
Datum:  
To: pcre-dev
Alte Treads: [pcre-dev] [Bug 1049] New: Add support for UTF-16
Betreff: [pcre-dev] [Bug 1049] Add support for UTF-16
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1049




--- Comment #29 from Philip Hazel <ph10@???> 2011-11-16 17:07:11 ---
On Wed, 16 Nov 2011, Petr Pisar wrote:

> If you required POSIX or c99, then you could include <stdint.h> and use uint8_t
> and uint16_t types.


Perhaps we don't need to be that restrictive. PCRE already contains this
code:

#if USHRT_MAX == 65535                                             
  typedef unsigned short pcre_uint16;                               
  typedef short pcre_int16;                                             
#elif UINT_MAX == 65535                                                
  typedef unsigned int pcre_uint16;                                    
  typedef int pcre_int16;                                                 
#else                      
  #error Cannot determine a type for 16-bit unsigned integers                
#endif


#if UINT_MAX == 4294967295                                               
  typedef unsigned int pcre_uint32;                                        
  typedef int pcre_int32;                        
#elif ULONG_MAX == 4294967295
  typedef unsigned long int pcre_uint32;
  typedef long int pcre_int32;
#else
  #error Cannot determine a type for 32-bit unsigned integers
#endif


So one could use 16-bit and 32-bit types for the test.

Regards,
Philip


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email