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) ...@@ -358,7 +358,12 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
while (*Mempos++ != '\n') ; // What about Unix ??? while (*Mempos++ != '\n') ; // What about Unix ???
// Set caller line buffer // 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); memcpy(Tdbp->GetLine(), Fpos, len);
Tdbp->GetLine()[len] = '\0'; Tdbp->GetLine()[len] = '\0';
return RC_OK; return RC_OK;
......
...@@ -683,6 +683,7 @@ bool DOSFAM::RecordPos(PGLOBAL g) ...@@ -683,6 +683,7 @@ bool DOSFAM::RecordPos(PGLOBAL g)
{ {
if ((Fpos = ftell(Stream)) < 0) { if ((Fpos = ftell(Stream)) < 0) {
sprintf(g->Message, MSG(FTELL_ERROR), 0, strerror(errno)); sprintf(g->Message, MSG(FTELL_ERROR), 0, strerror(errno));
strcat(g->Message, " (possible wrong ENDING option value)");
return true; return true;
} // endif Fpos } // endif Fpos
......
...@@ -101,7 +101,7 @@ PFIL MakeFilter(PGLOBAL g, PFIL fp1, OPVAL vop, PFIL fp2) ...@@ -101,7 +101,7 @@ PFIL MakeFilter(PGLOBAL g, PFIL fp1, OPVAL vop, PFIL fp2)
PFIL filp = new(g) FILTER(g, vop); PFIL filp = new(g) FILTER(g, vop);
filp->Arg(0) = fp1; filp->Arg(0) = fp1;
filp->Arg(1) = fp2; filp->Arg(1) = (fp2) ? fp2 : pXVOID;
if (filp->Convert(g, false)) if (filp->Convert(g, false))
return NULL; return NULL;
......
This diff is collapsed.
...@@ -53,12 +53,12 @@ typedef int HANDLE; ...@@ -53,12 +53,12 @@ typedef int HANDLE;
#ifdef PATH_MAX #ifdef PATH_MAX
#define _MAX_PATH PATH_MAX #define _MAX_PATH PATH_MAX
#else #else
#define _MAX_PATH 260 #define _MAX_PATH FN_REFLEN
#endif #endif
#define _MAX_DRIVE 3 #define _MAX_DRIVE 3
#define _MAX_DIR 256 #define _MAX_DIR FN_REFLEN
#define _MAX_FNAME 256 #define _MAX_FNAME FN_HEADLEN
#define _MAX_EXT 256 #define _MAX_EXT FN_EXTLEN
#define INVALID_HANDLE_VALUE (-1) #define INVALID_HANDLE_VALUE (-1)
#define __stdcall #define __stdcall
#endif /* !WIN32 */ #endif /* !WIN32 */
......
...@@ -87,9 +87,6 @@ bool Initdone = false; ...@@ -87,9 +87,6 @@ bool Initdone = false;
bool plugin = false; // True when called by the XDB plugin handler bool plugin = false; // True when called by the XDB plugin handler
extern "C" { extern "C" {
#if defined(XMSG)
char msglang[16] = "ENGLISH"; // Default language
#endif
extern char version[]; extern char version[];
} // extern "C" } // extern "C"
...@@ -136,10 +133,12 @@ global_open_error_msg(GLOBAL *g, int msgid, const char *path, const char *mode) ...@@ -136,10 +133,12 @@ global_open_error_msg(GLOBAL *g, int msgid, const char *path, const char *mode)
break; break;
case MSGID_OPEN_MODE_STRERROR: case MSGID_OPEN_MODE_STRERROR:
{char fmt[256];
strcat(strcpy(fmt, MSG(OPEN_MODE_ERROR)), ": %s");
len= snprintf(g->Message, sizeof(g->Message) - 1, 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)); mode, (int) errno, path, strerror(errno));
break; }break;
case MSGID_OPEN_STRERROR: case MSGID_OPEN_STRERROR:
len= snprintf(g->Message, sizeof(g->Message) - 1, len= snprintf(g->Message, sizeof(g->Message) - 1,
......
...@@ -82,7 +82,8 @@ extern HINSTANCE s_hModule; /* Saved module handle */ ...@@ -82,7 +82,8 @@ extern HINSTANCE s_hModule; /* Saved module handle */
#endif // WIN32 #endif // WIN32
#if defined(XMSG) #if defined(XMSG)
extern char msglang[]; extern char *msg_path;
char *msglang(void);
#endif // XMSG #endif // XMSG
/***********************************************************************/ /***********************************************************************/
...@@ -326,8 +327,9 @@ char *PlugReadMessage(PGLOBAL g, int mid, char *m) ...@@ -326,8 +327,9 @@ char *PlugReadMessage(PGLOBAL g, int mid, char *m)
char *msg; char *msg;
FILE *mfile = NULL; FILE *mfile = NULL;
GetPrivateProfileString("Message", msglang, "Message\\english.msg", //GetPrivateProfileString("Message", msglang, "Message\\english.msg",
msgfile, _MAX_PATH, plgini); // msgfile, _MAX_PATH, plgini);
strcat(strcat(strcpy(msgfile, msg_path), msglang()), ".msg");
if (!(mfile = fopen(msgfile, "rt"))) { if (!(mfile = fopen(msgfile, "rt"))) {
sprintf(stmsg, "Fail to open message file %s for %s", msgfile, msglang); sprintf(stmsg, "Fail to open message file %s for %s", msgfile, msglang);
......
...@@ -21,7 +21,7 @@ char *GetMsgid(int id) ...@@ -21,7 +21,7 @@ char *GetMsgid(int id)
char *p = NULL; char *p = NULL;
switch (id) { switch (id) {
case IDS_00: p = "%s"; break; // case IDS_00: p = "%s"; break;
#if defined(FRENCH) #if defined(FRENCH)
case IDS_01: p = "%s: erreur d'allocation du buffer de communication de %d octets"; break; 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_02: p = "%s: erreur d'allocation mmoire tampon pour %d colonnes"; break;
...@@ -115,6 +115,7 @@ char *GetMsgid(int id) ...@@ -115,6 +115,7 @@ char *GetMsgid(int id)
case IDS_DSC_01: p = "Nom"; break; case IDS_DSC_01: p = "Nom"; break;
case IDS_DSC_02: p = "Description"; break; case IDS_DSC_02: p = "Description"; break;
#else // English #else // English
#if 0
case IDS_01: p = "%s: error allocating communication buffer of %d bytes"; break; 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_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;
...@@ -130,6 +131,7 @@ char *GetMsgid(int id) ...@@ -130,6 +131,7 @@ char *GetMsgid(int id)
case IDS_13: p = "%s: invalid connection key value %d"; break; case IDS_13: p = "%s: invalid connection key value %d"; break;
case IDS_14: p = "SafeDB: %s rc=%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_01: p = "Table_Cat"; break;
case IDS_TAB_02: p = "Table_Schema"; break; case IDS_TAB_02: p = "Table_Schema"; break;
case IDS_TAB_03: p = "Table_Name"; break; case IDS_TAB_03: p = "Table_Name"; break;
...@@ -147,6 +149,7 @@ char *GetMsgid(int id) ...@@ -147,6 +149,7 @@ char *GetMsgid(int id)
case IDS_COL_10: p = "Radix"; break; case IDS_COL_10: p = "Radix"; break;
case IDS_COL_11: p = "Nullable"; break; case IDS_COL_11: p = "Nullable"; break;
case IDS_COL_12: p = "Remarks"; break; case IDS_COL_12: p = "Remarks"; break;
#if 0
case IDS_INF_01: p = "Type_Name"; break; case IDS_INF_01: p = "Type_Name"; break;
case IDS_INF_02: p = "Data_Type"; break; case IDS_INF_02: p = "Data_Type"; break;
case IDS_INF_03: p = "Precision"; break; case IDS_INF_03: p = "Precision"; break;
...@@ -162,12 +165,14 @@ char *GetMsgid(int id) ...@@ -162,12 +165,14 @@ char *GetMsgid(int id)
case IDS_INF_13: p = "Local_Type_Name"; break; case IDS_INF_13: p = "Local_Type_Name"; break;
case IDS_INF_14: p = "Minimum_Scale"; break; case IDS_INF_14: p = "Minimum_Scale"; break;
case IDS_INF_15: p = "Maximum_Scale"; break; case IDS_INF_15: p = "Maximum_Scale"; break;
#endif // 0
case IDS_PKY_01: p = "Table_Catalog"; break; case IDS_PKY_01: p = "Table_Catalog"; break;
case IDS_PKY_02: p = "Table_Schema"; break; case IDS_PKY_02: p = "Table_Schema"; break;
case IDS_PKY_03: p = "Table_Name"; break; case IDS_PKY_03: p = "Table_Name"; break;
case IDS_PKY_04: p = "Column_Name"; break; case IDS_PKY_04: p = "Column_Name"; break;
case IDS_PKY_05: p = "Key_Seq"; break; case IDS_PKY_05: p = "Key_Seq"; break;
case IDS_PKY_06: p = "Pk_Name"; break; case IDS_PKY_06: p = "Pk_Name"; break;
#if 0
case IDS_FKY_01: p = "PKTable_Catalog"; break; case IDS_FKY_01: p = "PKTable_Catalog"; break;
case IDS_FKY_02: p = "PKTable_Schema"; break; case IDS_FKY_02: p = "PKTable_Schema"; break;
case IDS_FKY_03: p = "PKTable_Name"; break; case IDS_FKY_03: p = "PKTable_Name"; break;
...@@ -181,6 +186,7 @@ char *GetMsgid(int id) ...@@ -181,6 +186,7 @@ char *GetMsgid(int id)
case IDS_FKY_11: p = "Delete_Rule"; break; case IDS_FKY_11: p = "Delete_Rule"; break;
case IDS_FKY_12: p = "FK_Name"; break; case IDS_FKY_12: p = "FK_Name"; break;
case IDS_FKY_13: p = "PK_Name"; break; case IDS_FKY_13: p = "PK_Name"; break;
#endif // 0
case IDS_STA_01: p = "Table_Catalog"; break; case IDS_STA_01: p = "Table_Catalog"; break;
case IDS_STA_02: p = "Table_Schema"; break; case IDS_STA_02: p = "Table_Schema"; break;
case IDS_STA_03: p = "Table_Name"; break; case IDS_STA_03: p = "Table_Name"; break;
...@@ -194,6 +200,7 @@ char *GetMsgid(int id) ...@@ -194,6 +200,7 @@ char *GetMsgid(int id)
case IDS_STA_11: p = "Cardinality"; break; case IDS_STA_11: p = "Cardinality"; break;
case IDS_STA_12: p = "Pages"; break; case IDS_STA_12: p = "Pages"; break;
case IDS_STA_13: p = "Filter_Condition"; break; case IDS_STA_13: p = "Filter_Condition"; break;
#if 0
case IDS_SPC_01: p = "Scope"; break; case IDS_SPC_01: p = "Scope"; break;
case IDS_SPC_02: p = "Column_Name"; break; case IDS_SPC_02: p = "Column_Name"; break;
case IDS_SPC_03: p = "Data_Type"; break; case IDS_SPC_03: p = "Data_Type"; break;
...@@ -202,6 +209,7 @@ char *GetMsgid(int id) ...@@ -202,6 +209,7 @@ char *GetMsgid(int id)
case IDS_SPC_06: p = "Length"; break; case IDS_SPC_06: p = "Length"; break;
case IDS_SPC_07: p = "Scale"; break; case IDS_SPC_07: p = "Scale"; break;
case IDS_SPC_08: p = "Pseudo_Column"; break; case IDS_SPC_08: p = "Pseudo_Column"; break;
#endif // 0
case IDS_DRV_01: p = "Description"; break; case IDS_DRV_01: p = "Description"; break;
case IDS_DRV_02: p = "Attributes"; break; case IDS_DRV_02: p = "Attributes"; break;
case IDS_DSC_01: p = "Name"; break; case IDS_DSC_01: p = "Name"; break;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Microsoft Developer Studio generated include file. // Microsoft Developer Studio generated include file.
// Used by PlgSock.rc // Used by PlgSock.rc
// //
#if 0
#define IDS_00 115 #define IDS_00 115
#define IDS_01 116 #define IDS_01 116
#define IDS_02 117 #define IDS_02 117
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
#define IDS_19 134 #define IDS_19 134
#define IDS_20 135 #define IDS_20 135
#define IDS_21 136 #define IDS_21 136
#endif // 0
#define IDS_TABLES 143 #define IDS_TABLES 143
#define IDS_TAB_01 144 #define IDS_TAB_01 144
#define IDS_TAB_02 145 #define IDS_TAB_02 145
...@@ -43,6 +45,7 @@ ...@@ -43,6 +45,7 @@
#define IDS_COL_10 169 #define IDS_COL_10 169
#define IDS_COL_11 170 #define IDS_COL_11 170
#define IDS_COL_12 171 #define IDS_COL_12 171
#if 0
#define IDS_INFO 175 #define IDS_INFO 175
#define IDS_INF_01 176 #define IDS_INF_01 176
#define IDS_INF_02 177 #define IDS_INF_02 177
...@@ -59,6 +62,7 @@ ...@@ -59,6 +62,7 @@
#define IDS_INF_13 188 #define IDS_INF_13 188
#define IDS_INF_14 189 #define IDS_INF_14 189
#define IDS_INF_15 190 #define IDS_INF_15 190
#endif // 0
#define IDS_PKEY 191 #define IDS_PKEY 191
#define IDS_PKY_01 192 #define IDS_PKY_01 192
#define IDS_PKY_02 193 #define IDS_PKY_02 193
...@@ -66,6 +70,7 @@ ...@@ -66,6 +70,7 @@
#define IDS_PKY_04 195 #define IDS_PKY_04 195
#define IDS_PKY_05 196 #define IDS_PKY_05 196
#define IDS_PKY_06 197 #define IDS_PKY_06 197
#if 0
#define IDS_FKEY 207 #define IDS_FKEY 207
#define IDS_FKY_01 208 #define IDS_FKY_01 208
#define IDS_FKY_02 209 #define IDS_FKY_02 209
...@@ -80,6 +85,7 @@ ...@@ -80,6 +85,7 @@
#define IDS_FKY_11 218 #define IDS_FKY_11 218
#define IDS_FKY_12 219 #define IDS_FKY_12 219
#define IDS_FKY_13 220 #define IDS_FKY_13 220
#endif // 0
#define IDS_STAT 223 #define IDS_STAT 223
#define IDS_STA_01 224 #define IDS_STA_01 224
#define IDS_STA_02 225 #define IDS_STA_02 225
...@@ -94,6 +100,7 @@ ...@@ -94,6 +100,7 @@
#define IDS_STA_11 234 #define IDS_STA_11 234
#define IDS_STA_12 235 #define IDS_STA_12 235
#define IDS_STA_13 236 #define IDS_STA_13 236
#if 0
#define IDS_SPCOLS 1247 #define IDS_SPCOLS 1247
#define IDS_SPC_01 1248 #define IDS_SPC_01 1248
#define IDS_SPC_02 1249 #define IDS_SPC_02 1249
...@@ -118,6 +125,7 @@ ...@@ -118,6 +125,7 @@
#define IDS_PLG_07 1286 #define IDS_PLG_07 1286
#define IDS_PLG_08 1287 #define IDS_PLG_08 1287
#define IDS_PLG_09 1288 #define IDS_PLG_09 1288
#endif // 0
#define IDS_DRIVER 1290 #define IDS_DRIVER 1290
#define IDS_DRV_01 1291 #define IDS_DRV_01 1291
#define IDS_DRV_02 1292 #define IDS_DRV_02 1292
......
...@@ -197,7 +197,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g) ...@@ -197,7 +197,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
#else // !WIN32 #else // !WIN32
struct stat fileinfo; 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; DIR *dir;
struct dirent *entry; struct dirent *entry;
......
...@@ -272,7 +272,7 @@ bool STRING::Set(char *s, uint n) ...@@ -272,7 +272,7 @@ bool STRING::Set(char *s, uint n)
if (!s) if (!s)
return false; return false;
uint len = MY_MIN(strlen(s), n) + 1; uint len = strnlen(s, n) + 1;
if (len > Size) { if (len > Size) {
char *p = Realloc(len); 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