/ Check-in [86a08bb7]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix UTF conversions for -O2 on gcc 4.1.1. Ticket #2008. (CVS 3464)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 86a08bb7c5da42fbeb5a026287d67912a2ffb7f1
User & Date: drh 2006-10-04 15:23:22
Context
2006-10-04
17:35
The snippet generator adds ellipsis between text from different columns. (CVS 3465) check-in: 6cf1fb9f user: drh tags: trunk
15:23
Fix UTF conversions for -O2 on gcc 4.1.1. Ticket #2008. (CVS 3464) check-in: 86a08bb7 user: drh tags: trunk
11:55
Tests cases automatically remove many of their temporary files. (CVS 3463) check-in: eef0ec0d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/utf.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains routines used to translate between UTF-8, 
    13     13   ** UTF-16, UTF-16BE, and UTF-16LE.
    14     14   **
    15         -** $Id: utf.c,v 1.40 2006/07/26 14:57:30 drh Exp $
           15  +** $Id: utf.c,v 1.41 2006/10/04 15:23:22 drh Exp $
    16     16   **
    17     17   ** Notes on UTF-8:
    18     18   **
    19     19   **   Byte-0    Byte-1    Byte-2    Byte-3    Value
    20     20   **  0xxxxxxx                                 00000000 00000000 0xxxxxxx
    21     21   **  110yyyyy  10xxxxxx                       00000000 00000yyy yyxxxxxx
    22     22   **  1110zzzz  10yyyyyy  10xxxxxx             00000000 zzzzyyyy yyxxxxxx
................................................................................
   241    241   int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
   242    242     unsigned char zShort[NBFS]; /* Temporary short output buffer */
   243    243     int len;                    /* Maximum length of output string in bytes */
   244    244     unsigned char *zOut;                  /* Output buffer */
   245    245     unsigned char *zIn;                   /* Input iterator */
   246    246     unsigned char *zTerm;                 /* End of input */
   247    247     unsigned char *z;                     /* Output iterator */
   248         -  int c;
          248  +  unsigned int c;
   249    249   
   250    250     assert( pMem->flags&MEM_Str );
   251    251     assert( pMem->enc!=desiredEnc );
   252    252     assert( pMem->enc!=0 );
   253    253     assert( pMem->n>=0 );
   254    254   
   255    255   #if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)
................................................................................
   471    471   ** pZ is a UTF-16 encoded unicode string. If nChar is less than zero,
   472    472   ** return the number of bytes up to (but not including), the first pair
   473    473   ** of consecutive 0x00 bytes in pZ. If nChar is not less than zero,
   474    474   ** then return the number of bytes in the first nChar unicode characters
   475    475   ** in pZ (or up until the first pair of 0x00 bytes, whichever comes first).
   476    476   */
   477    477   int sqlite3utf16ByteLen(const void *zIn, int nChar){
   478         -  int c = 1;
          478  +  unsigned int c = 1;
   479    479     char const *z = zIn;
   480    480     int n = 0;
   481    481     if( SQLITE_UTF16NATIVE==SQLITE_UTF16BE ){
   482    482       /* Using an "if (SQLITE_UTF16NATIVE==SQLITE_UTF16BE)" construct here
   483    483       ** and in other parts of this file means that at one branch will
   484    484       ** not be covered by coverage testing on any single host. But coverage
   485    485       ** will be complete if the tests are run on both a little-endian and 
................................................................................
   556    556   ** characters in each encoding are inverses of each other.
   557    557   */
   558    558   void sqlite3utfSelfTest(){
   559    559     int i;
   560    560     unsigned char zBuf[20];
   561    561     unsigned char *z;
   562    562     int n;
   563         -  int c;
          563  +  unsigned int c;
   564    564   
   565    565     for(i=0; i<0x00110000; i++){
   566    566       z = zBuf;
   567    567       WRITE_UTF8(z, i);
   568    568       n = z-zBuf;
   569    569       z = zBuf;
   570    570       READ_UTF8(z, c);