summaryrefslogtreecommitdiff
path: root/storage/connect
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2013-02-07 17:56:48 +0400
committerAlexander Barkov <bar@mnogosearch.org>2013-02-07 17:56:48 +0400
commitf8f79d933462e39b1039d0644dfc7697850501c7 (patch)
tree570473e4aaf79d092131a60e861e68c27a5d5500 /storage/connect
parent40398f3660273a646eb974092a9ddf6f881d700e (diff)
downloadmariadb-git-f8f79d933462e39b1039d0644dfc7697850501c7.tar.gz
Fixing wrong sprintf() calls.
modified: storage/connect/filamap.cpp storage/connect/filamdbf.cpp storage/connect/filamfix.cpp storage/connect/filamtxt.cpp storage/connect/filamvct.cpp storage/connect/ha_connect.cc storage/connect/osutil.c storage/connect/plgdbutl.cpp storage/connect/plugutil.c storage/connect/tabfix.cpp storage/connect/tabxml.cpp storage/connect/user_connect.cc storage/connect/value.cpp storage/connect/xindex.cpp
Diffstat (limited to 'storage/connect')
-rw-r--r--storage/connect/filamap.cpp2
-rw-r--r--storage/connect/filamdbf.cpp2
-rw-r--r--storage/connect/filamfix.cpp8
-rw-r--r--storage/connect/filamtxt.cpp2
-rw-r--r--storage/connect/filamvct.cpp12
-rw-r--r--storage/connect/ha_connect.cc6
-rw-r--r--storage/connect/osutil.c4
-rw-r--r--storage/connect/plgdbutl.cpp6
-rw-r--r--storage/connect/plugutil.c2
-rw-r--r--storage/connect/tabfix.cpp2
-rw-r--r--storage/connect/tabxml.cpp4
-rw-r--r--storage/connect/user_connect.cc2
-rw-r--r--storage/connect/value.cpp4
-rw-r--r--storage/connect/xindex.cpp4
14 files changed, 34 insertions, 26 deletions
diff --git a/storage/connect/filamap.cpp b/storage/connect/filamap.cpp
index d1544848e5f..39f4128e8d7 100644
--- a/storage/connect/filamap.cpp
+++ b/storage/connect/filamap.cpp
@@ -164,7 +164,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
if (!(*g->Message))
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
- "map", rc, filename);
+ "map", (int) rc, filename);
#ifdef DEBTRACE
htrc("%s\n", g->Message);
diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp
index 37125995069..e8aace3fc06 100644
--- a/storage/connect/filamdbf.cpp
+++ b/storage/connect/filamdbf.cpp
@@ -731,7 +731,7 @@ bool DBFFAM::CopyHeader(PGLOBAL g)
if (fseek(Stream, 0, SEEK_SET))
strcpy(g->Message, "Seek error in CopyHeader");
else if ((n = fread(hdr, 1, hlen, Stream)) != hlen)
- sprintf(g->Message, MSG(BAD_READ_NUMBER), n, To_File);
+ sprintf(g->Message, MSG(BAD_READ_NUMBER), (int) n, To_File);
else if ((n = fwrite(hdr, 1, hlen, T_Stream)) != hlen)
sprintf(g->Message, MSG(WRITE_STRERROR), To_Fbt->Fname
, strerror(errno));
diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp
index 11ba94e87a0..b7cbc76a553 100644
--- a/storage/connect/filamfix.cpp
+++ b/storage/connect/filamfix.cpp
@@ -308,6 +308,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
} else { // Mode == MODE_UPDATE
// T_Stream is the temporary stream or the table file stream itself
if (!T_Stream)
+ {
if (UseTemp /*&& Tdbp->GetMode() == MODE_UPDATE*/) {
if (OpenTempFile(g))
return RC_FX;
@@ -317,7 +318,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
} else
T_Stream = Stream;
-
+ }
Modif++; // Modified line in Update mode
} // endif Mode
@@ -488,7 +489,7 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
#endif
if (len != req) {
- sprintf(g->Message, MSG(DEL_READ_ERROR), req, len);
+ sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len);
return true;
} // endif len
@@ -1135,13 +1136,14 @@ int BGXFAM::WriteBuffer(PGLOBAL g)
} else { // Mode == MODE_UPDATE
// Tfile is the temporary file or the table file handle itself
if (Tfile == INVALID_HANDLE_VALUE)
+ {
if (UseTemp /*&& Tdbp->GetMode() == MODE_UPDATE*/) {
if (OpenTempFile(g))
return RC_FX;
} else
Tfile = Hfile;
-
+ }
Modif++; // Modified line in Update mode
} // endif Mode
diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp
index f5f8af959b2..ed4467b6392 100644
--- a/storage/connect/filamtxt.cpp
+++ b/storage/connect/filamtxt.cpp
@@ -871,7 +871,7 @@ bool DOSFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
htrc("after read req=%d len=%d\n", req, len);
if (len != req) {
- sprintf(g->Message, MSG(DEL_READ_ERROR), req, len);
+ sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len);
return true;
} // endif len
diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp
index 9d4a20db10c..4bc7ecf5903 100644
--- a/storage/connect/filamvct.cpp
+++ b/storage/connect/filamvct.cpp
@@ -899,7 +899,7 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
#endif
if (len != req) {
- sprintf(g->Message, MSG(DEL_READ_ERROR), req, len);
+ sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len);
return true;
} // endif len
@@ -1179,7 +1179,7 @@ bool VCTFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
if (n != (size_t)Nrec) {
if (errno == NO_ERROR)
- sprintf(g->Message, MSG(BAD_READ_NUMBER), n, To_File);
+ sprintf(g->Message, MSG(BAD_READ_NUMBER), (int) n, To_File);
else
sprintf(g->Message, MSG(READ_ERROR),
To_File, strerror(errno));
@@ -1362,7 +1362,7 @@ bool VCMFAM::OpenTableFile(PGLOBAL g)
if (!(*g->Message))
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
- "map", rc, filename);
+ "map", (int) rc, filename);
#ifdef DEBTRACE
htrc("%s\n", g->Message);
@@ -2348,7 +2348,7 @@ bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *bn)
#endif
if (len != req) {
- sprintf(g->Message, MSG(DEL_READ_ERROR), req, len);
+ sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len);
return true;
} // endif len
@@ -2533,7 +2533,7 @@ bool VECFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
#else // !WIN32
if (errno == NO_ERROR)
#endif // !WIN32
- sprintf(g->Message, MSG(BAD_READ_NUMBER), n, fn);
+ sprintf(g->Message, MSG(BAD_READ_NUMBER), (int) n, fn);
else
sprintf(g->Message, MSG(READ_ERROR),
fn, strerror(errno));
@@ -2759,7 +2759,7 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i)
if (!(*g->Message))
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
- "map", rc, filename);
+ "map", (int) rc, filename);
#ifdef DEBTRACE
htrc("%s\n", g->Message);
#endif
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 27f86385f46..822ec49e4eb 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -2547,7 +2547,8 @@ int ha_connect::rnd_next(uchar *buf)
ulonglong tb2= my_interval_timer();
double elapsed= (double) (tb2 - xp->tb1) / 1000000000ULL;
DBUG_PRINT("rnd_next", ("rc=%d nrd=%u fnd=%u nfd=%u sec=%.3lf\n",
- rc, xp->nrd, xp->fnd, xp->nfd, elapsed));
+ rc, (uint) xp->nrd, (uint) xp->fnd,
+ (uint) xp->nfd, elapsed));
xp->tb1= tb2;
xp->fnd= xp->nfd= 0;
} // endif nrd
@@ -2887,7 +2888,8 @@ int ha_connect::external_lock(THD *thd, int lock_type)
if (xtrace) {
printf("%p external_lock: cmdtype=%d\n", this, thd->lex->sql_command);
- printf("Cmd=%s\n", thd->query_string);
+ printf("Cmd=%.*s\n", (int) thd->query_string.length(),
+ thd->query_string.str());
} // endif xtrace
// Next code is temporarily replaced until sql_command is set
diff --git a/storage/connect/osutil.c b/storage/connect/osutil.c
index f59f6d2517f..45c834a4cfc 100644
--- a/storage/connect/osutil.c
+++ b/storage/connect/osutil.c
@@ -14,7 +14,7 @@ my_bool CloseFileHandle(HANDLE h)
/* code to handle Linux and Solaris */
#include <unistd.h>
#include <sys/stat.h>
-//#include <ctype.h>
+#include <ctype.h>
#include <fcntl.h>
extern FILE *debug;
@@ -223,7 +223,7 @@ DWORD FormatMessage(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId,
//if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER)
// return 0; /* means error */
- n = sprintf(buff, "Error code: %d", dwMessageId);
+ n = sprintf(buff, "Error code: %d", (int) dwMessageId);
strncpy(lpBuffer, buff, nSize);
return min(n, nSize);
} /* end of FormatMessage */
diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp
index 6969b49cb81..e980926c820 100644
--- a/storage/connect/plgdbutl.cpp
+++ b/storage/connect/plgdbutl.cpp
@@ -164,7 +164,9 @@ global_open_error_msg(GLOBAL *g, int msgid, const char *path, const char *mode)
case MSGID_OPEN_ERROR_AND_STRERROR:
len= snprintf(g->Message, sizeof(g->Message) - 1,
- MSG(OPEN_ERROR) "%s",// "Open error %d in mode %d on %s: %s"
+ //OPEN_ERROR does not work, as it wants mode %d (not %s)
+ //MSG(OPEN_ERROR) "%s",// "Open error %d in mode %d on %s: %s"
+ "Open error %d in mode %s on %s: %s",
errno, mode, path, strerror(errno));
break;
@@ -1472,6 +1474,7 @@ DllExport void NewPointer(PTABS t, void *oldv, void *newv)
return;
if (!t->P1 || t->P1->Num == 50)
+ {
if (!(tp = new TABPTR)) {
PGLOBAL g = t->G;
@@ -1482,6 +1485,7 @@ DllExport void NewPointer(PTABS t, void *oldv, void *newv)
tp->Num = 0;
t->P1 = tp;
} /* endif tp */
+ }
t->P1->Old[t->P1->Num] = oldv;
t->P1->New[t->P1->Num++] = newv;
diff --git a/storage/connect/plugutil.c b/storage/connect/plugutil.c
index 79434212038..4415dea1f56 100644
--- a/storage/connect/plugutil.c
+++ b/storage/connect/plugutil.c
@@ -459,7 +459,7 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
sprintf(g->Message,
"Not enough memory in %s area for request of %u (used=%d free=%d)",
- pname, size, pph->To_Free, pph->FreeBlk);
+ pname, (uint) size, pph->To_Free, pph->FreeBlk);
#if defined(DEBUG2) || defined(DEBUG3)
htrc("%s\n", g->Message);
diff --git a/storage/connect/tabfix.cpp b/storage/connect/tabfix.cpp
index b3db09e1a2f..9ce04a47410 100644
--- a/storage/connect/tabfix.cpp
+++ b/storage/connect/tabfix.cpp
@@ -471,7 +471,7 @@ void BINCOL::WriteColumn(PGLOBAL g)
break;
case 'C': // Characters
if ((n = (signed)strlen(Value->GetCharString(Buf))) > Long) {
- sprintf(g->Message, MSG(BIN_F_TOO_LONG), Name, n, Long);
+ sprintf(g->Message, MSG(BIN_F_TOO_LONG), Name, (int) n, Long);
longjmp(g->jumper[g->jump_level], 31);
} // endif n
diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp
index c4f20414afe..25d7e03073b 100644
--- a/storage/connect/tabxml.cpp
+++ b/storage/connect/tabxml.cpp
@@ -1199,7 +1199,7 @@ void XMLCOL::ReadColumn(PGLOBAL g)
if (ValNode) {
if (ValNode->GetType() != XML_ELEMENT_NODE &&
ValNode->GetType() != XML_ATTRIBUTE_NODE) {
- sprintf(g->Message, MSG(BAD_VALNODE), Name, ValNode->GetType());
+ sprintf(g->Message, MSG(BAD_VALNODE), ValNode->GetType(), Name);
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
} // endif type
@@ -1392,7 +1392,7 @@ void XMULCOL::ReadColumn(PGLOBAL g)
if (ValNode->GetType() != XML_ELEMENT_NODE &&
ValNode->GetType() != XML_ATTRIBUTE_NODE) {
- sprintf(g->Message, MSG(BAD_VALNODE), Name, ValNode->GetType());
+ sprintf(g->Message, MSG(BAD_VALNODE), ValNode->GetType(), Name);
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
} // endif type
diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc
index 8c14fa2f45e..c5abb554a6d 100644
--- a/storage/connect/user_connect.cc
+++ b/storage/connect/user_connect.cc
@@ -144,7 +144,7 @@ bool user_connect::CheckCleanup(void)
last_query_id= thdp->query_id;
if (xtrace)
- printf("=====> Begin new query %d\n", last_query_id);
+ printf("=====> Begin new query %llu\n", last_query_id);
return true;
} // endif query_id
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index 8a87c860634..b67e8a6348e 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -705,7 +705,7 @@ char *STRING::GetShortString(char *p, int n)
/***********************************************************************/
char *STRING::GetIntString(char *p, int n)
{
- sprintf(p, "%*d", n, atol(Strp));
+ sprintf(p, "%*ld", n, atol(Strp));
return p;
} // end of GetIntString
@@ -4336,7 +4336,7 @@ char *DFVAL::GetShortString(char *p, int n)
/***********************************************************************/
char *DFVAL::GetIntString(char *p, int n)
{
- sprintf(p, "%*ld", n, (int)Fval);
+ sprintf(p, "%*ld", n, (long) Fval);
return p;
} // end of GetIntString
diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp
index 52595c27df3..d1528395252 100644
--- a/storage/connect/xindex.cpp
+++ b/storage/connect/xindex.cpp
@@ -2109,7 +2109,7 @@ bool XFILE::Open(PGLOBAL g, char *filename, MODE mode)
/* Position the cursor at end of file so ftell returns file size. */
/*******************************************************************/
if (fseek(Xfile, 0, SEEK_END)) {
- sprintf(g->Message, MSG(FUNC_ERRNO), "Xseek", errno);
+ sprintf(g->Message, MSG(FUNC_ERRNO), errno, "Xseek");
return true;
} // endif
@@ -2140,7 +2140,7 @@ bool XFILE::Seek(PGLOBAL g, int low, int high, int origin)
#endif // !_DEBUG
if (fseek(Xfile, low, origin)) {
- sprintf(g->Message, MSG(FUNC_ERRNO), "Xseek", errno);
+ sprintf(g->Message, MSG(FUNC_ERRNO), errno, "Xseek");
return true;
} // endif