Commit 66c1665e authored by Alexander Barkov's avatar Alexander Barkov

Fixing numerous "variable is set but never used" warnings.

modified:
  storage/connect/filamfix.cpp
  storage/connect/filamtxt.cpp
  storage/connect/filamvct.cpp
  storage/connect/odbconn.cpp
  storage/connect/tabodbc.cpp
  storage/connect/xindex.cpp
parent 63446440
...@@ -425,9 +425,9 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -425,9 +425,9 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
/* for compatibility with Text files and other OS's. */ /* for compatibility with Text files and other OS's. */
/*****************************************************************/ /*****************************************************************/
char filename[_MAX_PATH]; char filename[_MAX_PATH];
int rc, h; int h;
rc = PlugCloseFile(g, To_Fb); /*rc= */PlugCloseFile(g, To_Fb);
PlugSetPath(filename, To_File, Tdbp->GetPath()); PlugSetPath(filename, To_File, Tdbp->GetPath());
if ((h= global_open(g, MSGID_OPEN_STRERROR, filename, O_WRONLY)) <= 0) if ((h= global_open(g, MSGID_OPEN_STRERROR, filename, O_WRONLY)) <= 0)
......
...@@ -786,10 +786,10 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -786,10 +786,10 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
/* for compatibility with Text files and other OS's. */ /* for compatibility with Text files and other OS's. */
/*****************************************************************/ /*****************************************************************/
char filename[_MAX_PATH]; char filename[_MAX_PATH];
int h, rc; // File handle, return code int h; // File handle, return code
PlugSetPath(filename, To_File, Tdbp->GetPath()); PlugSetPath(filename, To_File, Tdbp->GetPath());
rc = PlugCloseFile(g, To_Fb); /*rc=*/ PlugCloseFile(g, To_Fb);
if ((h= global_open(g, MSGID_OPEN_STRERROR, filename, O_WRONLY)) <= 0) if ((h= global_open(g, MSGID_OPEN_STRERROR, filename, O_WRONLY)) <= 0)
return RC_FX; return RC_FX;
......
...@@ -204,7 +204,6 @@ bool VCTFAM::SetBlockInfo(PGLOBAL g) ...@@ -204,7 +204,6 @@ bool VCTFAM::SetBlockInfo(PGLOBAL g)
{ {
char filename[_MAX_PATH]; char filename[_MAX_PATH];
bool rc = false; bool rc = false;
int k;
size_t n; size_t n;
VECHEADER vh; VECHEADER vh;
FILE *s; FILE *s;
...@@ -216,7 +215,7 @@ bool VCTFAM::SetBlockInfo(PGLOBAL g) ...@@ -216,7 +215,7 @@ bool VCTFAM::SetBlockInfo(PGLOBAL g)
s = Stream; s = Stream;
if (Header == 1) if (Header == 1)
k = fseek(s, 0, SEEK_SET); /*k =*/ fseek(s, 0, SEEK_SET);
} else } else
s= global_fopen(g, MSGID_CANNOT_OPEN, filename, "r+b"); s= global_fopen(g, MSGID_CANNOT_OPEN, filename, "r+b");
...@@ -230,7 +229,7 @@ bool VCTFAM::SetBlockInfo(PGLOBAL g) ...@@ -230,7 +229,7 @@ bool VCTFAM::SetBlockInfo(PGLOBAL g)
sprintf(g->Message, "Error opening header file %s", filename); sprintf(g->Message, "Error opening header file %s", filename);
return true; return true;
} else if (Header == 3) } else if (Header == 3)
k = fseek(s, -(int)sizeof(VECHEADER), SEEK_END); /*k =*/ fseek(s, -(int)sizeof(VECHEADER), SEEK_END);
vh.MaxRec = MaxBlk * Bsize; vh.MaxRec = MaxBlk * Bsize;
vh.NumRec = (Block - 1) * Nrec + Last; vh.NumRec = (Block - 1) * Nrec + Last;
...@@ -775,10 +774,10 @@ int VCTFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -775,10 +774,10 @@ int VCTFAM::DeleteRecords(PGLOBAL g, int irc)
/* checked for compatibility with Text files and other OS's. */ /* checked for compatibility with Text files and other OS's. */
/***************************************************************/ /***************************************************************/
char filename[_MAX_PATH]; char filename[_MAX_PATH];
int rc, h; int h;
rc = CleanUnusedSpace(g); // Clean last block /*rc =*/ CleanUnusedSpace(g); // Clean last block
rc = PlugCloseFile(g, To_Fb); /*rc =*/ PlugCloseFile(g, To_Fb);
Stream = NULL; // For SetBlockInfo Stream = NULL; // For SetBlockInfo
PlugSetPath(filename, To_File, Tdbp->GetPath()); PlugSetPath(filename, To_File, Tdbp->GetPath());
...@@ -1705,7 +1704,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -1705,7 +1704,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
/***********************************************************************/ /***********************************************************************/
void VCMFAM::CloseTableFile(PGLOBAL g) void VCMFAM::CloseTableFile(PGLOBAL g)
{ {
int rc = 0, wrc = RC_OK; int wrc = RC_OK;
MODE mode = Tdbp->GetMode(); MODE mode = Tdbp->GetMode();
if (mode == MODE_INSERT) { if (mode == MODE_INSERT) {
...@@ -1728,7 +1727,7 @@ void VCMFAM::CloseTableFile(PGLOBAL g) ...@@ -1728,7 +1727,7 @@ void VCMFAM::CloseTableFile(PGLOBAL g)
PlugCloseFile(g, To_Fb); PlugCloseFile(g, To_Fb);
if (wrc != RC_FX) if (wrc != RC_FX)
rc = ResetTableSize(g, Block, Last); /*rc =*/ ResetTableSize(g, Block, Last);
} else if (mode != MODE_DELETE) } else if (mode != MODE_DELETE)
PlugCloseFile(g, To_Fb); PlugCloseFile(g, To_Fb);
...@@ -2205,11 +2204,11 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -2205,11 +2204,11 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc)
/* for compatibility with other OS's. */ /* for compatibility with other OS's. */
/*****************************************************************/ /*****************************************************************/
char filename[_MAX_PATH]; char filename[_MAX_PATH];
int h, rc; // File handle, return code int h; // File handle, return code
for (int i = 0; i < Ncol; i++) { for (int i = 0; i < Ncol; i++) {
sprintf(filename, Colfn, i + 1); sprintf(filename, Colfn, i + 1);
rc = PlugCloseFile(g, To_Fbs[i]); /*rc =*/ PlugCloseFile(g, To_Fbs[i]);
if ((h= global_open(g, MSGID_OPEN_STRERROR, filename, O_WRONLY)) <= 0) if ((h= global_open(g, MSGID_OPEN_STRERROR, filename, O_WRONLY)) <= 0)
return RC_FX; return RC_FX;
...@@ -3118,7 +3117,6 @@ int BGVFAM::GetBlockInfo(PGLOBAL g) ...@@ -3118,7 +3117,6 @@ int BGVFAM::GetBlockInfo(PGLOBAL g)
{ {
char filename[_MAX_PATH]; char filename[_MAX_PATH];
int n; int n;
bool b;
VECHEADER vh; VECHEADER vh;
HANDLE h; HANDLE h;
...@@ -3162,7 +3160,7 @@ int BGVFAM::GetBlockInfo(PGLOBAL g) ...@@ -3162,7 +3160,7 @@ int BGVFAM::GetBlockInfo(PGLOBAL g)
return n; return n;
} else if (Header == 3) } else if (Header == 3)
b = BigSeek(g, h, -(BIGINT)sizeof(vh), true); /*b = */ BigSeek(g, h, -(BIGINT)sizeof(vh), true);
if (BigRead(g, h, &vh, sizeof(vh))) { if (BigRead(g, h, &vh, sizeof(vh))) {
sprintf(g->Message, "Error reading header file %s", filename); sprintf(g->Message, "Error reading header file %s", filename);
...@@ -3190,7 +3188,7 @@ int BGVFAM::GetBlockInfo(PGLOBAL g) ...@@ -3190,7 +3188,7 @@ int BGVFAM::GetBlockInfo(PGLOBAL g)
bool BGVFAM::SetBlockInfo(PGLOBAL g) bool BGVFAM::SetBlockInfo(PGLOBAL g)
{ {
char filename[_MAX_PATH]; char filename[_MAX_PATH];
bool bk, b = false, rc = false; bool b = false, rc = false;
VECHEADER vh; VECHEADER vh;
HANDLE h = INVALID_HANDLE_VALUE; HANDLE h = INVALID_HANDLE_VALUE;
...@@ -3201,7 +3199,7 @@ bool BGVFAM::SetBlockInfo(PGLOBAL g) ...@@ -3201,7 +3199,7 @@ bool BGVFAM::SetBlockInfo(PGLOBAL g)
h = Hfile; h = Hfile;
if (Header == 1) if (Header == 1)
bk = BigSeek(g, h, (BIGINT)0); /*bk =*/ BigSeek(g, h, (BIGINT)0);
} else } else
b = true; b = true;
...@@ -3230,7 +3228,7 @@ bool BGVFAM::SetBlockInfo(PGLOBAL g) ...@@ -3230,7 +3228,7 @@ bool BGVFAM::SetBlockInfo(PGLOBAL g)
} // endif h } // endif h
if (Header == 3) if (Header == 3)
bk = BigSeek(g, h, -(BIGINT)sizeof(vh), true); /*bk =*/ BigSeek(g, h, -(BIGINT)sizeof(vh), true);
vh.MaxRec = MaxBlk * Bsize; vh.MaxRec = MaxBlk * Bsize;
vh.NumRec = (Block - 1) * Nrec + Last; vh.NumRec = (Block - 1) * Nrec + Last;
......
...@@ -954,17 +954,17 @@ int ODBConn::Open(PSZ ConnectString, DWORD options) ...@@ -954,17 +954,17 @@ int ODBConn::Open(PSZ ConnectString, DWORD options)
// Allocate the HDBC and make connection // Allocate the HDBC and make connection
try { try {
PSZ ver; /*PSZ ver;*/
AllocConnect(options); AllocConnect(options);
ver = GetStringInfo(SQL_ODBC_VER); /*ver = GetStringInfo(SQL_ODBC_VER);*/
if (Connect(options)) { if (Connect(options)) {
strcpy(g->Message, MSG(CONNECT_CANCEL)); strcpy(g->Message, MSG(CONNECT_CANCEL));
return 0; return 0;
} // endif } // endif
ver = GetStringInfo(SQL_DRIVER_ODBC_VER); /*ver = GetStringInfo(SQL_DRIVER_ODBC_VER);*/
} catch(DBX *xp) { } catch(DBX *xp) {
// strcpy(g->Message, xp->m_ErrMsg[0]); // strcpy(g->Message, xp->m_ErrMsg[0]);
strcpy(g->Message, xp->GetErrorMessage(0)); strcpy(g->Message, xp->GetErrorMessage(0));
...@@ -1213,13 +1213,13 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols) ...@@ -1213,13 +1213,13 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
b = false; b = false;
if (m_hstmt) { if (m_hstmt) {
RETCODE rc; /*RETCODE rc;*/
// All this did not seems to make sense and was been commented out // All this did not seems to make sense and was been commented out
// if (IsOpen()) // if (IsOpen())
// Close(SQL_CLOSE); // Close(SQL_CLOSE);
rc = SQLFreeStmt(m_hstmt, SQL_CLOSE); /*rc =*/ SQLFreeStmt(m_hstmt, SQL_CLOSE);
hstmt = m_hstmt; hstmt = m_hstmt;
m_hstmt = NULL; m_hstmt = NULL;
ThrowDBX(MSG(SEQUENCE_ERROR)); ThrowDBX(MSG(SEQUENCE_ERROR));
...@@ -1831,7 +1831,7 @@ int ODBConn::GetCatInfo(CATPARM *cap) ...@@ -1831,7 +1831,7 @@ int ODBConn::GetCatInfo(CATPARM *cap)
/***********************************************************************/ /***********************************************************************/
void ODBConn::Close() void ODBConn::Close()
{ {
RETCODE rc; /*RETCODE rc;*/
#if 0 #if 0
// Close any open recordsets // Close any open recordsets
...@@ -1856,13 +1856,13 @@ void ODBConn::Close() ...@@ -1856,13 +1856,13 @@ void ODBConn::Close()
if (m_hstmt) { if (m_hstmt) {
// Is required for multiple tables // Is required for multiple tables
rc = SQLFreeStmt(m_hstmt, SQL_DROP); /*rc =*/ SQLFreeStmt(m_hstmt, SQL_DROP);
m_hstmt = NULL; m_hstmt = NULL;
} // endif m_hstmt } // endif m_hstmt
if (m_hdbc != SQL_NULL_HDBC) { if (m_hdbc != SQL_NULL_HDBC) {
rc = SQLDisconnect(m_hdbc); /*rc =*/ SQLDisconnect(m_hdbc);
rc = SQLFreeConnect(m_hdbc); /*rc =*/ SQLFreeConnect(m_hdbc);
m_hdbc = SQL_NULL_HDBC; m_hdbc = SQL_NULL_HDBC;
// AfxLockGlobals(CRIT_ODBC); // AfxLockGlobals(CRIT_ODBC);
......
...@@ -324,7 +324,7 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt) ...@@ -324,7 +324,7 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
{ {
char *colist, *tabname, *sql, buf[64]; char *colist, *tabname, *sql, buf[64];
LPCSTR ownp = NULL, qualp = NULL; LPCSTR ownp = NULL, qualp = NULL;
int rc, len, ncol = 0; int len, ncol = 0;
bool first = true; bool first = true;
PTABLE tablep = To_Table; PTABLE tablep = To_Table;
PCOL colp; PCOL colp;
...@@ -341,7 +341,7 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt) ...@@ -341,7 +341,7 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
for (colp = Columns; colp; colp = colp->GetNext()) for (colp = Columns; colp; colp = colp->GetNext())
if (!colp->IsSpecial()) { if (!colp->IsSpecial()) {
// Column name can be in UTF-8 encoding // Column name can be in UTF-8 encoding
rc= Decode(colp->GetName(), buf, sizeof(buf)); /*rc=*/ Decode(colp->GetName(), buf, sizeof(buf));
if (Quote) { if (Quote) {
if (first) { if (first) {
...@@ -376,7 +376,7 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt) ...@@ -376,7 +376,7 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
} // endif cnt } // endif cnt
// Table name can be encoded in UTF-8 // Table name can be encoded in UTF-8
rc = Decode(TableName, buf, sizeof(buf)); /*rc = */Decode(TableName, buf, sizeof(buf));
// Put table name between identifier quotes in case in contains blanks // Put table name between identifier quotes in case in contains blanks
tabname = (char*)PlugSubAlloc(g, NULL, strlen(buf) + 3); tabname = (char*)PlugSubAlloc(g, NULL, strlen(buf) + 3);
......
...@@ -2368,7 +2368,6 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) ...@@ -2368,7 +2368,6 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode)
} // endif Mode } // endif Mode
#else // UNIX #else // UNIX
int rc = 0;
int oflag = O_LARGEFILE; // Enable file size > 2G int oflag = O_LARGEFILE; // Enable file size > 2G
mode_t pmod = 0; mode_t pmod = 0;
...@@ -2394,7 +2393,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) ...@@ -2394,7 +2393,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode)
Hfile= global_open(g, MSGID_OPEN_ERROR_AND_STRERROR, filename, oflag, pmod); Hfile= global_open(g, MSGID_OPEN_ERROR_AND_STRERROR, filename, oflag, pmod);
if (Hfile == INVALID_HANDLE_VALUE) { if (Hfile == INVALID_HANDLE_VALUE) {
rc = errno; /*rc = errno;*/
#if defined(TRACE) #if defined(TRACE)
printf("Open: %s\n", g->Message); printf("Open: %s\n", g->Message);
#endif // TRACE #endif // TRACE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment