Commit bd481432 authored by Olivier Bertrand's avatar Olivier Bertrand

- Calculate next position in filamap without assuming ENDING option is true.

modified:
  storage/connect/filamap.cpp

- ftell error: indicate in the error msg that is can be due to wrong ENDING value.
  filamtxt.cpp (MDEV-7030)
modified:
  storage/connect/filamtxt.cpp

- Change STRING according to Alexander Barkov remarks.
  Suppress the wrong Strz function. The unconditional function strz is no more
  used for s->db and s->table_name because they are zero terminated.
modified:
  storage/connect/ha_connect.cc
  storage/connect/xobject.cpp

- Change version number
modified:
  storage/connect/filamap.cpp

- Change PATH_MAX to FN_REFLEN (MDEV-7036)
modified:
  storage/connect/os.h
  storage/connect/tabmul.cpp

- Fix bug by adding a void argument for OP_NOT in Makefilter.
modified:
  storage/connect/filter.cpp

- Begin implementing XMSG style
  Two new system variables are defined:
  msg_lang ENUM session
  errmsg_dir_path STR global readonly
  This is a work in progress.
modified:
  storage/connect/ha_connect.cc
  storage/connect/plgdbutl.cpp
  storage/connect/plugutil.c
  storage/connect/rcmsg.c
  storage/connect/resource.h
