/ Check-in [27fe1288]
Login

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

Overview
Comment:Fixes for uninitialized variables. Tickets #2658 and #2659. (CVS 4437)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 27fe1288336665c4d47c5d7ddcbeacc451ec4a9d
User & Date: drh 2007-09-20 10:02:54
Context
2007-09-20
11:32
fix typo in comment (CVS 4438) check-in: c2ac43a4 user: rse tags: trunk
10:02
Fixes for uninitialized variables. Tickets #2658 and #2659. (CVS 4437) check-in: 27fe1288 user: drh tags: trunk
08:38
The code is correct as it contains an assert(3) in the "default" switch case, but GCC 4.3 is not able to detect this and instead complains with "warning: 'amode' may be used uninitialized in this function". Hence, although the assert(3) already protects the code here, get rid of this compiler warning by doing a simple initialization of the "amode" variable. (CVS 4436) check-in: 91831ff2 user: rse tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

  2286   2286   ** value.
  2287   2287   **
  2288   2288   ** If SQLITE_OK is returned, the caller is responsible for closing
  2289   2289   ** the file descriptor *pFd using close().
  2290   2290   */
  2291   2291   static int openDirectory(const char *zFilename, int *pFd){
  2292   2292     int ii;
  2293         -  int fd;
         2293  +  int fd = -1;
  2294   2294     char zDirname[MAX_PATHNAME+1];
  2295   2295   
  2296   2296     sqlite3_snprintf(MAX_PATHNAME, zDirname, "%s", zFilename);
  2297   2297     for(ii=strlen(zDirname); ii>=0 && zDirname[ii]!='/'; ii--);
  2298   2298     if( ii>0 ){
  2299   2299       zDirname[ii] = '\0';
  2300   2300       fd = open(zDirname, O_RDONLY|O_BINARY, 0);
  2301         -    if( fd>0 ){
         2301  +    if( fd>=0 ){
  2302   2302   #ifdef FD_CLOEXEC
  2303   2303         fcntl(fd, F_SETFD, fcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
  2304   2304   #endif
  2305   2305         OSTRACE3("OPENDIR %-3d %s\n", fd, zDirname);
  2306   2306       }
  2307   2307     }
  2308   2308     *pFd = fd;
  2309         -  return (fd>0?SQLITE_OK:SQLITE_CANTOPEN);
         2309  +  return (fd>=0?SQLITE_OK:SQLITE_CANTOPEN);
  2310   2310   }
  2311   2311   
  2312   2312   /*
  2313   2313   ** Open the file zPath.
  2314   2314   ** 
  2315   2315   ** Previously, the SQLite OS layer used three functions in place of this
  2316   2316   ** one:

Changes to src/vtab.c.

     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   ** This file contains code used to help implement virtual tables.
    13     13   **
    14         -** $Id: vtab.c,v 1.57 2007/09/04 15:38:58 danielk1977 Exp $
           14  +** $Id: vtab.c,v 1.58 2007/09/20 10:02:54 drh Exp $
    15     15   */
    16     16   #ifndef SQLITE_OMIT_VIRTUALTABLE
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   static int createModule(
    20     20     sqlite3 *db,                    /* Database in which module is registered */
    21     21     const char *zName,              /* Name assigned to this module */
................................................................................
   744    744   ){
   745    745     Table *pTab;
   746    746     sqlite3_vtab *pVtab;
   747    747     sqlite3_module *pMod;
   748    748     void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
   749    749     void *pArg;
   750    750     FuncDef *pNew;
   751         -  int rc;
          751  +  int rc = 0;
   752    752     char *zLowerName;
   753    753     unsigned char *z;
   754    754   
   755    755   
   756    756     /* Check to see the left operand is a column in a virtual table */
   757    757     if( pExpr==0 ) return pDef;
   758    758     if( pExpr->op!=TK_COLUMN ) return pDef;