/ Check-in [7b56763a]
Login

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

Overview
Comment:Fix bugs introduced by checkin (2656) and do some modest code enhancements. (CVS 2657)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7b56763a8b514834198d2392639d6d726b17d901
User & Date: drh 2005-09-05 20:06:49
Context
2005-09-05
20:35
Make due with "sub()" instead of "gsub()" in awk scripts so that builds will work on Solaris which will runs an archiac version of AWK. (CVS 2658) check-in: 449a7895 user: drh tags: trunk
20:06
Fix bugs introduced by checkin (2656) and do some modest code enhancements. (CVS 2657) check-in: 7b56763a user: drh tags: trunk
19:08
Use the unicode API to win32 where available. Tickets #1407, #1396, #1331, #1243, #1206 (CVS 2656) check-in: 3ec58c67 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.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 for analyzing expressions and
    13     13   ** for generating VDBE code that evaluates expressions in SQLite.
    14     14   **
    15         -** $Id: expr.c,v 1.223 2005/09/01 03:07:44 drh Exp $
           15  +** $Id: expr.c,v 1.224 2005/09/05 20:06:49 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   #include <ctype.h>
    19     19   
    20     20   /*
    21     21   ** Return the 'affinity' of the expression pExpr if any.
    22     22   **
................................................................................
  2074   2074   */
  2075   2075   static int analyzeAggregate(void *pArg, Expr *pExpr){
  2076   2076     int i;
  2077   2077     AggExpr *pAgg;
  2078   2078     NameContext *pNC = (NameContext *)pArg;
  2079   2079     Parse *pParse = pNC->pParse;
  2080   2080     SrcList *pSrcList = pNC->pSrcList;
  2081         -  Expr *pAggExpr;
  2082   2081   
  2083   2082     switch( pExpr->op ){
  2084   2083       case TK_COLUMN: {
  2085   2084         for(i=0; pSrcList && i<pSrcList->nSrc; i++){
  2086   2085           if( pExpr->iTable==pSrcList->a[i].iCursor ){
  2087   2086             pAgg = pParse->aAgg;
  2088   2087             for(i=0; i<pParse->nAgg; i++, pAgg++){
         2088  +            Expr *pE;
  2089   2089               if( pAgg->isAgg ) continue;
  2090         -            if( (pAggExpr = pAgg->pExpr)->iTable==pExpr->iTable
  2091         -             && pAggExpr->iColumn==pExpr->iColumn ){
         2090  +            pE = pAgg->pExpr;
         2091  +            if( pE->iTable==pExpr->iTable && pE->iColumn==pExpr->iColumn ){
  2092   2092                 break;
  2093   2093               }
  2094   2094             }
  2095   2095             if( i>=pParse->nAgg ){
  2096   2096               i = appendAggInfo(pParse);
  2097   2097               if( i<0 ) return 1;
  2098   2098               pAgg = &pParse->aAgg[i];

Changes to src/os_win.c.

    84     84     int nByte;
    85     85     WCHAR *zWideFilename;
    86     86   
    87     87     if( !isNT() ){
    88     88       return 0;
    89     89     }
    90     90     nByte = MultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0)*sizeof(WCHAR);
    91         -  zWideFilename = sqliteMalloc( nByte );
           91  +  zWideFilename = sqliteMalloc( nByte*sizeof(zWideFilename[0]) );
    92     92     if( zWideFilename==0 ){
    93     93       return 0;
    94     94     }
    95     95     nByte = MultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename, nByte);
    96     96     if( nByte==0 ){
    97     97       sqliteFree(zWideFilename);
    98     98       zWideFilename = 0;
................................................................................
   383    383       zTempPath[SQLITE_TEMPNAME_SIZE-30] = 0;
   384    384     }else if( isNT() ){
   385    385       char *zMulti;
   386    386       WCHAR zWidePath[SQLITE_TEMPNAME_SIZE];
   387    387       GetTempPathW(SQLITE_TEMPNAME_SIZE-30, zWidePath);
   388    388       zMulti = unicodeToUtf8(zWidePath);
   389    389       if( zMulti ){
   390         -      memcpy(zTempPath, zMulti, SQLITE_TEMPNAME_SIZE-30);
          390  +      strncpy(zTempPath, zMulti, SQLITE_TEMPNAME_SIZE-30);
   391    391         zTempPath[SQLITE_TEMPNAME_SIZE-30] = 0;
   392    392         sqliteFree(zMulti);
   393    393       }
   394    394     }else{
   395    395       GetTempPathA(SQLITE_TEMPNAME_SIZE-30, zTempPath);
   396    396     }
   397    397     for(i=strlen(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){}

Changes to src/select.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 C code routines that are called by the parser
    13     13   ** to handle SELECT statements in SQLite.
    14     14   **
    15         -** $Id: select.c,v 1.259 2005/09/01 12:16:29 drh Exp $
           15  +** $Id: select.c,v 1.260 2005/09/05 20:06:49 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   
    20     20   /*
    21     21   ** Allocate a new Select structure and return a pointer to that
    22     22   ** structure.
................................................................................
  2163   2163     */
  2164   2164     v = sqlite3GetVdbe(pParse);
  2165   2165     if( v==0 ) return 0;
  2166   2166   
  2167   2167     /* If the output is destined for a temporary table, open that table.
  2168   2168     */
  2169   2169     if( eDest==SRT_TempTable ){
  2170         -    sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, 0);
  2171         -    sqlite3VdbeAddOp(v, OP_SetNumColumns, iParm, 1);
         2170  +    sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, 1);
  2172   2171     }
  2173   2172   
  2174   2173     /* Generating code to find the min or the max.  Basically all we have
  2175   2174     ** to do is find the first or the last entry in the chosen index.  If
  2176   2175     ** the min() or max() is on the INTEGER PRIMARY KEY, then find the first
  2177   2176     ** or last entry in the main table.
  2178   2177     */

Changes to src/vdbeaux.c.

  1699   1699         x = (x<<32) | y;
  1700   1700         pMem->i = *(i64*)&x;
  1701   1701         pMem->flags = MEM_Int;
  1702   1702         return 6;
  1703   1703       }
  1704   1704       case 6:   /* 8-byte signed integer */
  1705   1705       case 7: { /* IEEE floating point */
         1706  +      u64 x;
         1707  +      u32 y;
  1706   1708   #ifndef NDEBUG
  1707   1709         /* Verify that integers and floating point values use the same
  1708   1710         ** byte order.  The byte order differs on some (broken) architectures.
  1709   1711         */
  1710   1712         static const u64 t1 = ((u64)0x3ff00000)<<32;
  1711   1713         assert( 1.0==*(double*)&t1 );
  1712   1714   #endif
  1713   1715   
  1714         -      u64 x = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
  1715         -      u32 y = (buf[4]<<24) | (buf[5]<<16) | (buf[6]<<8) | buf[7];
         1716  +      x = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
         1717  +      y = (buf[4]<<24) | (buf[5]<<16) | (buf[6]<<8) | buf[7];
  1716   1718         x = (x<<32) | y;
  1717   1719         if( serial_type==6 ){
  1718   1720           pMem->i = *(i64*)&x;
  1719   1721           pMem->flags = MEM_Int;
  1720   1722         }else{
  1721   1723           pMem->r = *(double*)&x;
  1722   1724           pMem->flags = MEM_Real;