parent 1f9259df
......@@ -358,7 +358,12 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
while (*Mempos++ != '\n') ; // What about Unix ???
// Set caller line buffer
len = (Mempos - Fpos) - Ending;
len = (Mempos - Fpos) - 1;
// Don't rely on ENDING setting
if (len > 0 && *(Mempos - 2) == '\r')
len--; // Line ends by CRLF
memcpy(Tdbp->GetLine(), Fpos, len);
Tdbp->GetLine()[len] = '\0';
return RC_OK;
......
......@@ -683,6 +683,7 @@ bool DOSFAM::RecordPos(PGLOBAL g)
{
if ((Fpos = ftell(Stream)) < 0) {
sprintf(g->Message, MSG(FTELL_ERROR), 0, strerror(errno));
strcat(g->Message, " (possible wrong ENDING option value)");
return true;
} // endif Fpos
......
......@@ -101,7 +101,7 @@ PFIL MakeFilter(PGLOBAL g, PFIL fp1, OPVAL vop, PFIL fp2)
PFIL filp = new(g) FILTER(g, vop);
filp->Arg(0) = fp1;
filp->Arg(1) = fp2;
filp->Arg(1) = (fp2) ? fp2 : pXVOID;
if (filp->Convert(g, false))
return NULL;
......
This diff is collapsed.
......@@ -53,12 +53,12 @@ typedef int HANDLE;
#ifdef PATH_MAX
#define _MAX_PATH PATH_MAX
#else
#define _MAX_PATH 260
#define _MAX_PATH FN_REFLEN
#endif
#define _MAX_DRIVE 3
#define _MAX_DIR 256
#define _MAX_FNAME 256
#define _MAX_EXT 256
#define _MAX_DIR FN_REFLEN
#define _MAX_FNAME FN_HEADLEN
#define _MAX_EXT FN_EXTLEN
#define INVALID_HANDLE_VALUE (-1)
#define __stdcall
#endif /* !WIN32 */
......
......@@ -87,9 +87,6 @@ bool Initdone = false;
bool plugin = false; // True when called by the XDB plugin handler
extern "C" {
#if defined(XMSG)
char msglang[16] = "ENGLISH"; // Default language
#endif
extern char version[];
} // extern "C"
......@@ -136,10 +133,12 @@ global_open_error_msg(GLOBAL *g, int msgid, const char *path, const char *mode)
break;
case MSGID_OPEN_MODE_STRERROR:
{char fmt[256];
strcat(strcpy(fmt, MSG(OPEN_MODE_ERROR)), ": %s");
len= snprintf(g->Message, sizeof(g->Message) - 1,
MSG(OPEN_MODE_ERROR) ": %s", // Open(%s) error %d on %s: %s
fmt, // Open(%s) error %d on %s: %s
mode, (int) errno, path, strerror(errno));
break;
}break;
case MSGID_OPEN_STRERROR:
len= snprintf(g->Message, sizeof(g->Message) - 1,
......
......@@ -82,7 +82,8 @@ extern HINSTANCE s_hModule; /* Saved module handle */
#endif // WIN32
#if defined(XMSG)
extern char msglang[];
extern char *msg_path;
char *msglang(void);
#endif // XMSG
/***********************************************************************/
......@@ -326,8 +327,9 @@ char *PlugReadMessage(PGLOBAL g, int mid, char *m)
char *msg;
FILE *mfile = NULL;
GetPrivateProfileString("Message", msglang, "Message\\english.msg",
msgfile, _MAX_PATH, plgini);
//GetPrivateProfileString("Message", msglang, "Message\\english.msg",
// msgfile, _MAX_PATH, plgini);
strcat(strcat(strcpy(msgfile, msg_path), msglang()), ".msg");
if (!(mfile = fopen(msgfile, "rt"))) {
sprintf(stmsg, "Fail to open message file %s for %s", msgfile, msglang);
......
......@@ -21,23 +21,23 @@ char *GetMsgid(int id)
char *p = NULL;
switch (id) {
case IDS_00: p = "%s"; break;
// case IDS_00: p = "%s"; break;
#if defined(FRENCH)
case IDS_01: p = "%s: erreur d'allocation du buffer de communication de %d octets"; break;
case IDS_02: p = "%s: erreur d'allocation mmoire tampon pour %d colonnes"; break;
case IDS_03: p = "%s: Commande spciale invalide"; break;
case IDS_03: p = "%s: Commande spciale invalide"; break;
case IDS_04: p = "%s: Wrong number of arguments %d"; break;
case IDS_05: p = "%s"; break;
case IDS_05: p = "%s"; break;
case IDS_06: p = "%s: Commande dpassant la taille du buffer interne (%d octets)"; break;
case IDS_07: p = "%s: Donnes (%d octets) tronques la taille du buffer"; break;
case IDS_08: p = "%s: Rsultat dpassant la taille du buffer interne (%d octets)"; break;
case IDS_09: p = "Erreur dans %s: %s"; break;
case IDS_09: p = "Erreur dans %s: %s"; break;
case IDS_10: p = "%s: erreur d'allocating mmoire de %d octets"; break;
case IDS_11: p = "%s: mauvaise cl de connexion %d"; break;
case IDS_12: p = "%s: Pas plus de %d connexions autorises pour un programme"; break;
case IDS_13: p = "%s: cl de connexion invalide %d"; break;
case IDS_14: p = "SafeDB: %s rc=%d"; break;
case IDS_15: p = "Mauvaise Dll de communication appele par le moteur %s"; break;
case IDS_15: p = "Mauvaise Dll de communication appele par le moteur %s"; break;
case IDS_TAB_01: p = "Catalogue"; break;
case IDS_TAB_02: p = "Schma"; break;
case IDS_TAB_03: p = "Nom"; break;
......@@ -115,21 +115,23 @@ char *GetMsgid(int id)
case IDS_DSC_01: p = "Nom"; break;
case IDS_DSC_02: p = "Description"; break;
#else // English
#if 0
case IDS_01: p = "%s: error allocating communication buffer of %d bytes"; break;
case IDS_02: p = "%s: error allocating parser memory for %d columns"; break;
case IDS_03: p = "%s: Invalid special command"; break;
case IDS_03: p = "%s: Invalid special command"; break;
case IDS_04: p = "%s: Wrong number of arguments %d"; break;
case IDS_05: p = "%s"; break;
case IDS_05: p = "%s"; break;
case IDS_06: p = "%s: Command bigger than internal buffer of size = %d"; break;
case IDS_07: p = "%s: Data truncated to buffer size, actual length is %d bytes"; break;
case IDS_08: p = "%s: Result bigger than internal buffer of size = %d"; break;
case IDS_09: p = "Error in %s: %s"; break;
case IDS_09: p = "Error in %s: %s"; break;
case IDS_10: p = "%s: error allocating instance memory of %d bytes"; break;
case IDS_11: p = "%s: wrong connection key value %d"; break;
case IDS_12: p = "%s: No more than %d connections allowed from one process"; break;
case IDS_13: p = "%s: invalid connection key value %d"; break;
case IDS_14: p = "SafeDB: %s rc=%d"; break;
case IDS_15: p = "Wrong communication Dll called for engine %s"; break;
case IDS_15: p = "Wrong communication Dll called for engine %s"; break;
#endif // 0
case IDS_TAB_01: p = "Table_Cat"; break;
case IDS_TAB_02: p = "Table_Schema"; break;
case IDS_TAB_03: p = "Table_Name"; break;
......@@ -147,6 +149,7 @@ char *GetMsgid(int id)
case IDS_COL_10: p = "Radix"; break;
case IDS_COL_11: p = "Nullable"; break;
case IDS_COL_12: p = "Remarks"; break;
#if 0
case IDS_INF_01: p = "Type_Name"; break;
case IDS_INF_02: p = "Data_Type"; break;
case IDS_INF_03: p = "Precision"; break;
......@@ -162,12 +165,14 @@ char *GetMsgid(int id)
case IDS_INF_13: p = "Local_Type_Name"; break;
case IDS_INF_14: p = "Minimum_Scale"; break;
case IDS_INF_15: p = "Maximum_Scale"; break;
#endif // 0
case IDS_PKY_01: p = "Table_Catalog"; break;
case IDS_PKY_02: p = "Table_Schema"; break;
case IDS_PKY_03: p = "Table_Name"; break;
case IDS_PKY_04: p = "Column_Name"; break;
case IDS_PKY_05: p = "Key_Seq"; break;
case IDS_PKY_06: p = "Pk_Name"; break;
#if 0
case IDS_FKY_01: p = "PKTable_Catalog"; break;
case IDS_FKY_02: p = "PKTable_Schema"; break;
case IDS_FKY_03: p = "PKTable_Name"; break;
......@@ -181,6 +186,7 @@ char *GetMsgid(int id)
case IDS_FKY_11: p = "Delete_Rule"; break;
case IDS_FKY_12: p = "FK_Name"; break;
case IDS_FKY_13: p = "PK_Name"; break;
#endif // 0
case IDS_STA_01: p = "Table_Catalog"; break;
case IDS_STA_02: p = "Table_Schema"; break;
case IDS_STA_03: p = "Table_Name"; break;
......@@ -194,6 +200,7 @@ char *GetMsgid(int id)
case IDS_STA_11: p = "Cardinality"; break;
case IDS_STA_12: p = "Pages"; break;
case IDS_STA_13: p = "Filter_Condition"; break;
#if 0
case IDS_SPC_01: p = "Scope"; break;
case IDS_SPC_02: p = "Column_Name"; break;
case IDS_SPC_03: p = "Data_Type"; break;
......@@ -202,6 +209,7 @@ char *GetMsgid(int id)
case IDS_SPC_06: p = "Length"; break;
case IDS_SPC_07: p = "Scale"; break;
case IDS_SPC_08: p = "Pseudo_Column"; break;
#endif // 0
case IDS_DRV_01: p = "Description"; break;
case IDS_DRV_02: p = "Attributes"; break;
case IDS_DSC_01: p = "Name"; break;
......
......@@ -2,6 +2,7 @@
// Microsoft Developer Studio generated include file.
// Used by PlgSock.rc
//
#if 0
#define IDS_00 115
#define IDS_01 116
#define IDS_02 117
......@@ -24,6 +25,7 @@
#define IDS_19 134
#define IDS_20 135
#define IDS_21 136
#endif // 0
#define IDS_TABLES 143
#define IDS_TAB_01 144
#define IDS_TAB_02 145
......@@ -43,6 +45,7 @@
#define IDS_COL_10 169
#define IDS_COL_11 170
#define IDS_COL_12 171
#if 0
#define IDS_INFO 175
#define IDS_INF_01 176
#define IDS_INF_02 177
......@@ -59,6 +62,7 @@
#define IDS_INF_13 188
#define IDS_INF_14 189
#define IDS_INF_15 190
#endif // 0
#define IDS_PKEY 191
#define IDS_PKY_01 192
#define IDS_PKY_02 193
......@@ -66,6 +70,7 @@
#define IDS_PKY_04 195
#define IDS_PKY_05 196
#define IDS_PKY_06 197
#if 0
#define IDS_FKEY 207
#define IDS_FKY_01 208
#define IDS_FKY_02 209
......@@ -80,6 +85,7 @@
#define IDS_FKY_11 218
#define IDS_FKY_12 219
#define IDS_FKY_13 220
#endif // 0
#define IDS_STAT 223
#define IDS_STA_01 224
#define IDS_STA_02 225
......@@ -94,6 +100,7 @@
#define IDS_STA_11 234
#define IDS_STA_12 235
#define IDS_STA_13 236
#if 0
#define IDS_SPCOLS 1247
#define IDS_SPC_01 1248
#define IDS_SPC_02 1249
......@@ -118,6 +125,7 @@
#define IDS_PLG_07 1286
#define IDS_PLG_08 1287
#define IDS_PLG_09 1288
#endif // 0
#define IDS_DRIVER 1290
#define IDS_DRV_01 1291
#define IDS_DRV_02 1292
......
......@@ -197,7 +197,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
#else // !WIN32
struct stat fileinfo;
char fn[PATH_MAX], direc[PATH_MAX], pattern[256], ftype[8];
char fn[FN_REFLEN], direc[C], pattern[256], ftype[8];
DIR *dir;
struct dirent *entry;
......
......@@ -272,7 +272,7 @@ bool STRING::Set(char *s, uint n)
if (!s)
return false;
uint len = MY_MIN(strlen(s), n) + 1;
uint len = strnlen(s, n) + 1;
if (len > Size) {
char *p = Realloc(len);
......
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