/ Check-in [476e7c3f]
Login

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

Overview
Comment:Increase test coverage by statically defining SQLITE_BIGENDIAN and related macros for ix86 platforms. Still a run-time test for other architectures. Need to add additional cases to cover other popular processors. (CVS 3781)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 476e7c3fcc69d8b21d161c758aaa5ef7163abb15
User & Date: drh 2007-03-31 15:28:00
Context
2007-03-31
16:29
Fix the amalgamation so that it can be compiled with REDEF_IO enabled. (CVS 3782) check-in: 6a3d6142 user: drh tags: trunk
15:28
Increase test coverage by statically defining SQLITE_BIGENDIAN and related macros for ix86 platforms. Still a run-time test for other architectures. Need to add additional cases to cover other popular processors. (CVS 3781) check-in: 476e7c3f user: drh tags: trunk
15:02
Improved test coverage for printf.c. (CVS 3780) check-in: c2badb20 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Main file for the SQLite library.  The routines in this file
    13     13   ** implement the programmer interface to the library.  Routines in
    14     14   ** other files are for internal use by SQLite and should not be
    15     15   ** accessed by users of the library.
    16     16   **
    17         -** $Id: main.c,v 1.366 2007/03/30 20:43:42 drh Exp $
           17  +** $Id: main.c,v 1.367 2007/03/31 15:28:00 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "os.h"
    21     21   #include <ctype.h>
    22     22   
    23         -/*
    24         -** The following constant value is used by the SQLITE_BIGENDIAN and
    25         -** SQLITE_LITTLEENDIAN macros.
    26         -*/
    27         -const int sqlite3one = 1;
    28         -
    29     23   /*
    30     24   ** The version of the library
    31     25   */
    32     26   const char sqlite3_version[] = SQLITE_VERSION;
    33     27   const char *sqlite3_libversion(void){ return sqlite3_version; }
    34     28   int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; }
    35     29   

Changes to src/sqliteInt.h.

     7      7   **    May you do good and not evil.
     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   ** Internal interface definitions for SQLite.
    13     13   **
    14         -** @(#) $Id: sqliteInt.h,v 1.547 2007/03/29 05:51:49 drh Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.548 2007/03/31 15:28:00 drh Exp $
    15     15   */
    16     16   #ifndef _SQLITEINT_H_
    17     17   #define _SQLITEINT_H_
    18     18   
    19     19   #if defined(SQLITE_TCL) || defined(TCLSH)
    20     20   # include <tcl.h>
    21     21   #endif
................................................................................
   208    208   typedef UINT8_TYPE i8;             /* 1-byte signed integer */
   209    209   
   210    210   /*
   211    211   ** Macros to determine whether the machine is big or little endian,
   212    212   ** evaluated at runtime.
   213    213   */
   214    214   extern const int sqlite3one;
   215         -#define SQLITE_BIGENDIAN    (*(char *)(&sqlite3one)==0)
   216         -#define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
          215  +#if defined(i386) || defined(__i386__) || defined(_M_IX86)
          216  +# define SQLITE_BIGENDIAN    0
          217  +# define SQLITE_LITTLEENDIAN 1
          218  +# define SQLITE_UTF16NATIVE  SQLITE_UTF16LE
          219  +#else
          220  +# define SQLITE_BIGENDIAN    (*(char *)(&sqlite3one)==0)
          221  +# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
          222  +# define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)
          223  +#endif
   217    224   
   218    225   /*
   219    226   ** An instance of the following structure is used to store the busy-handler
   220    227   ** callback for a given sqlite handle. 
   221    228   **
   222    229   ** The sqlite.busyHandler member of the sqlite struct contains the busy
   223    230   ** callback for the database handle. Each pager opened via the sqlite
................................................................................
   407    414   ** have been filled out.  If the schema changes, these column names might
   408    415   ** changes and so the view will need to be reset.
   409    416   */
   410    417   #define DB_SchemaLoaded    0x0001  /* The schema has been loaded */
   411    418   #define DB_UnresetViews    0x0002  /* Some views have defined column names */
   412    419   #define DB_Empty           0x0004  /* The file is empty (length 0 bytes) */
   413    420   
   414         -#define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)
   415    421   
   416    422   /*
   417    423   ** Each database is an instance of the following structure.
   418    424   **
   419    425   ** The sqlite.lastRowid records the last insert rowid generated by an
   420    426   ** insert statement.  Inserts on views do not affect its value.  Each
   421    427   ** trigger has its own context, so that lastRowid can be updated inside

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.43 2006/10/19 01:58:44 drh Exp $
           15  +** $Id: utf.c,v 1.44 2007/03/31 15:28:00 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
................................................................................
    58     58   ** sqlite3utf8LikeCompare()  - Do a LIKE match given two UTF8 char* strings.
    59     59   **
    60     60   */
    61     61   #include "sqliteInt.h"
    62     62   #include <assert.h>
    63     63   #include "vdbeInt.h"
    64     64   
           65  +/*
           66  +** The following constant value is used by the SQLITE_BIGENDIAN and
           67  +** SQLITE_LITTLEENDIAN macros.
           68  +*/
           69  +const int sqlite3one = 1;
           70  +
    65     71   /*
    66     72   ** This table maps from the first byte of a UTF-8 character to the number
    67     73   ** of trailing bytes expected. A value '4' indicates that the table key
    68     74   ** is not a legal first byte for a UTF-8 character.
    69     75   */
    70     76   static const u8 xtra_utf8_bytes[256]  = {
    71     77   /* 0xxxxxxx */