diff options
author | Andi Gutmans <andi@php.net> | 2000-08-22 17:59:35 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2000-08-22 17:59:35 +0000 |
commit | 0222b7ab416d845abcd3925b3da47fa2d7ed238d (patch) | |
tree | 38cbb73fda38196612fddffda4d803003a86b568 /ext/mysql | |
parent | 60676f19a5f5425c4375d8ba60e8bd07016ba562 (diff) | |
download | php-git-0222b7ab416d845abcd3925b3da47fa2d7ed238d.tar.gz |
- Try and revert libmysql for 4.0.2
Diffstat (limited to 'ext/mysql')
86 files changed, 808 insertions, 3244 deletions
diff --git a/ext/mysql/libmysql/Makefile.in b/ext/mysql/libmysql/Makefile.in index 973e901d79..aaf98db2bc 100644 --- a/ext/mysql/libmysql/Makefile.in +++ b/ext/mysql/libmysql/Makefile.in @@ -9,11 +9,8 @@ LTLIBRARY_SOURCES = libmysql.c errmsg.c net.c violite.c password.c \ my_pthread.c my_thr_init.c thr_mutex.c mulalloc.c string.c default.c \ my_compress.c array.c my_once.c list.c my_net.c dbug.c \ strmov.c strxmov.c strnmov.c strmake.c strend.c strfill.c \ - is_prefix.c int2str.c str2int.c strinstr.c \ + ct_init.c is_prefix.c int2str.c str2int.c strinstr.c \ strcont.c strcend.c bchange.c bmove.c bmove_upp.c \ - longlong2str.c strtoull.c strtoll.c \ - ct_init.c ctype-latin1.c charset.c ctype-big5.c ctype-czech.c \ - ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c \ - ctype-ujis.c ctype.c ctype_autoconf.c ctype_extra_sources.c + longlong2str.c strtoull.c strtoll.c ctype-latin1.c include $(top_srcdir)/build/dynlib.mk diff --git a/ext/mysql/libmysql/array.c b/ext/mysql/libmysql/array.c index 17e5ded322..f8ba10c253 100644 --- a/ext/mysql/libmysql/array.c +++ b/ext/mysql/libmysql/array.c @@ -1,23 +1,9 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Handling of arrays that can grow dynamicly. */ -#if defined(WIN32) || defined(__WIN__) +#if defined(WIN32) || defined(__WIN32__) #undef SAFEMALLOC /* Problems with threads */ #endif diff --git a/ext/mysql/libmysql/bchange.c b/ext/mysql/libmysql/bchange.c index 99066cf1e9..6cd4c41457 100644 --- a/ext/mysql/libmysql/bchange.c +++ b/ext/mysql/libmysql/bchange.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* File : bchange.c Author : Michael widenius diff --git a/ext/mysql/libmysql/bmove_upp.c b/ext/mysql/libmysql/bmove_upp.c index af6575ebf4..435abfb6d6 100644 --- a/ext/mysql/libmysql/bmove_upp.c +++ b/ext/mysql/libmysql/bmove_upp.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* File : bmove.c Author : Michael widenius diff --git a/ext/mysql/libmysql/dbug.c b/ext/mysql/libmysql/dbug.c index c004de587f..8eb5fea5eb 100644 --- a/ext/mysql/libmysql/dbug.c +++ b/ext/mysql/libmysql/dbug.c @@ -72,7 +72,7 @@ #include <global.h> #include <m_string.h> #include <errno.h> -#if defined(MSDOS) || defined(__WIN__) +#if defined(MSDOS) || defined(__WIN32__) #include <process.h> #endif @@ -123,7 +123,7 @@ * Typedefs to make things more obvious. */ -#ifndef __WIN__ +#ifndef __WIN32__ typedef int BOOLEAN; #else #define BOOLEAN BOOL @@ -310,13 +310,11 @@ static char *static_strtok(char *s1,pchar chr); #if !defined(HAVE_ACCESS) || defined(MSDOS) #define EXISTS(pathname) (FALSE) /* Assume no existance */ #define Writable(name) (TRUE) +#define ChangeOwner(name) #else #define EXISTS(pathname) (access (pathname, F_OK) == 0) #define WRITABLE(pathname) (access (pathname, W_OK) == 0) #endif -#ifndef MSDOS -#define ChangeOwner(name) -#endif /* * Translate some calls among different systems. @@ -1057,20 +1055,20 @@ struct link *linkp; const char *cp; { REGISTER struct link *scan; - REGISTER BOOLEAN result; + REGISTER BOOLEAN accept; if (linkp == NULL) { - result = TRUE; + accept = TRUE; } else { - result = FALSE; + accept = FALSE; for (scan = linkp; scan != NULL; scan = scan -> next_link) { if (STREQ (scan -> str, cp)) { - result = TRUE; + accept = TRUE; break; } } } - return (result); + return (accept); } @@ -1219,20 +1217,20 @@ static BOOLEAN DoProfile () BOOLEAN _db_keyword_ (keyword) const char *keyword; { - REGISTER BOOLEAN result; + REGISTER BOOLEAN accept; CODE_STATE *state; if (!init_done) _db_push_ (""); state=code_state(); - result = FALSE; + accept = FALSE; if (DEBUGGING && state->level <= stack -> maxdepth && InList (stack -> functions, state->func) && InList (stack -> keywords, keyword) && InList (stack -> processes, _db_process_)) - result = TRUE; - return (result); + accept = TRUE; + return (accept); } /* @@ -1923,7 +1921,7 @@ static void dbug_flush(CODE_STATE *state) if (stack->flags & FLUSH_ON_WRITE) #endif { -#if defined(MSDOS) || defined(__WIN__) +#if defined(MSDOS) || defined(__WIN32__) if (_db_fp_ != stdout && _db_fp_ != stderr) { if (!(freopen(stack->name,"a",_db_fp_))) @@ -1990,7 +1988,7 @@ static unsigned long Clock () } #else -#if defined(MSDOS) || defined(__WIN__) +#if defined(MSDOS) || defined(__WIN32__) static ulong Clock() { @@ -2040,7 +2038,7 @@ static unsigned long Clock () } #endif #endif /* amiga */ -#endif /* MSDOS || __WIN__ */ +#endif /* MSDOS || __WIN32__ */ #endif /* RUSAGE */ diff --git a/ext/mysql/libmysql/dbug.h b/ext/mysql/libmysql/dbug.h index de6bbc66ed..3331f9032d 100644 --- a/ext/mysql/libmysql/dbug.h +++ b/ext/mysql/libmysql/dbug.h @@ -1,20 +1,3 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - #ifndef _dbug_h #define _dbug_h #ifdef __cplusplus diff --git a/ext/mysql/libmysql/default.c b/ext/mysql/libmysql/default.c index ae4ba5044b..b1e33f3e59 100644 --- a/ext/mysql/libmysql/default.c +++ b/ext/mysql/libmysql/default.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1998 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /**************************************************************************** ** Add all options from files named "group".cnf from the default_directories @@ -42,7 +28,7 @@ /* Which directories are searched for options (and in which order) */ const char *default_directories[]= { -#ifdef __WIN__ +#ifdef __WIN32__ "C:/", #else "/etc/", @@ -50,14 +36,14 @@ const char *default_directories[]= { #ifdef DATADIR DATADIR, #endif -#ifndef __WIN__ +#ifndef __WIN32__ "~/", #endif NullS, }; #define default_ext ".cnf" /* extension for config file */ -#ifdef __WIN__ +#ifdef __WIN32__ #include <winbase.h> #define windows_ext ".ini" #endif @@ -73,7 +59,7 @@ void load_defaults(const char *conf_file, const char **groups, DYNAMIC_ARRAY args; const char **dirs, *extra_default_file; TYPELIB group; - my_bool found_print_defaults=0; + my_bool print_defaults=0; MEM_ROOT alloc; char *ptr,**res; DBUG_ENTER("load_defaults"); @@ -92,7 +78,7 @@ void load_defaults(const char *conf_file, const char **groups, res[i-1]=argv[0][i]; (*argc)--; *argv=res; - *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ + memcpy(ptr,&alloc,sizeof(alloc)); /* Save alloc root for free */ DBUG_VOID_RETURN; } @@ -102,8 +88,8 @@ void load_defaults(const char *conf_file, const char **groups, extra_default_file=strchr(argv[0][1],'=')+1; group.count=0; - group.name= "defaults"; - group.type_names= groups; + group.name= (char*) "defaults"; + group.type_names=(char**) groups; for (; *groups ; groups++) group.count++; @@ -123,7 +109,7 @@ void load_defaults(const char *conf_file, const char **groups, } else { -#ifdef __WIN__ +#ifdef __WIN32__ char system_dir[FN_REFLEN]; GetWindowsDirectory(system_dir,sizeof(system_dir)); if (search_default_file(&args, &alloc, system_dir, conf_file, windows_ext, @@ -154,7 +140,7 @@ void load_defaults(const char *conf_file, const char **groups, /* Check if we wan't to see the new argument list */ if (*argc >= 2 && !strcmp(argv[0][1],"--print-defaults")) { - found_print_defaults=1; + print_defaults=1; --*argc; ++*argv; /* skipp argument */ } @@ -164,9 +150,9 @@ void load_defaults(const char *conf_file, const char **groups, (*argc)+=args.elements; *argv= (char**) res; - *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ + memcpy(ptr,&alloc,sizeof(alloc)); /* Save alloc root for free */ delete_dynamic(&args); - if (found_print_defaults) + if (print_defaults) { int i; printf("%s would have been started with the following arguments:\n", @@ -187,7 +173,7 @@ void load_defaults(const char *conf_file, const char **groups, void free_defaults(char **argv) { MEM_ROOT ptr; - memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr)); + memcpy((char*) &ptr,(char *) argv - sizeof(ptr),sizeof(ptr)); free_root(&ptr); } @@ -322,9 +308,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, void print_defaults(const char *conf_file, const char **groups) { -#ifdef __WIN__ bool have_ext=fn_ext(conf_file)[0] != 0; -#endif char name[FN_REFLEN]; const char **dirs; puts("\nDefault options are read from the following files in the given order:"); @@ -333,7 +317,7 @@ void print_defaults(const char *conf_file, const char **groups) fputs(conf_file,stdout); else { -#ifdef __WIN__ +#ifdef __WIN32__ GetWindowsDirectory(name,sizeof(name)); printf("%s\\%s%s ",name,conf_file,have_ext ? "" : windows_ext); #endif @@ -358,5 +342,4 @@ void print_defaults(const char *conf_file, const char **groups) --print-defaults Print the program argument list and exit\n\ --no-defaults Don't read default options from any options file\n\ --defaults-file=# Only read default options from the given file #"); -} - +}; diff --git a/ext/mysql/libmysql/dll.c b/ext/mysql/libmysql/dll.c index 4c952c5889..a3116b33ad 100644 --- a/ext/mysql/libmysql/dll.c +++ b/ext/mysql/libmysql/dll.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1999 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* ** Handling initialization of the dll library @@ -43,7 +29,7 @@ void libmysql_init(void) } } -#ifdef __WIN__ +#ifdef WIN32 static int inited=0,threads=0; HINSTANCE NEAR s_hModule; /* Saved module handle */ diff --git a/ext/mysql/libmysql/errmsg.c b/ext/mysql/libmysql/errmsg.c index 194542afd7..96f1f41554 100644 --- a/ext/mysql/libmysql/errmsg.c +++ b/ext/mysql/libmysql/errmsg.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Error messages for MySQL clients */ /* error messages for the demon is in share/language/errmsg.sys */ @@ -43,9 +29,7 @@ const char *client_errors[]= "Verbindung ueber Named Pipe; Host: %-.64s", "Kann nicht auf Named Pipe warten. Host: %-.64s pipe: %-.32s (%lu)", "Kann Named Pipe nicht oeffnen. Host: %-.64s pipe: %-.32s (%lu)", - "Kann den Status der Named Pipe nicht setzen. Host: %-.64s pipe: %-.32s (%lu)", - "Can't initialize character set %-.64s (path: %-.64s)", - "Got packet bigger than 'max_allowed_packet'" + "Kann den Status der Named Pipe nicht setzen. Host: %-.64s pipe: %-.32s (%lu)" }; #else /* ENGLISH */ @@ -70,8 +54,6 @@ const char *client_errors[]= "Can't wait for named pipe to host: %-.64s pipe: %-.32s (%lu)", "Can't open named pipe to host: %-.64s pipe: %-.32s (%lu)", "Can't set state of named pipe to host: %-.64s pipe: %-.32s (%lu)", - "Can't initialize character set %-.64s (path: %-.64s)", - "Got packet bigger than 'max_allowed_packet'" }; #endif diff --git a/ext/mysql/libmysql/errmsg.h b/ext/mysql/libmysql/errmsg.h index b7afe11b61..d88653929b 100644 --- a/ext/mysql/libmysql/errmsg.h +++ b/ext/mysql/libmysql/errmsg.h @@ -1,31 +1,11 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Error messages for mysql clients */ /* error messages for the demon is in share/language/errmsg.sys */ -#ifdef __cplusplus -extern "C" { -#endif void init_client_errs(void); extern const char *client_errors[]; /* Error messages */ -#ifdef __cplusplus -} -#endif #define CR_MIN_ERROR 2000 /* For easier client code */ #define CR_MAX_ERROR 2999 @@ -51,5 +31,3 @@ extern const char *client_errors[]; /* Error messages */ #define CR_NAMEDPIPEWAIT_ERROR 2016 #define CR_NAMEDPIPEOPEN_ERROR 2017 #define CR_NAMEDPIPESETSTATE_ERROR 2018 -#define CR_CANT_READ_CHARSET 2019 -#define CR_NET_PACKET_TOO_LARGE 2020 diff --git a/ext/mysql/libmysql/errors.c b/ext/mysql/libmysql/errors.c index 03b0b9d7f4..358d092844 100644 --- a/ext/mysql/libmysql/errors.c +++ b/ext/mysql/libmysql/errors.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" #include "mysys_err.h" @@ -44,7 +30,6 @@ const char * NEAR globerrs[GLOBERRS]= "%d files and %d streams is left open\n", "Disk is full writing '%s'. Waiting for someone to free space...", "Can't create directory '%s' (Errcode: %d)", - "Character set '%s' is not a compiled character set and is not specified in the '%s' file" }; void init_glob_errs(void) @@ -79,6 +64,5 @@ void init_glob_errs() EE(EE_OPEN_WARNING) = "%d files and %d streams is left open\n"; EE(EE_DISK_FULL) = "Disk is full writing '%s'. Waiting for someone to free space..."; EE(EE_CANT_MKDIR) ="Can't create directory '%s' (Errcode: %d)"; - EE(EE_UNKNOWN_CHARSET)= "Character set is not a compiled character set and is not specified in the %s file"; } #endif diff --git a/ext/mysql/libmysql/get_password.c b/ext/mysql/libmysql/get_password.c index d61c40a955..e0a460c3a3 100644 --- a/ext/mysql/libmysql/get_password.c +++ b/ext/mysql/libmysql/get_password.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* ** Ask for a password from tty @@ -35,7 +21,7 @@ #include <pwd.h> #endif /* HAVE_PWD_H */ #else /* ! HAVE_GETPASS */ -#ifndef __WIN__ +#ifndef __WIN32__ #include <sys/ioctl.h> #ifdef HAVE_TERMIOS_H /* For tty-password */ #include <termios.h> @@ -55,14 +41,14 @@ #endif #else #include <conio.h> -#endif /* __WIN__ */ +#endif /* __WIN32__ */ #endif /* HAVE_GETPASS */ #ifdef HAVE_GETPASSPHRASE /* For Solaris */ #define getpass(A) getpassphrase(A) #endif -#ifdef __WIN__ +#ifdef __WIN32__ /* were just going to fake it here and get input from the keyboard */ @@ -102,54 +88,7 @@ char *get_tty_password(char *opt_message) #else - -#ifndef HAVE_GETPASS -/* -** Can't use fgets, because readline will get confused -** length is max number of chars in to, not counting \0 -* to will not include the eol characters. -*/ - -static void get_password(char *to,uint length,int fd,bool echo) -{ - char *pos=to,*end=to+length; - - for (;;) - { - char tmp; - if (my_read(fd,&tmp,1,MYF(0)) != 1) - break; - if (tmp == '\b' || (int) tmp == 127) - { - if (pos != to) - { - if (echo) - { - fputs("\b \b",stdout); - fflush(stdout); - } - pos--; - continue; - } - } - if (tmp == '\n' || tmp == '\r' || tmp == 3) - break; - if (iscntrl(tmp) || pos == end) - continue; - if (echo) - { - fputc('*',stdout); - fflush(stdout); - } - *(pos++) = tmp; - } - while (pos != to && isspace(pos[-1]) == ' ') - pos--; /* Allow dummy space at end */ - *pos=0; - return; -} -#endif /* ! HAVE_GETPASS */ - +static void get_password(char *to,uint length,int file_no,bool echo); char *get_tty_password(char *opt_message) { @@ -209,4 +148,52 @@ char *get_tty_password(char *opt_message) DBUG_RETURN(my_strdup(buff,MYF(MY_FAE))); } -#endif /*__WIN__*/ + +#ifndef HAVE_GETPASS +/* +** Can't use fgets, because readline will get confused +** length is max number of chars in to, not counting \0 +* to will not include the eol characters. +*/ + +void get_password(char *to,uint length,int fd,bool echo) +{ + char *pos=to,*end=to+length; + + for (;;) + { + char tmp; + if (my_read(fd,&tmp,1,MYF(0)) != 1) + break; + if (tmp == '\b' || (int) tmp == 127) + { + if (pos != to) + { + if (echo) + { + fputs("\b \b",stdout); + fflush(stdout); + } + pos--; + continue; + } + } + if (tmp == '\n' || tmp == '\r' || tmp == 3) + break; + if (iscntrl(tmp) || pos == end) + continue; + if (echo) + { + fputc('*',stdout); + fflush(stdout); + } + *(pos++) = tmp; + } + while (pos != to && isspace(pos[-1]) == ' ') + pos--; /* Allow dummy space at end */ + *pos=0; + return; +} +#endif /* ! HAVE_GETPASS */ + +#endif /*__WIN32__*/ diff --git a/ext/mysql/libmysql/global.h b/ext/mysql/libmysql/global.h index 9cffcbf477..34b45c2418 100644 --- a/ext/mysql/libmysql/global.h +++ b/ext/mysql/libmysql/global.h @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* This is the main include file that should included 'first' in every C file. */ @@ -21,19 +7,17 @@ #ifndef _global_h #define _global_h -#if defined(_WIN32) || defined(_WIN64) -#include <config-win.h> +#if defined(__WIN32__) || defined(WIN32) +#include <config-win32.h> #else #include <my_config.h> #endif -#if defined(__cplusplus) -#if defined(inline) -#undef inline /* fix configure problem */ +#if defined(__cplusplus) && defined(inline) +#undef inline /* fix configure problem */ #endif -#endif /* _cplusplus */ /* The client defines this to avoid all thread code */ -#if defined(UNDEF_THREADS_HACK) +#if defined(UNDEF_THREADS_HACK) && !defined(THREAD_SAFE_CLIENT) #undef THREAD #undef HAVE_mit_thread #undef HAVE_LINUXTHREADS @@ -49,11 +33,9 @@ #ifndef __STDC_EXT__ #define __STDC_EXT__ 1 /* To get large file support on hpux */ #endif -#if defined(THREAD) && defined(HAVE_LINUXTHREADS) && defined(HAVE_PTHREAD_RWLOCK_RDLOCK) -#define _GNU_SOURCE 1 -#endif +/* #define _GNU_SOURCE 1 */ /* Get define for strtok_r on Alpha-linux */ -#if defined(THREAD) && !defined(__WIN__) +#if defined(THREAD) && !defined(__WIN32__) #define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ /* was #if defined(HAVE_LINUXTHREADS) || defined(HAVE_DEC_THREADS) || defined(HPUX) */ #if !defined(SCO) @@ -89,36 +71,12 @@ #undef HAVE_PWRITE #endif -#ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */ -#undef HAVE_GETHOSTBYNAME_R -#endif -#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */ -#undef HAVE_INITGROUPS -#endif - /* Fix a bug in gcc 2.8.0 on IRIX 6.2 */ #if SIZEOF_LONG == 4 && defined(__LONG_MAX__) #undef __LONG_MAX__ /* Is a longlong value in gcc 2.8.0 ??? */ #define __LONG_MAX__ 2147483647 #endif -/* egcs 1.1.2 has a problem with memcpy on Alpha */ -#if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) -#define BAD_MEMCPY -#endif - -/* In Linux-alpha we have atomic.h if we are using gcc */ -#if defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__alpha__) && (__GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95)) -#define HAVE_ATOMIC_ADD -#define HAVE_ATOMIC_SUB -#endif - -/* In Linux-ia64 including atomic.h will give us an error */ -#if defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__ia64__) -#undef HAVE_ATOMIC_ADD -#undef HAVE_ATOMIC_SUB -#endif - #if defined(_lint) && !defined(lint) #define lint #endif @@ -173,10 +131,6 @@ #ifdef HAVE_ALLOCA_H #include <alloca.h> #endif -#ifdef HAVE_ATOMIC_ADD -#define __SMP__ -#include <asm/atomic.h> -#endif /* Go around some bugs in different OS and compilers */ #if defined(_HPUX_SOURCE) && defined(HAVE_SYS_STREAM_H) @@ -213,7 +167,6 @@ #endif /* Define void to stop lint from generating "null effekt" comments */ -#ifndef DONT_DEFINE_VOID #ifdef _lint int __void__; #define VOID(X) (__void__ = (int) (X)) @@ -221,7 +174,6 @@ int __void__; #undef VOID #define VOID(X) (X) #endif -#endif /* DONT_DEFINE_VOID */ #if defined(_lint) || defined(FORCE_INIT_OF_VARS) #define LINT_INIT(var) var=0 /* No uninitialize-warning */ @@ -290,11 +242,6 @@ typedef unsigned short ushort; #endif #include <dbug.h> -#ifndef DBUG_OFF -#define dbug_assert(A) assert(A) -#else -#define dbug_assert(A) -#endif #define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/ #define ASCII_BITS_USED 8 /* Bit char used */ @@ -331,7 +278,7 @@ typedef int (*qsort_cmp)(const void *,const void *); #define qsort_t RETQSORTTYPE /* Broken GCC cant handle typedef !!!! */ #endif #ifdef HAVE_mit_thread -#define size_socket socklen_t /* Type of last arg to accept */ +typedef int size_socket; /* Type of last arg to accept */ #else #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> @@ -412,7 +359,7 @@ typedef SOCKET_SIZE_TYPE size_socket; #define NO_PISAM /* Not needed anymore */ #define NO_MISAM /* Not needed anymore */ #define NO_HASH /* Not needed anymore */ -#ifdef __WIN__ +#ifdef __WIN32__ #define NO_DIR_LIBRARY /* Not standar dir-library */ #define USE_MY_STAT_STRUCT /* For my_lib */ #endif @@ -434,7 +381,7 @@ extern void init_my_atof(void); extern double my_atof(const char*); #endif #undef remove /* Crashes MySQL on SCO 5.0.0 */ -#ifndef __WIN__ +#ifndef __WIN32__ #define closesocket(A) close(A) #ifndef ulonglong2double #define ulonglong2double(A) ((double) (A)) @@ -454,7 +401,7 @@ extern double my_atof(const char*); #ifdef HAVE_LINUXTHREADS /* #define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) */ -/* #define sigset(A,B) signal((A),(B)) */ +#define sigset(A,B) signal((A),(B)) #endif /* Remove some things that mit_thread break or doesn't support */ @@ -523,8 +470,6 @@ typedef long my_ptrdiff_t; #define NEAR /* Who needs segments ? */ #define FAR /* On a good machine */ #define HUGE_PTR -#endif -#ifndef STDCALL #define STDCALL #endif @@ -582,9 +527,7 @@ typedef long longlong; #endif #undef SIZEOF_OFF_T #define SIZEOF_OFF_T 8 -#else -#define SYSTEM_SIZEOF_OFF_T SIZEOF_OFF_T -#endif /* USE_RAID */ +#endif #if SIZEOF_OFF_T > 4 typedef ulonglong my_off_t; @@ -592,9 +535,7 @@ typedef ulonglong my_off_t; typedef unsigned long my_off_t; #endif #define MY_FILEPOS_ERROR (~(my_off_t) 0) -#ifndef __WIN__ -typedef off_t os_off_t; -#endif +/*typedef off_t os_off_t;*/ typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */ typedef short int15; /* Most effective integer 0 <= x <= 32767 */ @@ -782,8 +723,8 @@ typedef char bool; /* Ordinary boolean values 0 1 */ ((byte*) &def_temp)[7]=(M)[0];\ (V) = def_temp; } #else -#define float4get(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float)) -#define float4store(V,M) memcpy_fixed((byte*) V,(byte*) (&M),sizeof(float)) +#define float4get(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(float)) +#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float)) #define float8get(V,M) doubleget((V),(M)) #define float8store(V,M) doublestore((V),(M)) #endif /* WORDS_BIGENDIAN */ @@ -834,24 +775,12 @@ typedef char bool; /* Ordinary boolean values 0 1 */ #define shortstore(T,V) int2store(T,V) #define longstore(T,V) int4store(T,V) #ifndef doubleget -#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double)) -#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double)) +#define doubleget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(double)) +#define doublestore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(double)) #endif -#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong)) -#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong)) +#define longlongget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(ulonglong)) +#define longlongstore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(ulonglong)) #endif /* WORDS_BIGENDIAN */ -/* sprintf does not always return the number of bytes :- */ -#ifdef SPRINTF_RETURNS_INT -#define my_sprintf(buff,args) sprintf args -#else -#ifdef SPRINTF_RETURNS_PTR -#define my_sprintf(buff,args) ((int)(sprintf args - buff)) -#else -#define my_sprintf(buff,args) sprintf args,strlen(buff) -#endif -#endif - - #endif /* _global_h */ diff --git a/ext/mysql/libmysql/int2str.c b/ext/mysql/libmysql/int2str.c index 4003e8a616..9d6d435721 100644 --- a/ext/mysql/libmysql/int2str.c +++ b/ext/mysql/libmysql/int2str.c @@ -1,20 +1,3 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - /* Defines: int2str(), itoa(), ltoa() @@ -50,7 +33,6 @@ char *int2str(register long int val, register char *dst, register int radix) { char buffer[65]; register char *p; - long int new_val; if (radix < 0) { if (radix < -36 || radix > -2) return NullS; @@ -75,9 +57,8 @@ char *int2str(register long int val, register char *dst, register int radix) */ p = &buffer[sizeof(buffer)-1]; *p = '\0'; - new_val=(ulong) val / (ulong) radix; - *--p = _dig_vec[(uchar) ((ulong) val- (ulong) new_val*(ulong) radix)]; - val = new_val; + *--p = _dig_vec[(ulong) val % (ulong) radix]; + val = (ulong) val / (ulong) radix; #ifdef HAVE_LDIV while (val != 0) { @@ -89,53 +70,14 @@ char *int2str(register long int val, register char *dst, register int radix) #else while (val != 0) { - new_val=val/radix; - *--p = _dig_vec[(uchar) (val-new_val*radix)]; - val= new_val; + *--p = _dig_vec[val%radix]; + val /= radix; } #endif while ((*dst++ = *p++) != 0) ; return dst-1; } - -/* - This is a faster version of the above optimized for the normal case of - radix 10 / -10 -*/ - -char *int10_to_str(long int val,char *dst,int radix) -{ - char buffer[65]; - register char *p; - long int new_val; - - if (radix < 0) /* -10 */ - { - if (val < 0) - { - *dst++ = '-'; - val = -val; - } - } - - p = &buffer[sizeof(buffer)-1]; - *p = '\0'; - new_val= (long) ((unsigned long int) val / 10); - *--p = '0'+ (char) ((unsigned long int) val - (unsigned long) new_val * 10); - val = new_val; - - while (val != 0) - { - new_val=val/10; - *--p = '0' + (char) (val-new_val*10); - val= new_val; - } - while ((*dst++ = *p++) != 0) ; - return dst-1; -} - - #ifdef USE_MY_ITOA /* Change to less general itoa interface */ diff --git a/ext/mysql/libmysql/is_prefix.c b/ext/mysql/libmysql/is_prefix.c index d3f2b148de..09b3accf75 100644 --- a/ext/mysql/libmysql/is_prefix.c +++ b/ext/mysql/libmysql/is_prefix.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* File : is_prefix.c Author : Michael Widenius diff --git a/ext/mysql/libmysql/libmysql.c b/ext/mysql/libmysql/libmysql.c index b81af16167..888d0e22c9 100644 --- a/ext/mysql/libmysql/libmysql.c +++ b/ext/mysql/libmysql/libmysql.c @@ -1,22 +1,10 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ + +#define PROTOCOL_VERSION 10 #define DONT_USE_RAID -#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64) +#if defined(__WIN32__) || defined(WIN32) #include <winsock.h> #include <odbcinst.h> #endif @@ -32,11 +20,10 @@ #include <violite.h> #include <sys/stat.h> #include <signal.h> -#include <time.h> #ifdef HAVE_PWD_H #include <pwd.h> #endif -#if !defined(MSDOS) && !defined(__WIN__) +#if !defined(MSDOS) && !defined(__WIN32__) #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -51,7 +38,7 @@ #ifdef HAVE_SYS_UN_H # include <sys/un.h> #endif -#if defined(THREAD) && !defined(__WIN__) +#if defined(THREAD) && !defined(__WIN32__) #include <my_pthread.h> /* because of signal() */ #endif #ifndef INADDR_NONE @@ -59,16 +46,17 @@ #endif static my_bool mysql_client_init=0; +static MYSQL *current_mysql; uint mysql_port=0; my_string mysql_unix_port=0; -#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES | CLIENT_TRANSACTIONS) +#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES) -#if defined(MSDOS) || defined(__WIN__) +#if defined(MSDOS) || defined(__WIN32__) #define ERRNO WSAGetLastError() #define perror(A) #else -#include <errno.h> +#include <sys/errno.h> #define ERRNO errno #define SOCKET_ERROR -1 #define closesocket(A) close(A) @@ -80,21 +68,20 @@ static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields, static int read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths); static void end_server(MYSQL *mysql); +static void remember_connection(MYSQL *mysql); static void read_user_name(char *name); static void append_wild(char *to,char *end,const char *wild); static my_bool mysql_reconnect(MYSQL *mysql); static int send_file_to_server(MYSQL *mysql,const char *filename); static sig_handler pipe_sig_handler(int sig); -static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, - const char *from, ulong length); /* Let the user specify that we don't want SIGPIPE; This doesn't however work with threaded applications as we can have multiple read in progress. */ -#if !defined(__WIN__) && defined(SIGPIPE) && !defined(THREAD) -#define init_sigpipe_variables sig_return old_signal_handler=(sig_return) 0; +#if !defined(__WIN32__) && defined(SIGPIPE) && !defined(THREAD) +#define init_sigpipe_variables sig_return old_signal_handler; #define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE,pipe_sig_handler) #define reset_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) signal(SIGPIPE,old_signal_handler); #else @@ -114,14 +101,13 @@ static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, static int connect2(File s, const struct sockaddr *name, uint namelen, uint to) { -#if defined(__WIN__) +#if defined(__WIN32__) return connect(s, (struct sockaddr*) name, namelen); #else int flags, res, s_err; size_socket s_err_size = sizeof(uint); fd_set sfds; struct timeval tv; - time_t start_time, now_time; /* If they passed us a timeout of zero, we should behave * exactly like the normal connect() call does. @@ -164,25 +150,11 @@ static int connect2(File s, const struct sockaddr *name, uint namelen, uint to) FD_ZERO(&sfds); FD_SET(s, &sfds); - /* - * select could be interrupted by a signal, and if it is, - * the timeout should be adjusted and the select restarted - * to work around OSes that don't restart select and - * implementations of select that don't adjust tv upon - * failure to reflect the time remaining - */ - start_time = time(NULL); - for (;;) - { - tv.tv_sec = (long) to; - tv.tv_usec = 0; - if ((res = select(s+1, NULL, &sfds, NULL, &tv)) >= 0) - break; - now_time=time(NULL); - to-= (uint) (now_time - start_time); - if (errno != EINTR || (int) to <= 0) - return -1; - } + tv.tv_sec = (long) to; + tv.tv_usec = 0; + res = select(s+1, NULL, &sfds, NULL, &tv); + if (res <= 0) /* Never became writable */ + return(-1); /* select() returned something more interesting than zero, let's * see if we have any errors. If the next two statements pass, @@ -206,7 +178,7 @@ static int connect2(File s, const struct sockaddr *name, uint namelen, uint to) ** Create a named pipe connection */ -#ifdef __WIN__ +#ifdef __WIN32__ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host, char **arg_unix_socket) @@ -298,9 +270,7 @@ net_safe_read(MYSQL *mysql) DBUG_PRINT("error",("Wrong connection or packet. fd: %s len: %d", vio_description(net->vio),len)); end_server(mysql); - net->last_errno=(net->last_errno == ER_NET_PACKET_TOO_LARGE ? - CR_NET_PACKET_TOO_LARGE: - CR_SERVER_LOST); + net->last_errno=CR_SERVER_LOST; strmov(net->last_error,ER(net->last_errno)); return(packet_error); } @@ -439,21 +409,23 @@ simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, mysql->net.last_errno=0; mysql->info=0; mysql->affected_rows= ~(my_ulonglong) 0; + remember_connection(mysql); net_clear(net); /* Clear receive buffer */ if (!arg) arg=""; if (net_write_command(net,(uchar) command,arg, - length ? length : (ulong) strlen(arg))) + length ? length :strlen(arg))) { DBUG_PRINT("error",("Can't send command to server. Error: %d",errno)); end_server(mysql); if (mysql_reconnect(mysql) || net_write_command(net,(uchar) command,arg, - length ? length : (ulong) strlen(arg))) + length ? length :strlen(arg))) { net->last_errno=CR_SERVER_GONE_ERROR; strmov(net->last_error,ER(net->last_errno)); + reset_sigpipe(mysql); goto end; } } @@ -483,7 +455,7 @@ struct passwd *getpwuid(uid_t); char* getlogin(void); #endif -#if !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) +#if !defined(MSDOS) && ! defined(VMS) && !defined(__WIN32__) static void read_user_name(char *name) { DBUG_ENTER("read_user_name"); @@ -530,7 +502,7 @@ static void read_user_name(char *name) #endif -#ifdef __WIN__ +#ifdef __WIN32__ static my_bool is_NT(void) { char *os=getenv("OS"); @@ -602,6 +574,17 @@ mysql_debug(const char *debug) /************************************************************************** +** Store the server socket currently in use +** Used by pipe_handler if error on socket interrupt +**************************************************************************/ + +static void +remember_connection(MYSQL *mysql) +{ + current_mysql = mysql; +} + +/************************************************************************** ** Close the server connection if we get a SIGPIPE ARGSUSED **************************************************************************/ @@ -677,13 +660,12 @@ mysql_free_result(MYSQL_RES *result) static const char *default_options[]= {"port","socket","compress","password","pipe", "timeout", "user", "init-command", "host", "database", "debug", "return-found-rows", +#ifdef HAVE_OPENSSL "ssl_key" ,"ssl_cert" ,"ssl_ca" ,"ssl_capath", - "character-set-dir", "default-character-set", +#endif /* HAVE_OPENSSL */ NullS }; - -static TYPELIB option_types={array_elements(default_options)-1, - "options",default_options}; +static TYPELIB option_types={array_elements(default_options)-1,(char*) "options",(char **) default_options}; static void mysql_read_default_options(struct st_mysql_options *options, const char *filename,const char *group) @@ -793,21 +775,7 @@ static void mysql_read_default_options(struct st_mysql_options *options, my_free(options->ssl_capath, MYF(MY_ALLOW_ZERO_PTR)); options->ssl_capath = my_strdup(opt_arg, MYF(MY_WME)); break; -#else - case 13: /* Ignore SSL options */ - case 14: - case 15: - case 16: - break; #endif /* HAVE_OPENSSL */ - case 17: /* charset-lib */ - my_free(options->charset_dir,MYF(MY_ALLOW_ZERO_PTR)); - options->charset_dir = my_strdup(opt_arg, MYF(MY_WME)); - break; - case 18: - my_free(options->charset_name,MYF(MY_ALLOW_ZERO_PTR)); - options->charset_name = my_strdup(opt_arg, MYF(MY_WME)); - break; default: DBUG_PRINT("warning",("unknown option: %s",option[0])); } @@ -998,13 +966,9 @@ mysql_init(MYSQL *mysql) } else bzero((char*) (mysql),sizeof(*(mysql))); -#ifdef __WIN__ +#ifdef __WIN32__ mysql->options.connect_timeout=20; #endif -#if defined(SIGPIPE) && defined(THREAD) - if (!((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE)) - (void) signal(SIGPIPE,pipe_sig_handler); -#endif return mysql; } @@ -1033,7 +997,7 @@ static void mysql_once_init() if (!mysql_unix_port) { char *env; -#ifdef __WIN__ +#ifdef __WIN32__ mysql_unix_port = (char*) MYSQL_NAMEDPIPE; #else mysql_unix_port = (char*) MYSQL_UNIX_ADDR; @@ -1042,7 +1006,7 @@ static void mysql_once_init() mysql_unix_port = env; } mysql_debug(NullS); -#if defined(SIGPIPE) && !defined(THREAD) +#if defined(SIGPIPE) (void) signal(SIGPIPE,SIG_IGN); #endif } @@ -1098,7 +1062,7 @@ mysql_ssl_clear(MYSQL *mysql) mysql->options.ssl_ca = 0; mysql->options.ssl_capath = 0; mysql->options.use_ssl = false; - mysql->connector_fd->delete(); + delete reinterpret_cast<VioConnectorFd*>(mysql->connector_fd); mysql->connector_fd = 0; return 0; } @@ -1137,13 +1101,13 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, const char *passwd, const char *db, uint port, const char *unix_socket,uint client_flag) { - char buff[100],charset_name_buff[16],*end,*host_info, *charset_name; + char buff[100],*end,*host_info; int sock; - uint32 ip_addr; + ulong ip_addr; struct sockaddr_in sock_addr; uint pkt_length; - NET *net= &mysql->net; -#ifdef __WIN__ + NET *net; +#ifdef __WIN32__ HANDLE hPipe=INVALID_HANDLE_VALUE; #endif #ifdef HAVE_SYS_UN_H @@ -1159,7 +1123,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, /* Don't give sigpipe errors if the client doesn't want them */ set_sigpipe(mysql); - net->vio = 0; /* If something goes wrong */ /* use default options */ if (mysql->options.my_cnf_file || mysql->options.my_cnf_group) { @@ -1192,8 +1155,10 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, if (!unix_socket) unix_socket=mysql->options.unix_socket; + remember_connection(mysql); mysql->reconnect=1; /* Reconnect as default */ - mysql->server_status=SERVER_STATUS_AUTOCOMMIT; + net= &mysql->net; + net->vio = 0; /* If something goes wrong */ /* ** Grab a socket and connect it to the server @@ -1227,7 +1192,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, } } else -#elif defined(__WIN__) +#elif defined(__WIN32__) { if ((unix_socket || !host && is_NT() || @@ -1285,7 +1250,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, if ((int) (ip_addr = inet_addr(host)) != (int) INADDR_NONE) { - memcpy_fixed(&sock_addr.sin_addr,&ip_addr,sizeof(ip_addr)); + memcpy(&sock_addr.sin_addr,&ip_addr,sizeof(ip_addr)); } else #if defined(HAVE_GETHOSTBYNAME_R) && defined(_REENTRANT) && defined(THREAD) @@ -1358,53 +1323,17 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, mysql->thread_id=uint4korr(end+1); end+=5; strmake(mysql->scramble_buff,end,8); - end+=9; - if (pkt_length >= (uint) (end+1 - (char*) net->read_pos)) - mysql->server_capabilities=uint2korr(end); - if (pkt_length >= (uint) (end+18 - (char*) net->read_pos)) - { - /* New protocol with 16 bytes to describe server characteristics */ - mysql->server_language=end[2]; - mysql->server_status=uint2korr(end+3); - } - - /* Set character set */ - if ((charset_name=mysql->options.charset_name)) - { - const char *save=charsets_dir; - if (mysql->options.charset_dir) - charsets_dir=mysql->options.charset_dir; - mysql->charset=get_charset_by_name(mysql->options.charset_name, - MYF(MY_WME)); - charsets_dir=save; - } - else if (mysql->server_language) - { - charset_name=charset_name_buff; - sprintf(charset_name,"%d",mysql->server_language); /* In case of errors */ - mysql->charset=get_charset((uint8) mysql->server_language, MYF(MY_WME)); - } - else - mysql->charset=default_charset_info; - - if (!mysql->charset) - { - net->last_errno=CR_CANT_READ_CHARSET; - sprintf(net->last_error,ER(net->last_errno), - charset_name ? charset_name : "unknown", - mysql->options.charset_dir ? mysql->options.charset_dir : - "default"); - goto error; - } + if (pkt_length > (uint) (end+9 - (char*) net->read_pos)) + mysql->server_capabilities=uint2korr(end+9); /* Save connection information */ if (!user) user=""; if (!passwd) passwd=""; if (!my_multi_malloc(MYF(0), - &mysql->host_info, (uint) strlen(host_info)+1, - &mysql->host, (uint) strlen(host)+1, - &mysql->unix_socket,unix_socket ? - (uint) strlen(unix_socket)+1 : (uint) 1, + &mysql->host_info,strlen(host_info)+1, + &mysql->host,strlen(host)+1, + &mysql->unix_socket,unix_socket ? strlen(unix_socket)+1 + :1, &mysql->server_version, (uint) (end - (char*) net->read_pos), NullS) || @@ -1423,9 +1352,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, strmov(mysql->server_version,(char*) net->read_pos+1); mysql->port=port; mysql->client_flag=client_flag | mysql->options.client_flag; - DBUG_PRINT("info",("Server version = '%s' capabilites: %ld status: %d", - mysql->server_version,mysql->server_capabilities, - mysql->server_status)); + DBUG_PRINT("info",("Server version = '%s' capabilites: %ld", + mysql->server_version,mysql->server_capabilities)); /* Send client information for access check */ client_flag|=CLIENT_CAPABILITIES; @@ -1487,9 +1415,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, strmake(buff+5,user,32); else read_user_name((char*) buff+5); -#ifdef _CUSTOMCONFIG_ -#include "_cust_libmysql.h"; -#endif DBUG_PRINT("info",("user: %s",buff+5)); end=scramble(strend(buff+5)+1, mysql->scramble_buff, passwd, (my_bool) (mysql->protocol_version == 9)); @@ -1540,13 +1465,8 @@ static my_bool mysql_reconnect(MYSQL *mysql) MYSQL tmp_mysql; DBUG_ENTER("mysql_reconnect"); - if (!mysql->reconnect || - (mysql->server_status & SERVER_STATUS_IN_TRANS) || !mysql->host_info) - { - /* Allov reconnect next time */ - mysql->server_status&= ~SERVER_STATUS_IN_TRANS; + if (!mysql->reconnect || !mysql->host_info) DBUG_RETURN(1); - } mysql_init(&tmp_mysql); tmp_mysql.options=mysql->options; if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd, @@ -1555,9 +1475,9 @@ static my_bool mysql_reconnect(MYSQL *mysql) DBUG_RETURN(1); tmp_mysql.free_me=mysql->free_me; mysql->free_me=0; - bzero((char*) &mysql->options,sizeof(mysql->options)); + bzero((char*) &mysql->options,sizeof(&mysql->options)); mysql_close(mysql); - *mysql=tmp_mysql; + memcpy(mysql,&tmp_mysql,sizeof(tmp_mysql)); net_clear(&mysql->net); mysql->affected_rows= ~(my_ulonglong) 0; DBUG_RETURN(0); @@ -1608,7 +1528,7 @@ mysql_select_db(MYSQL *mysql, const char *db) DBUG_ENTER("mysql_select_db"); DBUG_PRINT("enter",("db: '%s'",db)); - if ((error=simple_command(mysql,COM_INIT_DB,db,(uint) strlen(db),0))) + if ((error=simple_command(mysql,COM_INIT_DB,db,strlen(db),0))) DBUG_RETURN(error); my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); mysql->db=my_strdup(db,MYF(MY_WME)); @@ -1640,14 +1560,11 @@ mysql_close(MYSQL *mysql) my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.init_command,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.host,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.password,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.unix_socket,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.db,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); /* Clear pointers for better safety */ mysql->host_info=mysql->user=mysql->passwd=mysql->db=0; bzero((char*) &mysql->options,sizeof(mysql->options)); @@ -1671,12 +1588,12 @@ mysql_close(MYSQL *mysql) int STDCALL mysql_query(MYSQL *mysql, const char *query) { - return mysql_real_query(mysql,query, (uint) strlen(query)); + return mysql_real_query(mysql,query,strlen(query)); } int STDCALL -mysql_real_query(MYSQL *mysql, const char *query, uint length) +mysql_real_query(MYSQL *mysql, const char *query,uint length) { uchar *pos; ulong field_count; @@ -1695,10 +1612,6 @@ mysql_real_query(MYSQL *mysql, const char *query, uint length) { mysql->affected_rows= net_field_length_ll(&pos); mysql->insert_id= net_field_length_ll(&pos); - if (mysql->server_capabilities & CLIENT_TRANSACTIONS) - { - mysql->server_status=uint2korr(pos); pos+=2; - } if (pos < mysql->net.read_pos+length && net_field_length(&pos)) mysql->info=(char*) pos; DBUG_RETURN(0); @@ -1710,9 +1623,6 @@ mysql_real_query(MYSQL *mysql, const char *query, uint length) DBUG_RETURN(-1); goto get_info; /* Get info packet */ } - if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT)) - mysql->server_status|= SERVER_STATUS_IN_TRANS; - mysql->extra_info= net_field_length_ll(&pos); /* Maybe number of rec */ if (!(fields=read_rows(mysql,(MYSQL_FIELD*) 0,5))) DBUG_RETURN(-1); @@ -1910,7 +1820,6 @@ mysql_fetch_row(MYSQL_RES *res) } else { - DBUG_PRINT("info",("end of data")); res->eof=1; res->handle->status=MYSQL_STATUS_READY; } @@ -1920,10 +1829,7 @@ mysql_fetch_row(MYSQL_RES *res) { MYSQL_ROW tmp; if (!res->data_cursor) - { - DBUG_PRINT("info",("end of data")); DBUG_RETURN(res->current_row=(MYSQL_ROW) NULL); - } tmp = res->data_cursor->data; res->data_cursor = res->data_cursor->next; DBUG_RETURN(res->current_row=tmp); @@ -1974,7 +1880,7 @@ void STDCALL mysql_data_seek(MYSQL_RES *result, my_ulonglong row) { MYSQL_ROWS *tmp=0; - DBUG_PRINT("info",("mysql_data_seek(%ld)",(long) row)); + DBUG_PRINT("info",("mysql_data_seek(%d)",row)); if (result->data) for (tmp=result->data->data; row-- && tmp ; tmp = tmp->next) ; result->current_row=0; @@ -1983,7 +1889,7 @@ mysql_data_seek(MYSQL_RES *result, my_ulonglong row) /************************************************************************* ** put the row or field cursor one a position one got from mysql_row_tell() -** This doesn't restore any data. The next mysql_fetch_row or +** This dosen't restore any data. The next mysql_fetch_row or ** mysql_fetch_field will return the next row or field after the last used *************************************************************************/ @@ -2240,14 +2146,6 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg) my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR)); mysql->options.my_cnf_group=my_strdup(arg,MYF(MY_WME)); break; - case MYSQL_SET_CHARSET_DIR: - my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.charset_dir=my_strdup(arg,MYF(MY_WME)); - break; - case MYSQL_SET_CHARSET_NAME: - my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.charset_name=my_strdup(arg,MYF(MY_WME)); - break; default: DBUG_RETURN(-1); } @@ -2260,93 +2158,78 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg) ****************************************************************************/ /* MYSQL_RES */ -my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res) +my_ulonglong mysql_num_rows(MYSQL_RES *res) { return res->row_count; } -unsigned int STDCALL mysql_num_fields(MYSQL_RES *res) +unsigned int mysql_num_fields(MYSQL_RES *res) { return res->field_count; } -my_bool STDCALL mysql_eof(MYSQL_RES *res) +my_bool mysql_eof(MYSQL_RES *res) { return res->eof; } -MYSQL_FIELD * STDCALL mysql_fetch_field_direct(MYSQL_RES *res,uint fieldnr) +MYSQL_FIELD *mysql_fetch_field_direct(MYSQL_RES *res,uint fieldnr) { return &(res)->fields[fieldnr]; } -MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res) +MYSQL_FIELD *mysql_fetch_fields(MYSQL_RES *res) { return (res)->fields; } -MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res) +MYSQL_ROWS *mysql_row_tell(MYSQL_RES *res) { return res->data_cursor; } -uint STDCALL mysql_field_tell(MYSQL_RES *res) +uint mysql_field_tell(MYSQL_RES *res) { return (res)->current_field; } /* MYSQL */ -unsigned int STDCALL mysql_field_count(MYSQL *mysql) +unsigned int mysql_field_count(MYSQL *mysql) { return mysql->field_count; } -my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql) +my_ulonglong mysql_affected_rows(MYSQL *mysql) { return (mysql)->affected_rows; } -my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql) +my_ulonglong mysql_insert_id(MYSQL *mysql) { return (mysql)->insert_id; } -uint STDCALL mysql_errno(MYSQL *mysql) +uint mysql_errno(MYSQL *mysql) { return (mysql)->net.last_errno; } -char * STDCALL mysql_error(MYSQL *mysql) +char *mysql_error(MYSQL *mysql) { return (mysql)->net.last_error; } -char *STDCALL mysql_info(MYSQL *mysql) +char *mysql_info(MYSQL *mysql) { return (mysql)->info; } -ulong STDCALL mysql_thread_id(MYSQL *mysql) +ulong mysql_thread_id(MYSQL *mysql) { return (mysql)->thread_id; } -const char * STDCALL mysql_character_set_name(MYSQL *mysql) -{ - return mysql->charset->name; -} - - -uint STDCALL mysql_thread_safe(void) -{ -#ifdef THREAD - return 1; -#else - return 0; -#endif -} - /**************************************************************************** ** Some support functions ****************************************************************************/ @@ -2360,31 +2243,13 @@ uint STDCALL mysql_thread_safe(void) ulong STDCALL mysql_escape_string(char *to,const char *from,ulong length) { - return mysql_sub_escape_string(default_charset_info,to,from,length); -} - -ulong STDCALL -mysql_real_escape_string(MYSQL *mysql, char *to,const char *from, - ulong length) -{ - return mysql_sub_escape_string(mysql->charset,to,from,length); -} - - -static ulong -mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, - const char *from, ulong length) -{ const char *to_start=to; const char *end; -#ifdef USE_MB - my_bool use_mb_flag=use_mb(charset_info); -#endif for (end=from+length; from != end ; from++) { #ifdef USE_MB int l; - if (use_mb_flag && (l = my_ismbchar(charset_info, from, end))) + if ((l = ismbchar(from, end))) { while (l--) *to++ = *from++; @@ -2431,8 +2296,7 @@ mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, char * STDCALL -mysql_odbc_escape_string(MYSQL *mysql, - char *to, ulong to_length, +mysql_odbc_escape_string(char *to, ulong to_length, const char *from, ulong from_length, void *param, char * (*extend_buffer) @@ -2440,9 +2304,6 @@ mysql_odbc_escape_string(MYSQL *mysql, { char *to_end=to+to_length-5; const char *end; -#ifdef USE_MB - my_bool use_mb_flag=use_mb(mysql->charset); -#endif for (end=from+from_length; from != end ; from++) { @@ -2456,7 +2317,7 @@ mysql_odbc_escape_string(MYSQL *mysql, #ifdef USE_MB { int l; - if (use_mb_flag && (l = my_ismbchar(mysql->charset, from, end))) + if ((l = ismbchar(from, end))) { while (l--) *to++ = *from++; @@ -2500,34 +2361,3 @@ mysql_odbc_escape_string(MYSQL *mysql, } return to; } - -void STDCALL -myodbc_remove_escape(MYSQL *mysql,char *name) -{ - char *to; -#ifdef USE_MB - my_bool use_mb_flag=use_mb(mysql->charset); - char *end; - LINT_INIT(end); - if (use_mb_flag) - for (end=name; *end ; end++) ; -#endif - - for (to=name ; *name ; name++) - { -#ifdef USE_MB - int l; - if (use_mb_flag && (l = my_ismbchar( mysql->charset, name , end ) ) ) - { - while (l--) - *to++ = *name++; - name--; - continue; - } -#endif - if (*name == '\\' && name[1]) - name++; - *to++= *name; - } - *to=0; -} diff --git a/ext/mysql/libmysql/list.c b/ext/mysql/libmysql/list.c index 0a6d900d6b..f39ac7e3e3 100644 --- a/ext/mysql/libmysql/list.c +++ b/ext/mysql/libmysql/list.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Code for handling dubble-linked lists in C @@ -28,8 +14,6 @@ LIST *list_add(LIST *root, LIST *element) { - DBUG_ENTER("list_add"); - DBUG_PRINT("enter",("root: %lx element: %lx", root, element)); if (root) { if (root->prev) /* If add in mid of list */ @@ -40,7 +24,7 @@ LIST *list_add(LIST *root, LIST *element) else element->prev=0; element->next=root; - DBUG_RETURN(element); /* New root */ + return element; /* New root */ } diff --git a/ext/mysql/libmysql/longlong2str.c b/ext/mysql/libmysql/longlong2str.c index 5c4eaf98c8..9759208266 100644 --- a/ext/mysql/libmysql/longlong2str.c +++ b/ext/mysql/libmysql/longlong2str.c @@ -1,20 +1,3 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - /* Defines: longlong2str(); @@ -83,61 +66,16 @@ char *longlong2str(longlong val,char *dst,int radix) ulonglong quo=(ulonglong) val/(uint) radix; uint rem= (uint) (val- quo* (uint) radix); *--p = _dig_vec[rem]; - val= quo; + val= quo; } long_val= (long) val; while (long_val != 0) { - long quo= long_val/radix; - *--p = _dig_vec[(uchar) (long_val - quo*radix)]; - long_val= quo; + *--p = _dig_vec[long_val%radix]; + long_val /= radix; } while ((*dst++ = *p++) != 0) ; return dst-1; } #endif - -#ifndef longlong10_to_str -char *longlong10_to_str(longlong val,char *dst,int radix) -{ - char buffer[65]; - register char *p; - long long_val; - - if (radix < 0) - { - if (val < 0) - { - *dst++ = '-'; - val = -val; - } - } - - if (val == 0) - { - *dst++='0'; - *dst='\0'; - return dst; - } - p = &buffer[sizeof(buffer)-1]; - *p = '\0'; - - while ((ulonglong) val > (ulonglong) LONG_MAX) - { - ulonglong quo=(ulonglong) val/(uint) 10; - uint rem= (uint) (val- quo* (uint) 10); - *--p = _dig_vec[rem]; - val= quo; - } - long_val= (long) val; - while (long_val != 0) - { - long quo= long_val/10; - *--p = _dig_vec[(uchar) (long_val - quo*10)]; - long_val= quo; - } - while ((*dst++ = *p++) != 0) ; - return dst-1; -} -#endif diff --git a/ext/mysql/libmysql/m_ctype.h b/ext/mysql/libmysql/m_ctype.h index 438b7b34c9..d3b55aafff 100644 --- a/ext/mysql/libmysql/m_ctype.h +++ b/ext/mysql/libmysql/m_ctype.h @@ -1,20 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - +/* Copyright (C) 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + For a more info consult the file COPYRIGHT distributed with this file */ /* A better inplementation of the UNIX ctype(3) library. Notes: global.h should be included before ctype.h @@ -23,45 +8,41 @@ #ifndef _m_ctype_h #define _m_ctype_h +#define MY_CHARSET_UNDEFINED 0 +#define MY_CHARSET_BIG5 1 +#define MY_CHARSET_CZECH 2 +#define MY_CHARSET_DEC8 3 +#define MY_CHARSET_DOS 4 +#define MY_CHARSET_GERMAN1 5 +#define MY_CHARSET_HP8 6 +#define MY_CHARSET_KOI8_RU 7 +#define MY_CHARSET_LATIN1 8 +#define MY_CHARSET_LATIN2 9 +#define MY_CHARSET_SWE7 10 +#define MY_CHARSET_USA7 11 +#define MY_CHARSET_UJIS 12 +#define MY_CHARSET_SJIS 13 +#define MY_CHARSET_CP1251 14 +#define MY_CHARSET_DANISH 15 +#define MY_CHARSET_HEBREW 16 +#define MY_CHARSET_WIN1251 17 +#define MY_CHARSET_TIS620 18 +#define MY_CHARSET_EUC_KR 19 +#define MY_CHARSET_ESTONIA 20 +#define MY_CHARSET_HUNGARIAN 21 +#define MY_CHARSET_KOI8_UKR 22 +#define MY_CHARSET_WIN1251UKR 23 +#define MY_CHARSET_GB2312 24 +#define MY_CHARSET_GREEK 25 +#define MY_CHARSET_WIN1250 26 +#define MY_CHARSET_CROAT 27 +#define MY_CHARSET_GBK 28 + #ifdef __cplusplus extern "C" { #endif -#define CHARSET_DIR "charsets/" - -typedef struct charset_info_st -{ - uint number; - const char *name; - uchar *ctype; - uchar *to_lower; - uchar *to_upper; - uchar *sort_order; - - uint strxfrm_multiply; - int (*strcoll)(const uchar *, const uchar *); - int (*strxfrm)(uchar *, const uchar *, int); - int (*strnncoll)(const uchar *, int, const uchar *, int); - int (*strnxfrm)(uchar *, const uchar *, int, int); - my_bool (*like_range)(const char *, uint, pchar, uint, - char *, char *, uint *, uint *); - - uint mbmaxlen; - int (*ismbchar)(const char *, const char *); - my_bool (*ismbhead)(uint); - int (*mbcharlen)(uint); -} CHARSET_INFO; - -/* strings/ctype.c */ -extern CHARSET_INFO *default_charset_info; -extern CHARSET_INFO *find_compiled_charset(uint cs_number); -extern CHARSET_INFO *find_compiled_charset_by_name(const char *name); -extern CHARSET_INFO compiled_charsets[]; - -#define MY_CHARSET_UNDEFINED 0 -#define MY_CHARSET_CURRENT (default_charset_info->number) - -#ifdef __WIN__ +#ifdef __WIN32__ #include <ctype.h> #endif /* Don't include std ctype.h when this is included */ @@ -70,6 +51,14 @@ extern CHARSET_INFO compiled_charsets[]; #define __CTYPE_INCLUDED #define _CTYPE_USING /* Don't put names in global namespace. */ +#ifndef CTYPE_LIBRARY +#define EXT extern +#define D(x) +#else +#define EXT +#define D(x) = x +#endif + #define _U 01 /* Upper case */ #define _L 02 /* Lower case */ #define _N 04 /* Numeral (digit) */ @@ -79,12 +68,17 @@ extern CHARSET_INFO compiled_charsets[]; #define _B 0100 /* Blank */ #define _X 0200 /* heXadecimal digit */ -#define my_ctype (default_charset_info->ctype) -#define my_to_upper (default_charset_info->to_upper) -#define my_to_lower (default_charset_info->to_lower) -#define my_sort_order (default_charset_info->sort_order) +extern uchar NEAR ctype_latin1[]; +extern uchar NEAR to_upper_latin1[]; +extern uchar NEAR to_lower_latin1[]; +extern uchar NEAR sort_order_latin1[]; + +#define my_ctype ctype_latin1 +#define my_to_upper to_upper_latin1 +#define my_to_lower to_lower_latin1 +#define my_sort_order sort_order_latin1 -#ifndef __WIN__ +#ifndef __WIN32__ #define _toupper(c) (char) my_to_upper[(uchar) (c)] #define _tolower(c) (char) my_to_lower[(uchar) (c)] #define toupper(c) (char) my_to_upper[(uchar) (c)] @@ -108,34 +102,7 @@ extern CHARSET_INFO compiled_charsets[]; #undef ctype #endif /* ctype */ -#endif /* __WIN__ */ - -#define my_isalpha(s, c) (((s)->ctype+1)[(uchar) (c)] & (_U | _L)) -#define my_isupper(s, c) (((s)->ctype+1)[(uchar) (c)] & _U) -#define my_islower(s, c) (((s)->ctype+1)[(uchar) (c)] & _L) -#define my_isdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _N) -#define my_isxdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _X) -#define my_isalnum(s, c) (((s)->ctype+1)[(uchar) (c)] & (_U | _L | _N)) -#define my_isspace(s, c) (((s)->ctype+1)[(uchar) (c)] & _S) -#define my_ispunct(s, c) (((s)->ctype+1)[(uchar) (c)] & _P) -#define my_isprint(s, c) (((s)->ctype+1)[(uchar) (c)] & (_P | _U | _L | _N | _B)) -#define my_isgraph(s, c) (((s)->ctype+1)[(uchar) (c)] & (_P | _U | _L | _N)) -#define my_iscntrl(s, c) (((s)->ctype+1)[(uchar) (c)] & _C) - -#define use_strcoll(s) ((s)->strcoll != NULL) -#define MY_STRXFRM_MULTIPLY (default_charset_info->strxfrm_multiply) -#define my_strnxfrm(s, a, b, c, d) ((s)->strnxfrm((a), (b), (c), (d))) -#define my_strnncoll(s, a, b, c, d) ((s)->strnncoll((a), (b), (c), (d))) -#define my_strxfrm(s, a, b, c, d) ((s)->strnxfrm((a), (b), (c))) -#define my_strcoll(s, a, b) ((s)->strcoll((a), (b))) -#define my_like_range(s, a, b, c, d, e, f, g, h) \ - ((s)->like_range((a), (b), (c), (d), (e), (f), (g), (h))) - -#define use_mb(s) ((s)->ismbchar != NULL) -#define MBMAXLEN (default_charset_info->mbmaxlen) -#define my_ismbchar(s, a, b) ((s)->ismbchar((a), (b))) -#define my_ismbhead(s, a) ((s)->ismbhead((a))) -#define my_mbcharlen(s, a) ((s)->mbcharlen((a))) +#endif /* __WIN32__ */ /* Some macros that should be cleaned up a little */ #define isvar(c) (isalnum(c) || (c) == '_') @@ -143,13 +110,120 @@ extern CHARSET_INFO compiled_charsets[]; #define tocntrl(c) ((c) & 31) #define toprint(c) ((c) | 64) -/* XXX: still need to take care of this one */ -#ifdef MY_CHARSET_TIS620 -#error The TIS620 charset is broken at the moment. Tell tim to fix it. +/* Support for Japanese(UJIS) characters, by tommy@valley.ne.jp */ +#if MY_CHARSET_CURRENT == MY_CHARSET_UJIS +#define USE_MB +#define USE_MB_IDENT +#define isujis(c) ((0xa1<=((c)&0xff) && ((c)&0xff)<=0xfe)) +#define iskata(c) ((0xa1<=((c)&0xff) && ((c)&0xff)<=0xdf)) +#define isujis_ss2(c) (((c)&0xff) == 0x8e) +#define isujis_ss3(c) (((c)&0xff) == 0x8f) +#define ismbchar(p, end) ((*(uchar*)(p)<0x80)? 0:\ + isujis(*(p)) && (end)-(p)>1 && isujis(*((p)+1))? 2:\ + isujis_ss2(*(p)) && (end)-(p)>1 && iskata(*((p)+1))? 2:\ + isujis_ss3(*(p)) && (end)-(p)>2 && isujis(*((p)+1)) && isujis(*((p)+2))? 3:\ + 0) +#define ismbhead(c) (isujis(c) || isujis_ss2(c) || isujis_ss3(c)) +#define mbcharlen(c) (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 0) +#define MBMAXLEN 3 +#endif + +/* Support for Japanese(SJIS) characters, by tommy@valley.ne.jp */ +#if MY_CHARSET_CURRENT == MY_CHARSET_SJIS +#define USE_MB +#define USE_MB_IDENT +#define issjishead(c) ((0x81<=((c)&0xff) && ((c)&0xff)<=0x9f) || (0xe0<=((c)&0xff) && ((c)&0xff)<=0xfc)) +#define issjistail(c) ((0x40<=((c)&0xff) && ((c)&0xff)<=0x7e) || (0x80<=((c)&0xff) && ((c)&0xff)<=0xfc)) +#define ismbchar(p, end) (issjishead(*(p)) && (end)-(p)>1 && issjistail(*((p)+1))? 2: 0) +#define ismbhead(c) issjishead(c) +#define mbcharlen(c) (issjishead(c)? 2: 0) +#define MBMAXLEN 2 +#endif + +/* Support for Chinese(BIG5) characters, by jou@nematic.ieo.nctu.edu.tw + modified by Wei He (hewei@mail.ied.ac.cn) */ + +#if MY_CHARSET_CURRENT == MY_CHARSET_BIG5 +#define USE_MB +#define USE_MB_IDENT +#define isbig5head(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xf9) +#define isbig5tail(c) ((0x40<=(uchar)(c) && (uchar)(c)<=0x7e) || \ + (0xa1<=(uchar)(c) && (uchar)(c)<=0xfe)) +#define ismbchar(p, end) (isbig5head(*(p)) && (end)-(p)>1 && isbig5tail(*((p)+1))? 2: 0) +#define ismbhead(c) isbig5head(c) +#define mbcharlen(c) (isbig5head(c)? 2: 0) +#define MBMAXLEN 2 +# +#undef USE_STRCOLL +#define USE_STRCOLL +#endif + +/* Support for Chinese(GB2312) characters, by Miles Tsai (net-bull@126.com) + modified by Wei He (hewei@mail.ied.ac.cn) */ + +#if MY_CHARSET_CURRENT == MY_CHARSET_GB2312 +#define USE_MB +#define USE_MB_IDENT +#define isgb2312head(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xf7) +#define isgb2312tail(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xfe) +#define ismbchar(p, end) (isgb2312head(*(p)) && (end)-(p)>1 && isgb2312tail(*((p)+1))? 2: 0) +#define ismbhead(c) isgb2312head(c) +#define mbcharlen(c) (isgb2312head(c)? 2:0) +#define MBMAXLEN 2 +#endif + +/* Support for Chinese(GBK) characters, by hewei@mail.ied.ac.cn */ + +#if MY_CHARSET_CURRENT == MY_CHARSET_GBK +#define USE_MB +#define USE_MB_IDENT +#define isgbkhead(c) (0x81<=(uchar)(c) && (uchar)(c)<=0xfe) +#define isgbktail(c) ((0x40<=(uchar)(c) && (uchar)(c)<=0x7e) || \ + (0x80<=(uchar)(c) && (uchar)(c)<=0xfe)) +#define ismbchar(p, end) (isgbkhead(*(p)) && (end)-(p)>1 && isgbktail(*((p)+1))? 2: 0) +#define ismbhead(c) isgbkhead(c) +#define mbcharlen(c) (isgbkhead(c)? 2:0) +#define MBMAXLEN 2 +#undef USE_STRCOLL +#define USE_STRCOLL +#endif + +/* Define, how much will the string grow under strxfrm */ +#if MY_CHARSET_CURRENT == MY_CHARSET_CZECH +#undef USE_STRCOLL +#define USE_STRCOLL +#endif +#if MY_CHARSET_CURRENT == MY_CHARSET_TIS620 +#undef USE_STRCOLL +#define USE_STRCOLL #define USE_TIS620 #include "t_ctype.h" #endif +/* Support for Korean(EUC_KR) characters, by powerm90@tinc.co.kr and mrpark@tinc.co.kr */ +#if MY_CHARSET_CURRENT == MY_CHARSET_EUC_KR +#define USE_MB +#define USE_MB_IDENT +#define iseuc_kr(c) ((0xa1<=(uchar)(c) && (uchar)(c)<=0xfe)) +#define ismbchar(p, end) ((*(uchar*)(p)<0x80)? 0:\ + iseuc_kr(*(p)) && (end)-(p)>1 && iseuc_kr(*((p)+1))? 2:\ + 0) +#define ismbhead(c) (iseuc_kr(c)) +#define mbcharlen(c) (iseuc_kr(c) ? 2 : 0) +#define MBMAXLEN 2 +#endif + +#ifdef USE_STRCOLL +extern uint MY_STRXFRM_MULTIPLY; +extern int my_strnxfrm(unsigned char *, unsigned char *, int, int); +extern int my_strnncoll(const unsigned char *, int, const unsigned char *, int); +extern int my_strxfrm(unsigned char *, unsigned char *, int); +extern int my_strcoll(const unsigned char *, const unsigned char *); +extern my_bool my_like_range(const char *ptr,uint ptr_length,pchar escape, + uint res_length, char *min_str,char *max_str, + uint *min_length,uint *max_length); +#endif + #ifdef __cplusplus } #endif diff --git a/ext/mysql/libmysql/m_string.h b/ext/mysql/libmysql/m_string.h index c17e928ea3..37207b6612 100644 --- a/ext/mysql/libmysql/m_string.h +++ b/ext/mysql/libmysql/m_string.h @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright (C) 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + For a more info consult the file COPYRIGHT distributed with this file */ /* There may be prolems include all of theese. Try to test in configure with ones are needed? */ @@ -22,9 +8,6 @@ #ifndef _m_string_h #define _m_string_h -#ifndef __USE_GNU -#define __USE_GNU /* We want to use stpcpy */ -#endif #if defined(HAVE_STRINGS_H) #include <strings.h> #endif @@ -69,10 +52,6 @@ # define memmove(d, s, n) bmove((d), (s), (n)) /* our bmove */ #endif -#if defined(HAVE_STPCPY) && !defined(HAVE_mit_thread) -#define strmov(A,B) stpcpy((A),(B)) -#endif - /* Unixware 7 */ #if !defined(HAVE_BFILL) # define bfill(A,B,C) memset((A),(C),(B)) @@ -99,12 +78,6 @@ extern char NEAR _dig_vec[]; /* Declared in int2str() */ #define strmake_overlapp(A,B,C) strmake(A,B,C) #endif -#ifdef BAD_MEMCPY /* Problem with gcc on Alpha */ -#define memcpy_fixed(A,B,C) bmove((A),(B),(C)) -#else -#define memcpy_fixed(A,B,C) memcpy((A),(B),(C)) -#endif - #ifdef MSDOS #undef bmove_allign #define bmove512(A,B,C) bmove_allign(A,B,C) @@ -163,6 +136,7 @@ extern char *strmake_overlapp(char *dst,const char *src, uint length); #ifndef strmov extern char *strmov(char *dst,const char *src); #endif +extern uint strnlen(const char *s,uint n); extern char *strnmov(char *dst,const char *src,uint n); extern char *strsuff(const char *src,const char *suffix); extern char *strcont(const char *src,const char *set); @@ -185,9 +159,6 @@ extern int strcmp(const char *, const char *); extern size_t strlen(const char *); #endif #endif -#ifndef HAVE_STRNLEN -extern uint strnlen(const char *s, uint n); -#endif #if !defined(__cplusplus) #ifndef HAVE_STRPBRK @@ -197,6 +168,7 @@ extern char *strpbrk(const char *, const char *); extern char *strstr(const char *, const char *); #endif #endif +extern qsort_cmp get_ptr_compare(uint); extern int is_prefix(const char *, const char *); /* Conversion rutins */ @@ -206,19 +178,16 @@ extern char *my_itoa(int val,char *dst,int radix); extern char *my_ltoa(long val,char *dst,int radix); #endif -extern char *llstr(longlong value,char *buff); #ifndef HAVE_STRTOUL extern long strtol(const char *str, char **ptr, int base); extern ulong strtoul(const char *str, char **ptr, int base); #endif extern char *int2str(long val,char *dst,int radix); -extern char *int10_to_str(long val,char *dst,int radix); extern char *str2int(const char *src,int radix,long lower,long upper, long *val); #if SIZEOF_LONG == SIZEOF_LONG_LONG #define longlong2str(A,B,C) int2str((A),(B),(C)) -#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C)) #define strtoll(A,B,C) strtol((A),(B),(C)) #define strtoull(A,B,C) strtoul((A),(B),(C)) #ifndef HAVE_STRTOULL @@ -227,7 +196,6 @@ extern char *str2int(const char *src,int radix,long lower,long upper, #else #ifdef HAVE_LONG_LONG extern char *longlong2str(longlong val,char *dst,int radix); -extern char *longlong10_to_str(longlong val,char *dst,int radix); #if (!defined(HAVE_STRTOULL) || defined(HAVE_mit_thread)) || defined(NO_STRTOLL_PROTO) extern longlong strtoll(const char *str, char **ptr, int base); extern ulonglong strtoull(const char *str, char **ptr, int base); diff --git a/ext/mysql/libmysql/mf_casecnv.c b/ext/mysql/libmysql/mf_casecnv.c index 1d63527eb7..6b24182b9c 100644 --- a/ext/mysql/libmysql/mf_casecnv.c +++ b/ext/mysql/libmysql/mf_casecnv.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Functions to convert to lover_case and to upper_case in scandinavia. @@ -32,17 +18,16 @@ void caseup_str(my_string str) { #ifdef USE_MB register uint32 l; - register char *end=str+(uint) strlen(str); - if (use_mb(default_charset_info)) - while (*str) - { - if ((l=my_ismbchar(default_charset_info, str,end))) str+=l; - else *str=toupper(*str),++str; - } - else + register char *end=str+strlen(str); + while (*str) + { + if ((l=ismbchar(str,end))) str+=l; + else *str=toupper(*str),++str; + } +#else + while ((*str = toupper(*str)) != 0) + str++; #endif - while ((*str = toupper(*str)) != 0) - str++; } /* caseup_str */ /* string to lowercase */ @@ -51,17 +36,16 @@ void casedn_str(my_string str) { #ifdef USE_MB register uint32 l; - register char *end=str+(uint) strlen(str); - if (use_mb(default_charset_info)) - while (*str) - { - if ((l=my_ismbchar(default_charset_info, str,end))) str+=l; - else *str=tolower(*str),++str; - } - else + register char *end=str+strlen(str); + while (*str) + { + if ((l=ismbchar(str,end))) str+=l; + else *str=tolower(*str),++str; + } +#else + while ((*str= tolower(*str)) != 0) + str++; #endif - while ((*str= tolower(*str)) != 0) - str++; } /* casedn_str */ @@ -72,16 +56,15 @@ void caseup(my_string str, uint length) #ifdef USE_MB register uint32 l; register char *end=str+length; - if (use_mb(default_charset_info)) - while (str<end) - { - if ((l=my_ismbchar(default_charset_info, str,end))) str+=l; - else *str=toupper(*str),++str; - } - else + while (str<end) + { + if ((l=ismbchar(str,end))) str+=l; + else *str=toupper(*str),++str; + } +#else + for ( ; length>0 ; length--, str++) + *str= toupper(*str); #endif - for ( ; length>0 ; length--, str++) - *str= toupper(*str); } /* caseup */ /* to lowercase */ @@ -91,16 +74,15 @@ void casedn(my_string str, uint length) #ifdef USE_MB register uint32 l; register char *end=str+length; - if (use_mb(default_charset_info)) - while (str<end) - { - if ((l=my_ismbchar(default_charset_info, str,end))) str+=l; - else *str=tolower(*str),++str; - } - else + while (str<end) + { + if ((l=ismbchar(str,end))) str+=l; + else *str=tolower(*str),++str; + } +#else + for ( ; length>0 ; length--, str++) + *str= tolower(*str); #endif - for ( ; length>0 ; length--, str++) - *str= tolower(*str); } /* casedn */ /* to sort-string that can be compared to get text in order */ @@ -118,7 +100,7 @@ void case_sort(my_string str, uint length) Wei He (hewei@mail.ied.ac.cn) */ -my_string my_strcasestr(const char *str, const char *search) +my_string strcasestr(const char *str, const char *search) { uchar *i,*j,*pos; @@ -126,8 +108,7 @@ my_string my_strcasestr(const char *str, const char *search) skipp: while (*pos != '\0') { - if (toupper((uchar) *pos++) == toupper((uchar) *search)) - { + if (toupper((uchar) *pos++) == toupper((uchar) *search)) { i=(uchar*) pos; j=(uchar*) search+1; while (*j) if (toupper(*i++) != toupper(*j++)) goto skipp; @@ -144,28 +125,23 @@ int my_strcasecmp(const char *s, const char *t) { #ifdef USE_MB register uint32 l; - register const char *end=s+(uint) strlen(s); - if (use_mb(default_charset_info)) + register const char *end=s+strlen(s); + while (s<end) { - while (s<end) + if ((l=ismbchar(s,end))) { - if ((l=my_ismbchar(default_charset_info, s,end))) - { - while (l--) - if (*s++ != *t++) return 1; - } - else if (my_ismbhead(default_charset_info, *t)) return 1; - else if (toupper((uchar) *s++) != toupper((uchar) *t++)) return 1; + while (l--) + if (*s++ != *t++) return 1; } - return *t; + else if (ismbhead(*t)) return 1; + else if (toupper((uchar) *s++) != toupper((uchar) *t++)) return 1; } - else + return *t; +#else + while (toupper((uchar) *s) == toupper((uchar) *t++)) + if (!*s++) return 0; + return ((int) toupper((uchar) s[0]) - (int) toupper((uchar) t[-1])); #endif - { - while (toupper((uchar) *s) == toupper((uchar) *t++)) - if (!*s++) return 0; - return ((int) toupper((uchar) s[0]) - (int) toupper((uchar) t[-1])); - } } @@ -174,79 +150,46 @@ int my_casecmp(const char *s, const char *t, uint len) #ifdef USE_MB register uint32 l; register const char *end=s+len; - if (use_mb(default_charset_info)) + while (s<end) { - while (s<end) + if ((l=ismbchar(s,end))) { - if ((l=my_ismbchar(default_charset_info, s,end))) - { - while (l--) - if (*s++ != *t++) return 1; - } - else if (my_ismbhead(default_charset_info, *t)) return 1; - else if (toupper((uchar) *s++) != toupper((uchar) *t++)) return 1; + while (l--) + if (*s++ != *t++) return 1; } - return 0; + else if (ismbhead(*t)) return 1; + else if (toupper((uchar) *s++) != toupper((uchar) *t++)) return 1; } - else + return 0; +#else + while (len-- != 0 && toupper(*s++) == toupper(*t++)) ; + return (int) len+1; #endif - { - while (len-- != 0 && toupper(*s++) == toupper(*t++)) ; - return (int) len+1; - } } int my_strsortcmp(const char *s, const char *t) { #ifdef USE_STRCOLL - if (use_strcoll(default_charset_info)) - return my_strcoll(default_charset_info, (uchar *)s, (uchar *)t); - else + return my_strcoll((uchar *)s, (uchar *)t); +#else + while (my_sort_order[(uchar) *s] == my_sort_order[(uchar) *t++]) + if (!*s++) return 0; + return ((int) my_sort_order[(uchar) s[0]] - (int) my_sort_order[(uchar) t[-1]]); #endif - { - while (my_sort_order[(uchar) *s] == my_sort_order[(uchar) *t++]) - if (!*s++) return 0; - return ((int) my_sort_order[(uchar) s[0]] - - (int) my_sort_order[(uchar) t[-1]]); - } } int my_sortcmp(const char *s, const char *t, uint len) { -#ifdef USE_STRCOLL - if (use_strcoll(default_charset_info)) - return my_strnncoll(default_charset_info, - (uchar *)s, len, (uchar *)t, len); - else -#endif +#ifndef USE_STRCOLL + while (len--) { - while (len--) - { - if (my_sort_order[(uchar) *s++] != my_sort_order[(uchar) *t++]) - return ((int) my_sort_order[(uchar) s[-1]] - - (int) my_sort_order[(uchar) t[-1]]); - } - return 0; + if (my_sort_order[(uchar) *s++] != my_sort_order[(uchar) *t++]) + return ((int) my_sort_order[(uchar) s[-1]] - + (int) my_sort_order[(uchar) t[-1]]); } -} - -int my_sortncmp(const char *s, uint s_len, const char *t, uint t_len) -{ -#ifdef USE_STRCOLL - if (use_strcoll(default_charset_info)) - return my_strnncoll(default_charset_info, - (uchar *)s, s_len, (uchar *)t, t_len); - else + return 0; +#else + return my_strnncoll((uchar *)s, len, (uchar *)t, len); #endif - { - uint len= min(s_len,t_len); - while (len--) - { - if (my_sort_order[(uchar) *s++] != my_sort_order[(uchar) *t++]) - return ((int) my_sort_order[(uchar) s[-1]] - - (int) my_sort_order[(uchar) t[-1]]); - } - return (int) (s_len - t_len); - } } diff --git a/ext/mysql/libmysql/mf_dirname.c b/ext/mysql/libmysql/mf_dirname.c index 1bd6d256cf..0897be7882 100644 --- a/ext/mysql/libmysql/mf_dirname.c +++ b/ext/mysql/libmysql/mf_dirname.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" #include <m_string.h> diff --git a/ext/mysql/libmysql/mf_fn_ext.c b/ext/mysql/libmysql/mf_fn_ext.c index 6a9b9d1834..0a52e60af3 100644 --- a/ext/mysql/libmysql/mf_fn_ext.c +++ b/ext/mysql/libmysql/mf_fn_ext.c @@ -1,30 +1,15 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Returnerar en pekare till filnamnets extension. */ #include "mysys_priv.h" #include <m_string.h> - /* Return a pointerto the extension of the filename - The pointer points at the extension character (normally '.')) - If there isn't any extension, the pointer points at the end - NULL of the filename - */ + /* Returnera en pekare till ett filnamns extension. + Pekaren pekar p} extensions-karakt{ren. Om ingen extension hittas + returneras en pekare till NULL-tecknet i filnamnet */ + /* Denna funktion r|r inte p} utg}ngsnamnet */ my_string fn_ext(const char *name) { diff --git a/ext/mysql/libmysql/mf_format.c b/ext/mysql/libmysql/mf_format.c index 623f1dbd19..ca2188b199 100644 --- a/ext/mysql/libmysql/mf_format.c +++ b/ext/mysql/libmysql/mf_format.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" #include <m_string.h> diff --git a/ext/mysql/libmysql/mf_loadpath.c b/ext/mysql/libmysql/mf_loadpath.c index 641528b8b5..8e3118968d 100644 --- a/ext/mysql/libmysql/mf_loadpath.c +++ b/ext/mysql/libmysql/mf_loadpath.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" #include <m_string.h> @@ -30,8 +16,7 @@ my_string my_load_path(my_string to, const char *path, { char buff[FN_REFLEN]; DBUG_ENTER("my_load_path"); - DBUG_PRINT("enter",("path: %s prefix: %s",path, - own_path_prefix ? own_path_prefix : "")); + DBUG_PRINT("enter",("path: %s prefix: %d",path,own_path_prefix)); if ((path[0] == FN_HOMELIB && path[1] == FN_LIBCHAR) || test_if_hard_path(path)) diff --git a/ext/mysql/libmysql/mf_pack.c b/ext/mysql/libmysql/mf_pack.c index bfa9e5d871..3dab1621f5 100644 --- a/ext/mysql/libmysql/mf_pack.c +++ b/ext/mysql/libmysql/mf_pack.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" #include <m_string.h> @@ -53,13 +39,13 @@ void pack_dirname(my_string to, const char *from) LINT_INIT(buff_length); if (!(cwd_err= my_getwd(buff,FN_REFLEN,MYF(0)))) { - buff_length= (uint) strlen(buff); + buff_length=strlen(buff); d_length=(uint) (start-to); if ((start == to || (buff_length == d_length && !bcmp(buff,start,d_length))) && *start != FN_LIBCHAR && *start) { /* Put current dir before */ - bchange(to,d_length,buff,buff_length,(uint) strlen(to)+1); + bchange(to,d_length,buff,buff_length,strlen(to)+1); } } @@ -68,7 +54,7 @@ void pack_dirname(my_string to, const char *from) length=0; if (home_dir) { - length= (uint) strlen(home_dir); + length=strlen(home_dir); if (home_dir[length-1] == FN_LIBCHAR) length--; /* Don't test last '/' */ } @@ -92,7 +78,7 @@ void pack_dirname(my_string to, const char *from) } if (is_prefix(to,buff)) { - length= (uint) strlen(buff); + length=strlen(buff); if (to[length]) (void) strmov_overlapp(to,to+length); /* Remove everything before */ else @@ -212,44 +198,6 @@ uint cleanup_dirname(register my_string to, const char *from) } /* cleanup_dirname */ - /* - On system where you don't have symbolic links, the following - code will allow you to create a file: - directory-name.lnk that should contain the real path - to the directory. This will be used if the directory name - doesn't exists - */ - - -my_bool my_use_symdir=0; /* Set this if you want to use symdirs */ - -#ifdef USE_SYMDIR -void symdirget(char *dir) -{ - char buff[FN_REFLEN]; - char *pos=strend(dir); - if (dir[0] && pos[-1] != FN_DEVCHAR && access(dir, F_OK)) - { - FILE *fp; - char temp= *(--pos); /* May be "/" or "\" */ - strmov(pos,".sym"); - fp = my_fopen(dir, O_RDONLY,MYF(0)); - *pos++=temp; *pos=0; /* Restore old filename */ - if (fp) - { - if (fgets(buff, sizeof(buff), fp)) - { - for (pos=strend(buff); - pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ; - pos --); - strmake(dir,buff, (uint) (pos-buff)); - } - my_fclose(fp,MYF(0)); - } - } -} -#endif /* USE_SYMDIR */ - /* Unpacks dirname to name that can be used by open... */ /* Make that last char of to is '/' if from not empty and from doesn't end in FN_DEVCHAR */ @@ -261,11 +209,11 @@ uint unpack_dirname(my_string to, const char *from) /* to may be == from */ { uint length,h_length; - char buff[FN_REFLEN+1+4],*suffix,*tilde_expansion; + char buff[FN_REFLEN+1],*suffix,*tilde_expansion; DBUG_ENTER("unpack_dirname"); (void) intern_filename(buff,from); /* Change to intern name */ - length= (uint) strlen(buff); /* Fix that '/' is last */ + length=strlen(buff); /* Fix that '/' is last */ if (length && #ifdef FN_DEVCHAR buff[length-1] != FN_DEVCHAR && @@ -283,7 +231,7 @@ uint unpack_dirname(my_string to, const char *from) if (tilde_expansion) { length-=(uint) (suffix-buff)-1; - if (length+(h_length= (uint) strlen(tilde_expansion)) <= FN_REFLEN) + if (length+(h_length=strlen(tilde_expansion)) <= FN_REFLEN) { if (tilde_expansion[h_length-1] == FN_LIBCHAR) h_length--; @@ -295,10 +243,6 @@ uint unpack_dirname(my_string to, const char *from) } } } -#ifdef USE_SYMDIR - if (my_use_symdir) - symdirget(buff); -#endif DBUG_RETURN(system_filename(to,buff)); /* Fix for open */ } /* unpack_dirname */ diff --git a/ext/mysql/libmysql/mf_path.c b/ext/mysql/libmysql/mf_path.c index f7dcf34e6b..c51a79e238 100644 --- a/ext/mysql/libmysql/mf_path.c +++ b/ext/mysql/libmysql/mf_path.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" #include <m_string.h> @@ -46,7 +32,7 @@ my_string my_path(my_string to, const char *progname, if (!test_if_hard_path(to)) { if (!my_getwd(curr_dir,FN_REFLEN,MYF(0))) - bchange(to,0,curr_dir, (uint) strlen(curr_dir), (uint) strlen(to)+1); + bchange(to,0,curr_dir,strlen(curr_dir),strlen(to)+1); } } else @@ -74,7 +60,7 @@ my_string my_path(my_string to, const char *progname, /* test if file without filename is found in path */ /* Returns to if found and to has dirpart if found, else NullS */ -#if defined(MSDOS) || defined(__WIN__) +#if defined(MSDOS) || defined(__WIN32__) #define F_OK 0 #define PATH_SEP ';' #define PROGRAM_EXTENSION ".exe" @@ -107,7 +93,7 @@ static char *find_file_in_path(char *to, const char *name) } } } -#ifdef __WIN__ +#ifdef __WIN32__ to[0]=FN_CURLIB; strxmov(to+1,dir,name,ext,NullS); if (!access(to,F_OK)) /* Test in current dir */ diff --git a/ext/mysql/libmysql/mf_unixpath.c b/ext/mysql/libmysql/mf_unixpath.c index 6ae29f9913..f28bfb3f23 100644 --- a/ext/mysql/libmysql/mf_unixpath.c +++ b/ext/mysql/libmysql/mf_unixpath.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" #include <m_string.h> diff --git a/ext/mysql/libmysql/mf_wcomp.c b/ext/mysql/libmysql/mf_wcomp.c index 5f1ab9b813..8c9d43a01c 100644 --- a/ext/mysql/libmysql/mf_wcomp.c +++ b/ext/mysql/libmysql/mf_wcomp.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Funktions for comparing with wild-cards */ diff --git a/ext/mysql/libmysql/mulalloc.c b/ext/mysql/libmysql/mulalloc.c index 8a7ee312aa..88cfd33ef5 100644 --- a/ext/mysql/libmysql/mulalloc.c +++ b/ext/mysql/libmysql/mulalloc.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Malloc many pointers at the same time */ /* format myFlags,ptr,length,ptr,length ... until null ptr */ diff --git a/ext/mysql/libmysql/my_alarm.h b/ext/mysql/libmysql/my_alarm.h index b6c5ca6a3f..42e41cc48f 100644 --- a/ext/mysql/libmysql/my_alarm.h +++ b/ext/mysql/libmysql/my_alarm.h @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* File to include when we want to use alarm or a loop_counter to display diff --git a/ext/mysql/libmysql/my_alloc.c b/ext/mysql/libmysql/my_alloc.c index 45fd251668..4dec9115d9 100644 --- a/ext/mysql/libmysql/my_alloc.c +++ b/ext/mysql/libmysql/my_alloc.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Routines to handle mallocing of results which will be freed the same time */ @@ -112,7 +98,7 @@ void free_root(MEM_ROOT *root) char *strdup_root(MEM_ROOT *root,const char *str) { - uint len= (uint) strlen(str)+1; + uint len=strlen(str)+1; char *pos; if ((pos=alloc_root(root,len))) memcpy(pos,str,len); diff --git a/ext/mysql/libmysql/my_compress.c b/ext/mysql/libmysql/my_compress.c index d1e3223413..79d4d2963d 100644 --- a/ext/mysql/libmysql/my_compress.c +++ b/ext/mysql/libmysql/my_compress.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Written by Sinisa Milivojevic <sinisa@coresinc.com> */ diff --git a/ext/mysql/libmysql/my_config.h b/ext/mysql/libmysql/my_config.h index f29ec2572a..f1038d825a 100644 --- a/ext/mysql/libmysql/my_config.h +++ b/ext/mysql/libmysql/my_config.h @@ -1,708 +1 @@ -/* config.h. Generated automatically by configure. */ -/* config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define if using alloca.c. */ -/* #undef C_ALLOCA */ - -/* Define to empty if the keyword does not work. */ -/* #undef const */ - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -/* #undef CRAY_STACKSEG_END */ - -/* Define if you have alloca, as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ -#define HAVE_ALLOCA_H 1 - -/* Define if you don't have vprintf but do have _doprnt. */ -/* #undef HAVE_DOPRNT */ - -/* Define if you have a working `mmap' system call. */ -#define HAVE_MMAP 1 - -/* Define if system calls automatically restart after interruption - by a signal. */ -#define HAVE_RESTARTABLE_SYSCALLS 1 - -/* Define if your struct stat has st_rdev. */ -#define HAVE_ST_RDEV 1 - -/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if you don't have tm_zone but do have the external array - tzname. */ -#define HAVE_TZNAME 1 - -/* Define if utime(file, NULL) sets file's timestamp to the present. */ -#define HAVE_UTIME_NULL 1 - -/* Define if you have the vprintf function. */ -#define HAVE_VPRINTF 1 - -/* Define as __inline if that's what the C compiler calls it. */ -/* #undef inline */ - -/* Define to `long' if <sys/types.h> doesn't define. */ -/* #undef off_t */ - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define to `unsigned' if <sys/types.h> doesn't define. */ -/* #undef size_t */ - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#define STACK_DIRECTION -1 - -/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */ -/* #undef STAT_MACROS_BROKEN */ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if you can safely include both <sys/time.h> and <time.h>. */ -#define TIME_WITH_SYS_TIME 1 - -/* Define if your <sys/time.h> declares struct tm. */ -/* #undef TM_IN_SYS_TIME */ - -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Version of .frm files */ -#define DOT_FRM_VERSION 6 - -/* READLINE: */ -#define FIONREAD_IN_SYS_IOCTL 1 - -/* READLINE: Define if your system defines TIOCGWINSZ in sys/ioctl.h. */ -#define GWINSZ_IN_SYS_IOCTL 1 - -/* Do we have FIONREAD */ -#define FIONREAD_IN_SYS_IOCTL 1 - -/* atomic_add() from <asm/atomic.h> (Linux only) */ -#define HAVE_ATOMIC_ADD 1 - -/* atomic_sub() from <asm/atomic.h> (Linux only) */ -#define HAVE_ATOMIC_SUB 1 - -/* bool is not defined by all C++ compilators */ -#define HAVE_BOOL 1 - -/* Have berkeley db installed */ -/* #undef HAVE_BERKELEY_DB */ - -/* DSB style signals ? */ -/* #undef HAVE_BSD_SIGNALS */ - -/* Can netinet be included */ -/* #undef HAVE_BROKEN_NETINET_INCLUDES */ - -/* READLINE: */ -/* #undef HAVE_BSD_SIGNALS */ - -/* Define if we are using OSF1 DEC threads */ -/* #undef HAVE_DEC_THREADS */ - -/* Define if we are using OSF1 DEC threads on 3.2 */ -/* #undef HAVE_DEC_3_2_THREADS */ - -/* fp_except from ieeefp.h */ -/* #undef HAVE_FP_EXCEPT */ - -/* READLINE: */ -/* #undef HAVE_GETPW_DECLS */ - -/* In OSF 4.0f the 3'd argument to gethostname_r is hostent_data * */ -/* #undef HAVE_GETHOSTBYNAME_R_WITH_HOSTENT_DATA */ - -/* Solaris define gethostbyname_r with 5 arguments. glibc2 defines - this with 6 arguments */ -#define HAVE_GLIBC2_STYLE_GETHOSTBYNAME_R 1 - -/* Define if int8, int16 and int32 types exist */ -/* #undef HAVE_INT_8_16_32 */ - -/* Define if have -lwrap */ -/* #undef HAVE_LIBWRAP */ - -/* Define if we are using Xavier Leroy's LinuxThreads */ -#define HAVE_LINUXTHREADS 1 - -/* Do we use user level threads */ -/* #undef HAVE_mit_thread */ - -/* For some non posix threads */ -/* #undef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC */ - -/* For some non posix threads */ -/* #undef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */ - -/* READLINE: */ -#define HAVE_POSIX_SIGNALS 1 - -/* sigwait with one argument */ -/* #undef HAVE_NONPOSIX_SIGWAIT */ - -/* pthread_attr_setscope */ -#define HAVE_PTHREAD_ATTR_SETSCOPE 1 - -/* POSIX readdir_r */ -#define HAVE_READDIR_R 1 - -/* POSIX sigwait */ -#define HAVE_SIGWAIT 1 - -/* Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines - this with 8 arguments */ -/* #undef HAVE_SOLARIS_STYLE_GETHOST */ - -/* MIT pthreads does not support connecting with unix sockets */ -/* #undef HAVE_THREADS_WITHOUT_SOCKETS */ - -/* Timespec has a ts_sec instead of tv_sev */ -/* #undef HAVE_TIMESPEC_TS_SEC */ - -/* Have the tzname variable */ -#define HAVE_TZNAME 1 - -/* Define if the system files define uchar */ -/* #undef HAVE_UCHAR */ - -/* Define if the system files define uint */ -#define HAVE_UINT 1 - -/* Define if the system files define ulong */ -#define HAVE_ULONG 1 - -/* UNIXWARE7 threads are not posix */ -/* #undef HAVE_UNIXWARE7_THREADS */ - -/* new UNIXWARE7 threads that are not yet posix */ -/* #undef HAVE_UNIXWARE7_POSIX */ - -/* READLINE: */ -/* #undef HAVE_USG_SIGHOLD */ - -/* Define if want -lwrap */ -/* #undef LIBWRAP */ - -/* Define to machine type name eg sun10 */ -#define MACHINE_TYPE "i686" - -/* mysql client protocoll version */ -#define PROTOCOL_VERSION 10 - -/* Define if qsort returns void */ -#define QSORT_TYPE_IS_VOID 1 - -/* Define as the return type of qsort (int or void). */ -#define RETQSORTTYPE void - -/* Size of off_t */ -#define SIZEOF_OFF_T 8 - -/* Define as the base type of the last arg to accept */ -#define SOCKET_SIZE_TYPE socklen_t - -/* #undef SPEED_T_IN_SYS_TYPES */ -/* #undef SPRINTF_RETURNS_PTR */ -#define SPRINTF_RETURNS_INT 1 -/* #undef SPRINTF_RETURNS_GARBAGE */ - -/* #undef STRUCT_DIRENT_HAS_D_FILENO */ -#define STRUCT_DIRENT_HAS_D_INO 1 - -/* Define to name of system eg solaris*/ -#define SYSTEM_TYPE "pc-linux-gnu" - -/* Define if you want to have threaded code. This may be undef on client code */ -#define THREAD 1 - -/* Should be client be thread safe */ -/* #undef THREAD_SAFE_CLIENT */ - -/* READLINE: */ -/* #undef TIOCSTAT_IN_SYS_IOCTL */ - -/* Use multi-byte character routines */ -#define USE_MB 1 -#define USE_MB_IDENT 1 - -/* Use MySQL RAID */ -/* #undef USE_RAID */ - -/* Use strcoll() functions when comparing and sorting. */ -#define USE_STRCOLL 1 - -/* READLINE: */ -#define VOID_SIGHANDLER 1 - -/* The number of bytes in a char. */ -#define SIZEOF_CHAR 1 - -/* The number of bytes in a int. */ -#define SIZEOF_INT 4 - -/* The number of bytes in a long. */ -#define SIZEOF_LONG 4 - -/* The number of bytes in a long long. */ -#define SIZEOF_LONG_LONG 8 - -/* Define if you have the alarm function. */ -#define HAVE_ALARM 1 - -/* Define if you have the atod function. */ -/* #undef HAVE_ATOD */ - -/* Define if you have the bcmp function. */ -#define HAVE_BCMP 1 - -/* Define if you have the bfill function. */ -/* #undef HAVE_BFILL */ - -/* Define if you have the bmove function. */ -/* #undef HAVE_BMOVE */ - -/* Define if you have the bzero function. */ -#define HAVE_BZERO 1 - -/* Define if you have the chsize function. */ -/* #undef HAVE_CHSIZE */ - -/* Define if you have the compress function. */ -#define HAVE_COMPRESS 1 - -/* Define if you have the crypt function. */ -#define HAVE_CRYPT 1 - -/* Define if you have the cuserid function. */ -#define HAVE_CUSERID 1 - -/* Define if you have the dlerror function. */ -#define HAVE_DLERROR 1 - -/* Define if you have the dlopen function. */ -#define HAVE_DLOPEN 1 - -/* Define if you have the fchmod function. */ -#define HAVE_FCHMOD 1 - -/* Define if you have the fcntl function. */ -#define HAVE_FCNTL 1 - -/* Define if you have the fconvert function. */ -/* #undef HAVE_FCONVERT */ - -/* Define if you have the finite function. */ -#define HAVE_FINITE 1 - -/* Define if you have the fpresetsticky function. */ -/* #undef HAVE_FPRESETSTICKY */ - -/* Define if you have the fpsetmask function. */ -/* #undef HAVE_FPSETMASK */ - -/* Define if you have the fseeko function. */ -#define HAVE_FSEEKO 1 - -/* Define if you have the ftruncate function. */ -#define HAVE_FTRUNCATE 1 - -/* Define if you have the getcwd function. */ -#define HAVE_GETCWD 1 - -/* Define if you have the gethostbyaddr_r function. */ -#define HAVE_GETHOSTBYADDR_R 1 - -/* Define if you have the gethostbyname_r function. */ -#define HAVE_GETHOSTBYNAME_R 1 - -/* Define if you have the getpagesize function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define if you have the getpass function. */ -#define HAVE_GETPASS 1 - -/* Define if you have the getpassphrase function. */ -/* #undef HAVE_GETPASSPHRASE */ - -/* Define if you have the getpwnam function. */ -#define HAVE_GETPWNAM 1 - -/* Define if you have the getpwuid function. */ -#define HAVE_GETPWUID 1 - -/* Define if you have the getrlimit function. */ -#define HAVE_GETRLIMIT 1 - -/* Define if you have the getrusage function. */ -#define HAVE_GETRUSAGE 1 - -/* Define if you have the getwd function. */ -#define HAVE_GETWD 1 - -/* Define if you have the index function. */ -#define HAVE_INDEX 1 - -/* Define if you have the initgroups function. */ -#define HAVE_INITGROUPS 1 - -/* Define if you have the localtime_r function. */ -#define HAVE_LOCALTIME_R 1 - -/* Define if you have the locking function. */ -/* #undef HAVE_LOCKING */ - -/* Define if you have the longjmp function. */ -#define HAVE_LONGJMP 1 - -/* Define if you have the lrand48 function. */ -#define HAVE_LRAND48 1 - -/* Define if you have the lstat function. */ -#define HAVE_LSTAT 1 - -/* Define if you have the madvise function. */ -/* #undef HAVE_MADVISE */ - -/* Define if you have the memcpy function. */ -#define HAVE_MEMCPY 1 - -/* Define if you have the memmove function. */ -#define HAVE_MEMMOVE 1 - -/* Define if you have the perror function. */ -#define HAVE_PERROR 1 - -/* Define if you have the pread function. */ -#define HAVE_PREAD 1 - -/* Define if you have the pthread_attr_create function. */ -/* #undef HAVE_PTHREAD_ATTR_CREATE */ - -/* Define if you have the pthread_attr_setprio function. */ -/* #undef HAVE_PTHREAD_ATTR_SETPRIO */ - -/* Define if you have the pthread_attr_setschedparam function. */ -#define HAVE_PTHREAD_ATTR_SETSCHEDPARAM 1 - -/* Define if you have the pthread_attr_setstacksize function. */ -#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 - -/* Define if you have the pthread_condattr_create function. */ -/* #undef HAVE_PTHREAD_CONDATTR_CREATE */ - -/* Define if you have the pthread_getsequence_np function. */ -/* #undef HAVE_PTHREAD_GETSEQUENCE_NP */ - -/* Define if you have the pthread_init function. */ -/* #undef HAVE_PTHREAD_INIT */ - -/* Define if you have the pthread_rwlock_rdlock function. */ -#define HAVE_PTHREAD_RWLOCK_RDLOCK 1 - -/* Define if you have the pthread_setprio function. */ -/* #undef HAVE_PTHREAD_SETPRIO */ - -/* Define if you have the pthread_setprio_np function. */ -/* #undef HAVE_PTHREAD_SETPRIO_NP */ - -/* Define if you have the pthread_setschedparam function. */ -#define HAVE_PTHREAD_SETSCHEDPARAM 1 - -/* Define if you have the pthread_sigmask function. */ -#define HAVE_PTHREAD_SIGMASK 1 - -/* Define if you have the putenv function. */ -#define HAVE_PUTENV 1 - -/* Define if you have the realpath function. */ -#define HAVE_REALPATH 1 - -/* Define if you have the rename function. */ -#define HAVE_RENAME 1 - -/* Define if you have the rint function. */ -#define HAVE_RINT 1 - -/* Define if you have the rwlock_init function. */ -/* #undef HAVE_RWLOCK_INIT */ - -/* Define if you have the select function. */ -#define HAVE_SELECT 1 - -/* Define if you have the setenv function. */ -#define HAVE_SETENV 1 - -/* Define if you have the setlocale function. */ -#define HAVE_SETLOCALE 1 - -/* Define if you have the setupterm function. */ -/* #undef HAVE_SETUPTERM */ - -/* Define if you have the sighold function. */ -#define HAVE_SIGHOLD 1 - -/* Define if you have the sigset function. */ -#define HAVE_SIGSET 1 - -/* Define if you have the sigthreadmask function. */ -/* #undef HAVE_SIGTHREADMASK */ - -/* Define if you have the snprintf function. */ -#define HAVE_SNPRINTF 1 - -/* Define if you have the socket function. */ -#define HAVE_SOCKET 1 - -/* Define if you have the stpcpy function. */ -#define HAVE_STPCPY 1 - -/* Define if you have the strcasecmp function. */ -#define HAVE_STRCASECMP 1 - -/* Define if you have the strcoll function. */ -#define HAVE_STRCOLL 1 - -/* Define if you have the strerror function. */ -#define HAVE_STRERROR 1 - -/* Define if you have the strnlen function. */ -#define HAVE_STRNLEN 1 - -/* Define if you have the strpbrk function. */ -#define HAVE_STRPBRK 1 - -/* Define if you have the strstr function. */ -#define HAVE_STRSTR 1 - -/* Define if you have the strtok_r function. */ -#define HAVE_STRTOK_R 1 - -/* Define if you have the strtoul function. */ -#define HAVE_STRTOUL 1 - -/* Define if you have the strtoull function. */ -#define HAVE_STRTOULL 1 - -/* Define if you have the tcgetattr function. */ -#define HAVE_TCGETATTR 1 - -/* Define if you have the tell function. */ -/* #undef HAVE_TELL */ - -/* Define if you have the tempnam function. */ -#define HAVE_TEMPNAM 1 - -/* Define if you have the thr_setconcurrency function. */ -/* #undef HAVE_THR_SETCONCURRENCY */ - -/* Define if you have the vidattr function. */ -/* #undef HAVE_VIDATTR */ - -/* Define if you have the <alloca.h> header file. */ -#define HAVE_ALLOCA_H 1 - -/* Define if you have the <arpa/inet.h> header file. */ -#define HAVE_ARPA_INET_H 1 - -/* Define if you have the <asm/termbits.h> header file. */ -#define HAVE_ASM_TERMBITS_H 1 - -/* Define if you have the <crypt.h> header file. */ -#define HAVE_CRYPT_H 1 - -/* Define if you have the <curses.h> header file. */ -#define HAVE_CURSES_H 1 - -/* Define if you have the <dirent.h> header file. */ -#define HAVE_DIRENT_H 1 - -/* Define if you have the <fcntl.h> header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the <float.h> header file. */ -#define HAVE_FLOAT_H 1 - -/* Define if you have the <floatingpoint.h> header file. */ -/* #undef HAVE_FLOATINGPOINT_H */ - -/* Define if you have the <grp.h> header file. */ -#define HAVE_GRP_H 1 - -/* Define if you have the <ieeefp.h> header file. */ -/* #undef HAVE_IEEEFP_H */ - -/* Define if you have the <limits.h> header file. */ -#define HAVE_LIMITS_H 1 - -/* Define if you have the <locale.h> header file. */ -#define HAVE_LOCALE_H 1 - -/* Define if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Define if you have the <ndir.h> header file. */ -/* #undef HAVE_NDIR_H */ - -/* Define if you have the <netinet/in.h> header file. */ -#define HAVE_NETINET_IN_H 1 - -/* Define if you have the <pwd.h> header file. */ -#define HAVE_PWD_H 1 - -/* Define if you have the <sched.h> header file. */ -#define HAVE_SCHED_H 1 - -/* Define if you have the <select.h> header file. */ -/* #undef HAVE_SELECT_H */ - -/* Define if you have the <stdarg.h> header file. */ -#define HAVE_STDARG_H 1 - -/* Define if you have the <stddef.h> header file. */ -#define HAVE_STDDEF_H 1 - -/* Define if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define if you have the <synch.h> header file. */ -/* #undef HAVE_SYNCH_H */ - -/* Define if you have the <sys/dir.h> header file. */ -#define HAVE_SYS_DIR_H 1 - -/* Define if you have the <sys/file.h> header file. */ -#define HAVE_SYS_FILE_H 1 - -/* Define if you have the <sys/mman.h> header file. */ -#define HAVE_SYS_MMAN_H 1 - -/* Define if you have the <sys/ndir.h> header file. */ -/* #undef HAVE_SYS_NDIR_H */ - -/* Define if you have the <sys/pte.h> header file. */ -/* #undef HAVE_SYS_PTE_H */ - -/* Define if you have the <sys/ptem.h> header file. */ -/* #undef HAVE_SYS_PTEM_H */ - -/* Define if you have the <sys/select.h> header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define if you have the <sys/socket.h> header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define if you have the <sys/stream.h> header file. */ -/* #undef HAVE_SYS_STREAM_H */ - -/* Define if you have the <sys/timeb.h> header file. */ -#define HAVE_SYS_TIMEB_H 1 - -/* Define if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define if you have the <sys/un.h> header file. */ -#define HAVE_SYS_UN_H 1 - -/* Define if you have the <sys/utime.h> header file. */ -/* #undef HAVE_SYS_UTIME_H */ - -/* Define if you have the <sys/vadvise.h> header file. */ -/* #undef HAVE_SYS_VADVISE_H */ - -/* Define if you have the <sys/wait.h> header file. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if you have the <term.h> header file. */ -#define HAVE_TERM_H 1 - -/* Define if you have the <termbits.h> header file. */ -/* #undef HAVE_TERMBITS_H */ - -/* Define if you have the <termcap.h> header file. */ -#define HAVE_TERMCAP_H 1 - -/* Define if you have the <termio.h> header file. */ -#define HAVE_TERMIO_H 1 - -/* Define if you have the <termios.h> header file. */ -#define HAVE_TERMIOS_H 1 - -/* Define if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if you have the <utime.h> header file. */ -#define HAVE_UTIME_H 1 - -/* Define if you have the <varargs.h> header file. */ -#define HAVE_VARARGS_H 1 - -/* Define if you have the bind library (-lbind). */ -/* #undef HAVE_LIBBIND */ - -/* Define if you have the c_r library (-lc_r). */ -/* #undef HAVE_LIBC_R */ - -/* Define if you have the compat library (-lcompat). */ -/* #undef HAVE_LIBCOMPAT */ - -/* Define if you have the crypt library (-lcrypt). */ -#define HAVE_LIBCRYPT 1 - -/* Define if you have the dl library (-ldl). */ -#define HAVE_LIBDL 1 - -/* Define if you have the gen library (-lgen). */ -/* #undef HAVE_LIBGEN */ - -/* Define if you have the m library (-lm). */ -#define HAVE_LIBM 1 - -/* Define if you have the nsl library (-lnsl). */ -#define HAVE_LIBNSL 1 - -/* Define if you have the nsl_r library (-lnsl_r). */ -/* #undef HAVE_LIBNSL_R */ - -/* Define if you have the pthread library (-lpthread). */ -#define HAVE_LIBPTHREAD 1 - -/* Define if you have the socket library (-lsocket). */ -/* #undef HAVE_LIBSOCKET */ - -/* Name of package */ -#define PACKAGE "mysql" - -/* Version number of package */ -#define VERSION "3.23.22-beta" - -/* Number of bits in a file offset, on hosts where this is settable. */ -#define _FILE_OFFSET_BITS 64 - -/* Define to make fseeko etc. visible, on some hosts. */ -/* #undef _LARGEFILE_SOURCE */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - +#include "php_config.h" diff --git a/ext/mysql/libmysql/my_create.c b/ext/mysql/libmysql/my_create.c index 866c0dfd46..d227140b09 100644 --- a/ext/mysql/libmysql/my_create.c +++ b/ext/mysql/libmysql/my_create.c @@ -1,26 +1,12 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #define USES_TYPES #include "mysys_priv.h" #include <my_dir.h> #include "mysys_err.h" #include <errno.h> -#if defined(MSDOS) || defined(__WIN__) +#if defined(MSDOS) || defined(__WIN32__) #include <share.h> #endif @@ -48,7 +34,7 @@ File my_create(const char *FileName, int CreateFlags, int access_flags, #elif defined(VMS) fd = open((my_string) FileName, access_flags | O_CREAT, 0, "ctx=stm","ctx=bin"); -#elif defined(MSDOS) || defined(__WIN__) +#elif defined(MSDOS) || defined(__WIN32__) if (access_flags & O_SHARE) fd = sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY, SH_DENYNO, MY_S_IREAD | MY_S_IWRITE); @@ -62,15 +48,11 @@ File my_create(const char *FileName, int CreateFlags, int access_flags, if (fd >= 0) { if ((int) fd >= MY_NFILE) - { - DBUG_PRINT("exit",("fd: %d",fd)); DBUG_RETURN(fd); /* safeguard */ - } if ((my_file_info[fd].name = (char*) my_strdup(FileName,MyFlags))) { my_file_opened++; my_file_info[fd].type = FILE_BY_CREATE; - DBUG_PRINT("exit",("fd: %d",fd)); DBUG_RETURN(fd); } VOID(my_close(fd,MyFlags)); diff --git a/ext/mysql/libmysql/my_delete.c b/ext/mysql/libmysql/my_delete.c index 77d5f31141..b29631b90a 100644 --- a/ext/mysql/libmysql/my_delete.c +++ b/ext/mysql/libmysql/my_delete.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" diff --git a/ext/mysql/libmysql/my_dir.h b/ext/mysql/libmysql/my_dir.h index 1961ca7954..0fdd5a148e 100644 --- a/ext/mysql/libmysql/my_dir.h +++ b/ext/mysql/libmysql/my_dir.h @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #ifndef _my_dir_h #define _my_dir_h @@ -90,7 +76,6 @@ typedef struct st_my_dir /* Struct returned from my_dir */ extern MY_DIR *my_dir(const char *path,myf MyFlags); extern void my_dirend(MY_DIR *buffer); extern MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags); -extern int my_fstat(int filenr, MY_STAT *stat_area, myf MyFlags); #endif /* MY_DIR_H */ diff --git a/ext/mysql/libmysql/my_div.c b/ext/mysql/libmysql/my_div.c index 2479467937..9650b28136 100644 --- a/ext/mysql/libmysql/my_div.c +++ b/ext/mysql/libmysql/my_div.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" diff --git a/ext/mysql/libmysql/my_error.c b/ext/mysql/libmysql/my_error.c index 26510f0848..aeef85dbd4 100644 --- a/ext/mysql/libmysql/my_error.c +++ b/ext/mysql/libmysql/my_error.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" #include "mysys_err.h" @@ -53,7 +39,6 @@ int my_error(int nr,myf MyFlags, ...) if (tpos[0] != '%') { *endpos++= *tpos++; /* Copy ordinary char */ - olen++; continue; } if (*++tpos == '%') /* test if %% */ @@ -81,10 +66,8 @@ int my_error(int nr,myf MyFlags, ...) { register int iarg; iarg = va_arg(ap, int); - if (*tpos == 'd') - plen= (uint) (int2str((long) iarg,endpos, -10) - endpos); - else - plen= (uint) (int2str((long) (uint) iarg,endpos,10)- endpos); + plen= (uint) (int2str((long) iarg,endpos,*tpos == 'd' ? -10 : 10)- + endpos); if (olen + plen < ERRMSGSIZE+2) /* Replace parameter if possible */ { endpos+=plen; diff --git a/ext/mysql/libmysql/my_fopen.c b/ext/mysql/libmysql/my_fopen.c index b2e9951879..f22f492b4f 100644 --- a/ext/mysql/libmysql/my_fopen.c +++ b/ext/mysql/libmysql/my_fopen.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" #include "my_static.h" @@ -63,8 +49,7 @@ FILE *my_fopen(const char *FileName, int Flags, myf MyFlags) my_errno=errno; DBUG_PRINT("error",("Got error %d on open",my_errno)); if (MyFlags & (MY_FFNF | MY_FAE | MY_WME)) - my_error((Flags & O_RDONLY) || (Flags == O_RDONLY ) ? EE_FILENOTFOUND : - EE_CANTCREATEFILE, + my_error(Flags & O_RDONLY ? EE_FILENOTFOUND : EE_CANTCREATEFILE, MYF(ME_BELL+ME_WAITTANG), FileName,my_errno); DBUG_RETURN((FILE*) 0); } /* my_fopen */ diff --git a/ext/mysql/libmysql/my_getwd.c b/ext/mysql/libmysql/my_getwd.c index 3d67427673..0267a3eaa6 100644 --- a/ext/mysql/libmysql/my_getwd.c +++ b/ext/mysql/libmysql/my_getwd.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* my_setwd() and my_getwd() works with intern_filenames !! */ @@ -23,7 +9,7 @@ #ifdef HAVE_GETWD #include <sys/param.h> #endif -#if defined(MSDOS) || defined(__WIN__) +#if defined(MSDOS) || defined(__WIN32__) #include <m_ctype.h> #include <dos.h> #include <direct.h> diff --git a/ext/mysql/libmysql/my_init.c b/ext/mysql/libmysql/my_init.c index 912e80d9eb..db45d991d3 100644 --- a/ext/mysql/libmysql/my_init.c +++ b/ext/mysql/libmysql/my_init.c @@ -1,26 +1,10 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" #include "my_static.h" #include "mysys_err.h" -#include "m_ctype.h" #include <m_string.h> -#include <m_ctype.h> #ifdef THREAD #include <my_pthread.h> #endif @@ -33,7 +17,7 @@ #include <my_static.c> #include <m_ctype.h> #endif -#ifdef __WIN__ +#ifdef __WIN32__ #ifdef _MSC_VER #include <locale.h> #include <crtdbg.h> @@ -60,7 +44,7 @@ void my_init(void) pthread_init(); /* Must be called before DBUG_ENTER */ #endif my_thread_global_init(); -#ifndef __WIN__ +#ifndef __WIN32__ sigfillset(&my_signals); /* signals blocked by mf_brkhant */ #endif #endif @@ -75,15 +59,13 @@ void my_init(void) #ifndef VMS if ((str=getenv("UMASK")) != 0) my_umask=atoi(str) | 0600; /* Default creation of new files */ - if ((str=getenv("UMASK_DIR")) != 0) - my_umask_dir=atoi(str) | 0700; /* Default creation of new dir's */ #endif #ifdef VMS init_ctype(); /* Stupid linker don't link _ctype.c */ #endif DBUG_PRINT("exit",("home: '%s'",home_dir)); } -#ifdef __WIN__ +#ifdef __WIN32__ win32_init_tcp_ip(); #endif DBUG_VOID_RETURN; @@ -112,7 +94,7 @@ void my_end(int infoflag) #ifdef HAVE_GETRUSAGE struct rusage rus; if (!getrusage(RUSAGE_SELF, &rus)) - fprintf(info_file,"\nUser time %.2f, System time %.2f\nMaximum resident set size %ld, Integral resident set size %ld\nNon physical pagefaults %ld, Physical pagefaults %ld, Swaps %ld\nBlocks in %ld out %ld, Messages in %ld out %ld, Signals %ld\nVouluntary context switches %ld, Invouluntary context switches %ld\n", + fprintf(info_file,"\nUser time %.2f, System time %.2f\nMaximum resident set size %d, Integral resident set size %d\nNon physical pagefaults %d, Physical pagefaults %d, Swaps %d\nBlocks in %d out %d, Messages in %d out %d, Signals %d\nVouluntary context switches %d, Invouluntary context switches %d\n", (rus.ru_utime.tv_sec * SCALE_SEC + rus.ru_utime.tv_usec / SCALE_USEC) / 100.0, (rus.ru_stime.tv_sec * SCALE_SEC + @@ -123,13 +105,12 @@ void my_end(int infoflag) rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals, rus.ru_nvcsw, rus.ru_nivcsw); #endif -#if defined(MSDOS) && !defined(__WIN__) +#if defined(MSDOS) && !defined(__WIN32__) fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC); #endif - free_charsets(); #if defined(SAFEMALLOC) TERMINATE(stderr); /* Give statistic on screen */ -#elif defined(__WIN__) && defined(_MSC_VER) +#elif defined(__WIN32__) && defined(_MSC_VER) _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR ); _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE ); @@ -148,13 +129,13 @@ void my_end(int infoflag) my_thread_end(); my_thread_global_end(); #endif -#ifdef __WIN__ +#ifdef __WIN32__ if (have_tcpip); WSACleanup( ); -#endif /* __WIN__ */ +#endif /* __WIN32__ */ } /* my_end */ -#ifdef __WIN__ +#ifdef __WIN32__ /* This code is specially for running MySQL, but it should work in diff --git a/ext/mysql/libmysql/my_list.h b/ext/mysql/libmysql/my_list.h index 7391db70e2..d5a28ac139 100644 --- a/ext/mysql/libmysql/my_list.h +++ b/ext/mysql/libmysql/my_list.h @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #ifndef _list_h_ #define _list_h_ diff --git a/ext/mysql/libmysql/my_malloc.c b/ext/mysql/libmysql/my_malloc.c index 6cae6fe3a4..ca44ae4f64 100644 --- a/ext/mysql/libmysql/my_malloc.c +++ b/ext/mysql/libmysql/my_malloc.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */ #undef SAFEMALLOC diff --git a/ext/mysql/libmysql/my_messnc.c b/ext/mysql/libmysql/my_messnc.c index 0dd3be5ba9..96d90af343 100644 --- a/ext/mysql/libmysql/my_messnc.c +++ b/ext/mysql/libmysql/my_messnc.c @@ -1,23 +1,9 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" -int my_message_no_curses(uint error __attribute__((unused)), +int my_message_no_curses(uint my_error __attribute__((unused)), const char *str, myf MyFlags) { DBUG_ENTER("my_message_no_curses"); diff --git a/ext/mysql/libmysql/my_net.c b/ext/mysql/libmysql/my_net.c index 1c91f7ff80..9fb47c50f9 100644 --- a/ext/mysql/libmysql/my_net.c +++ b/ext/mysql/libmysql/my_net.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 2000 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* thread safe version of some common functions */ @@ -21,18 +7,12 @@ #include <m_string.h> /* for thread safe my_inet_ntoa */ -#if !defined(MSDOS) && !defined(__WIN__) +#if !defined(MSDOS) && !defined(__WIN32__) #include <netdb.h> -#ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> -#endif -#ifdef HAVE_NETINET_IN_H #include <netinet/in.h> -#endif -#ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> -#endif -#endif /* !defined(MSDOS) && !defined(__WIN__) */ +#endif #ifndef THREAD #define pthread_mutex_lock(A) diff --git a/ext/mysql/libmysql/my_net.h b/ext/mysql/libmysql/my_net.h index a02a564c52..ac4af6595b 100644 --- a/ext/mysql/libmysql/my_net.h +++ b/ext/mysql/libmysql/my_net.h @@ -1,33 +1,10 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - /* thread safe version of some common functions */ /* for thread safe my_inet_ntoa */ -#if !defined(MSDOS) && !defined(__WIN__) && !defined(__BEOS__) -#ifdef HAVE_SYS_SOCKET_H +#if !defined(MSDOS) && !defined(__WIN32__) #include <sys/socket.h> -#endif -#ifdef HAVE_NETINET_IN_H #include <netinet/in.h> -#endif -#ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> -#endif -#endif /* !defined(MSDOS) && !defined(__WIN__) */ +#endif void my_inet_ntoa(struct in_addr in, char *buf); diff --git a/ext/mysql/libmysql/my_once.c b/ext/mysql/libmysql/my_once.c index 0b8b5addc1..b03f4df529 100644 --- a/ext/mysql/libmysql/my_once.c +++ b/ext/mysql/libmysql/my_once.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Not MT-SAFE */ diff --git a/ext/mysql/libmysql/my_open.c b/ext/mysql/libmysql/my_open.c index ef1db41e3f..10ddb95388 100644 --- a/ext/mysql/libmysql/my_open.c +++ b/ext/mysql/libmysql/my_open.c @@ -1,25 +1,11 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #define USES_TYPES #include "mysys_priv.h" #include "mysys_err.h" #include <errno.h> -#if defined(MSDOS) || defined(__WIN__) +#if defined(MSDOS) || defined(__WIN32__) #include <share.h> #endif @@ -34,7 +20,7 @@ File my_open(const char *FileName, int Flags, myf MyFlags) DBUG_ENTER("my_open"); DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d", FileName, Flags, MyFlags)); -#if defined(MSDOS) || defined(__WIN__) +#if defined(MSDOS) || defined(__WIN32__) if (Flags & O_SHARE) fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO); else @@ -86,7 +72,7 @@ int my_close(File fd, myf MyFlags) if (MyFlags & (MY_FAE | MY_WME)) my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG),my_filename(fd),errno); } - if ((uint) fd < MY_NFILE && my_file_info[fd].type != UNOPEN) + if (fd < MY_NFILE && my_file_info[fd].type != UNOPEN) { my_file_opened--; my_free(my_file_info[fd].name, MYF(0)); diff --git a/ext/mysql/libmysql/my_pthread.c b/ext/mysql/libmysql/my_pthread.c index b2445bfa36..2110437a16 100644 --- a/ext/mysql/libmysql/my_pthread.c +++ b/ext/mysql/libmysql/my_pthread.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Functions to get threads more portable */ @@ -23,7 +9,7 @@ #include <m_string.h> #include <thr_alarm.h> #include <assert.h> -#if !defined(MSDOS) && !defined(__WIN__) +#if !defined(MSDOS) && !defined(__WIN32__) #include <netdb.h> #endif @@ -100,7 +86,7 @@ int my_pthread_create_detached=1; #if defined(HAVE_NONPOSIX_SIGWAIT) || defined(HAVE_DEC_3_2_THREADS) -int my_sigwait(const sigset_t *set,int *sig) +int my_sigwait(sigset_t *set,int *sig) { int signal=sigwait(set); if (signal < 0) @@ -121,7 +107,7 @@ struct tm *localtime_r(const time_t *clock, struct tm *res) struct tm *tmp; pthread_mutex_lock(&LOCK_localtime_r); tmp=localtime(clock); - *res= *tmp; + memcpy(res,tmp,sizeof(*tmp)); pthread_mutex_unlock(&LOCK_localtime_r); return res; } @@ -145,7 +131,7 @@ struct tm *localtime_r(const time_t *clock, struct tm *res) ** Author: Gary Wisniewski <garyw@spidereye.com.au>, much modified by Monty ****************************************************************************/ -#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) +#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(sigwait) && !defined(__WIN32__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) #if !defined(DONT_USE_SIGSUSPEND) @@ -165,7 +151,7 @@ void sigwait_setup(sigset_t *set) sact.sa_flags = 0; sact.sa_handler = px_handle_sig; - memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */ + memcpy(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */ sigemptyset(&unblock_mask); pthread_sigmask(SIG_UNBLOCK,(sigset_t*) 0,&rev_sigwait_set); @@ -191,7 +177,7 @@ void sigwait_setup(sigset_t *set) } } } - memcpy_fixed(&sigwait_set,set,sizeof(*set)); + memcpy(&sigwait_set,set,sizeof(*set)); pthread_sigmask(SIG_BLOCK,(sigset_t*) set,(sigset_t*) 0); pthread_sigmask(SIG_UNBLOCK,&unblock_mask,(sigset_t*) 0); } @@ -281,7 +267,7 @@ void *sigwait_thread(void *set_arg) struct sigaction sact; sact.sa_flags = 0; sact.sa_handler = sigwait_handle_sig; - memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */ + memcpy(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */ sigemptyset(&pending_set); for (i = 1; i <= sizeof(pending_set)*8; i++) @@ -320,7 +306,7 @@ int sigwait(sigset_t *setp, int *sigp) pthread_cond_init(&COND_sigwait,NULL); pthread_attr_init(&thr_attr); - pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS); + pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_SYSTEM); pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); pthread_attr_setstacksize(&thr_attr,8196); my_pthread_attr_setprio(&thr_attr,100); /* Very high priority */ diff --git a/ext/mysql/libmysql/my_pthread.h b/ext/mysql/libmysql/my_pthread.h index b7034ee0f5..ad64c59a50 100644 --- a/ext/mysql/libmysql/my_pthread.h +++ b/ext/mysql/libmysql/my_pthread.h @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1999 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Defines to make different thread packages compatible */ @@ -25,7 +11,7 @@ #define ETIME ETIMEDOUT /* For FreeBSD */ #endif -#if defined(__WIN__) +#if defined(__WIN32__) typedef CRITICAL_SECTION pthread_mutex_t; typedef HANDLE pthread_t; @@ -169,7 +155,7 @@ void * my_pthread_getspecific_imp(pthread_key_t key); #define pthread_sigmask(A,B,C) thr_sigsetmask((A),(B),(C)) -extern int my_sigwait(const sigset_t *set,int *sig); +extern int my_sigwait(sigset_t *set,int *sig); #define pthread_detach_this_thread() pthread_dummy(0) @@ -199,9 +185,6 @@ extern int my_sigwait(const sigset_t *set,int *sig); #ifdef HAVE_SCHED_H #include <sched.h> #endif -#ifdef HAVE_SYNCH_H -#include <synch.h> -#endif #if defined(__EMX__) && (!defined(EMX_PTHREAD_REV) || (EMX_PTHREAD_REV < 2)) #error Requires at least rev 2 of EMX pthreads library. #endif @@ -228,9 +211,8 @@ typedef struct st_safe_mutex_t int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr); int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line); int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line); -int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line); -int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file, - uint line); +int safe_mutex_destroy(safe_mutex_t *mp); +int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file, uint line); int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, struct timespec *abstime, const char *file, uint line); @@ -245,7 +227,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, #define pthread_mutex_init(A,B) safe_mutex_init((A),(B)) #define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__) #define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__) -#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__) +#define pthread_mutex_destroy(A) safe_mutex_destroy((A)) #define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__) #define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__) #define pthread_mutex_t safe_mutex_t @@ -267,11 +249,8 @@ extern int my_pthread_create_detached; #define HAVE_LOCALTIME_R #undef HAVE_PTHREAD_ATTR_SETSCOPE #define HAVE_PTHREAD_ATTR_SETSCOPE -#undef HAVE_GLIBC2_STYLE_GETHOSTBYNAME_R /* If we are running linux */ #undef HAVE_RWLOCK_T #undef HAVE_RWLOCK_INIT -#undef HAVE_PTHREAD_RWLOCK_RDLOCK -#undef HAVE_SNPRINTF #define sigset(A,B) pthread_signal((A),(void (*)(int)) (B)) #define signal(A,B) pthread_signal((A),(void (*)(int)) (B)) @@ -309,16 +288,10 @@ extern int my_pthread_cond_init(pthread_cond_t *mp, #endif #if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX) -int sigwait(const sigset_t *setp, int *sigp); /* Use our implemention */ +int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */ #endif #if !defined(HAVE_SIGSET) && !defined(HAVE_mit_thread) && !defined(sigset) -#define sigset(A,B) do { struct sigaction s; sigset_t set; \ - sigemptyset(&set); \ - s.sa_handler = (B); \ - s.sa_mask = set; \ - s.sa_flags = 0; \ - sigaction((A), &s, (struct sigaction *) NULL); \ - } while (0) +#define sigset(A,B) signal((A),(B)) #endif #ifndef my_pthread_setprio @@ -365,7 +338,6 @@ struct tm *localtime_r(const time_t *clock, struct tm *res); #define pthread_cond_destroy(A) pthread_dummy(0) #define pthread_mutex_destroy(A) pthread_dummy(0) #define pthread_attr_delete(A) pthread_dummy(0) -#define pthread_condattr_delete(A) pthread_dummy(0) #define pthread_attr_setstacksize(A,B) pthread_dummy(0) #define pthread_equal(A,B) ((A) == (B)) #define pthread_cond_timedwait(a,b,c) pthread_cond_wait((a),(b)) @@ -413,19 +385,14 @@ struct hostent *my_gethostbyname_r(const char *name, #endif /* defined(HAVE_GLIBC2_STYLE_GETHOSTBYNAME_R) */ #else -#ifdef HAVE_GETHOSTBYNAME_R_WITH_HOSTENT_DATA -#define GETHOSTBYNAME_BUFF_SIZE sizeof(hostent_data) -#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(hostent_data*) (C)) -#else -#define GETHOSTBYNAME_BUFF_SIZE 2048 #define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E)) -#endif /* HAVE_GETHOSTBYNAME_R_WITH_HOSTENT_DATA */ +#define GETHOSTBYNAME_BUFF_SIZE 2048 #endif /* defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GLIBC2_STYLE_GETHOSTBYNAME_R) */ -#endif /* defined(__WIN__) */ +#endif /* defined(__WIN32__) */ /* READ-WRITE thread locking */ - +#ifndef HAVE_RWLOCK_INIT #if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS) /* use these defs for simple mutex locking */ #define rw_lock_t pthread_mutex_t @@ -441,13 +408,7 @@ struct hostent *my_gethostbyname_r(const char *name, #define rw_wrlock(A) pthread_rwlock_wrlock(A) #define rw_unlock(A) pthread_rwlock_unlock(A) #define rwlock_destroy(A) pthread_rwlock_destroy(A) -#elif defined(HAVE_RWLOCK_INIT) -#ifdef HAVE_RWLOCK_T /* For example Solaris 2.6-> */ -#define rw_lock_t rwlock_t -#endif -#define my_rwlock_init(A,B) rwlock_init((A),USYNC_THREAD,0) #else -/* Use our own version of read/write locks */ typedef struct _my_rw_lock_t { pthread_mutex_t lock; /* lock for structure */ pthread_cond_t readers; /* waiting readers */ @@ -462,12 +423,18 @@ typedef struct _my_rw_lock_t { #define rw_unlock(A) my_rw_unlock((A)) #define rwlock_destroy(A) my_rwlock_destroy((A)) -extern int my_rwlock_init( my_rw_lock_t *, void * ); -extern int my_rwlock_destroy( my_rw_lock_t * ); -extern int my_rw_rdlock( my_rw_lock_t * ); -extern int my_rw_wrlock( my_rw_lock_t * ); -extern int my_rw_unlock( my_rw_lock_t * ); +extern int my_rwlock_init( rw_lock_t *, void * ); +extern int my_rwlock_destroy( rw_lock_t * ); +extern int my_rw_rdlock( rw_lock_t * ); +extern int my_rw_wrlock( rw_lock_t * ); +extern int my_rw_unlock( rw_lock_t * ); #endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */ +#else +#ifdef HAVE_RWLOCK_T /* For example Solaris 2.6-> */ +#define rw_lock_t rwlock_t +#define my_rwlock_init(A,B) rwlock_init((A),USYNC_THREAD,0) +#endif +#endif /* HAVE_RWLOCK_INIT */ #define GETHOSTBYADDR_BUFF_SIZE 2048 @@ -510,29 +477,18 @@ extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const)); #define my_thread_var (_my_thread_var()) #define my_errno my_thread_var->thr_errno - /* statistics_xxx functions are for not essential statistic */ + /* This is only used for not essential statistic */ #ifndef thread_safe_increment -#ifdef HAVE_ATOMIC_ADD -#define thread_safe_increment(V,L) atomic_add(1,(atomic_t*) &V); -#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V); -#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V); -#define statistic_increment(V,L) thread_safe_increment((V),(L)) -#define statistic_add(V,C,L) thread_safe_add((V),(C),(L)) -#else +#ifdef SAFE_STATISTICS #define thread_safe_increment(V,L) \ pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L)); #define thread_safe_add(V,C,L) \ pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L)); -#define thread_safe_sub(V,C,L) \ - pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L)); -#ifdef SAFE_STATISTICS -#define statistic_increment(V,L) thread_safe_increment((V),(L)) -#define statistic_add(V,C,L) thread_safe_add((V),(C),(L)) #else -#define statistic_increment(V,L) (V)++ -#define statistic_add(V,C,L) (V)+=(C) -#endif /* SAFE_STATISTICS */ -#endif /* HAVE_ATOMIC_ADD */ +#define thread_safe_increment(V,L) (V)++ +#define thread_safe_add(V,C,L) (V)+=(C) +#endif #endif /* thread_safe_increment */ + #endif /* _my_ptread_h */ diff --git a/ext/mysql/libmysql/my_read.c b/ext/mysql/libmysql/my_read.c index b317630f4b..b112927a3e 100644 --- a/ext/mysql/libmysql/my_read.c +++ b/ext/mysql/libmysql/my_read.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" #include "mysys_err.h" diff --git a/ext/mysql/libmysql/my_realloc.c b/ext/mysql/libmysql/my_realloc.c index c9d8edd6dd..1d26140b01 100644 --- a/ext/mysql/libmysql/my_realloc.c +++ b/ext/mysql/libmysql/my_realloc.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */ #undef SAFEMALLOC diff --git a/ext/mysql/libmysql/my_static.c b/ext/mysql/libmysql/my_static.c index db942d96db..93c9b15ef1 100644 --- a/ext/mysql/libmysql/my_static.c +++ b/ext/mysql/libmysql/my_static.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Static variables for mysys library. All definied here for easy making of @@ -31,7 +17,7 @@ my_string home_dir=0,my_progname=0; char NEAR curr_dir[FN_REFLEN]= {0}, NEAR home_dir_buff[FN_REFLEN]= {0}; uint my_stream_opened=0,my_file_opened=0; -int NEAR my_umask=0664, NEAR my_umask_dir=0777; +int NEAR my_umask=0664; #ifndef THREAD int NEAR my_errno=0; #endif diff --git a/ext/mysql/libmysql/my_static.h b/ext/mysql/libmysql/my_static.h index dd80a8da1f..20d43dca55 100644 --- a/ext/mysql/libmysql/my_static.h +++ b/ext/mysql/libmysql/my_static.h @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Static variables for mysys library. All definied here for easy making of @@ -77,6 +63,6 @@ extern byte *sf_min_adress,*sf_max_adress; extern uint cNewCount; extern struct remember *pRememberRoot; -#if defined(THREAD) && !defined(__WIN__) +#if defined(THREAD) && !defined(__WIN32__) extern sigset_t my_signals; /* signals blocked by mf_brkhant */ #endif diff --git a/ext/mysql/libmysql/my_sys.h b/ext/mysql/libmysql/my_sys.h index 57734e9e53..d7cf699521 100644 --- a/ext/mysql/libmysql/my_sys.h +++ b/ext/mysql/libmysql/my_sys.h @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #ifndef _my_sys_h #define _my_sys_h @@ -35,12 +21,6 @@ extern int NEAR my_errno; /* Last error in mysys */ #include <my_pthread.h> #endif -#ifndef _m_ctype_h -#include <m_ctype.h> /* for CHARSET_INFO */ -#endif - -#include <stdarg.h> - #define MYSYS_PROGRAM_USES_CURSES() { error_handler_hook = my_message_curses; mysys_uses_curses=1; } #define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;} #define MY_INIT(name); { my_progname= name; my_init(); } @@ -68,7 +48,6 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */ #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ -#define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ @@ -91,18 +70,10 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_SEEK_CUR 1 #define MY_SEEK_END 2 - /* My charsets_list flags */ -#define MY_NO_SETS 0 -#define MY_COMPILED_SETS 1 /* show compiled-in sets */ -#define MY_CONFIG_SETS 2 /* sets that have a *.conf file */ -#define MY_INDEX_SETS 4 /* all sets listed in the Index file */ -#define MY_LOADED_SETS 8 /* the sets that are currently loaded */ - /* Some constants */ #define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */ #define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */ #define MIN_COMPRESS_LENGTH 50 /* Don't compress small bl. */ -#define KEYCACHE_BLOCK_SIZE 1024 /* defines when allocating data */ @@ -165,21 +136,11 @@ extern int (*error_handler_hook)(uint my_err, const char *str,myf MyFlags); extern int (*fatal_error_handler_hook)(uint my_err, const char *str, myf MyFlags); -/* charsets */ -extern uint get_charset_number(const char *cs_name); -extern const char *get_charset_name(uint cs_number); -extern CHARSET_INFO *get_charset(uint cs_number, myf flags); -extern my_bool set_default_charset(uint cs, myf flags); -extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); -extern my_bool set_default_charset_by_name(const char *cs_name, myf flags); -extern void free_charsets(void); -extern char *list_charsets(myf want_flags); /* my_free() this string... */ - /* statisticts */ extern ulong _my_cache_w_requests,_my_cache_write,_my_cache_r_requests, _my_cache_read; -extern ulong _my_blocks_used,_my_blocks_changed; +extern uint _my_blocks_used,_my_blocks_changed; extern uint my_file_opened,my_stream_opened; /* Point to current my_message() */ @@ -189,18 +150,16 @@ extern void (*my_sigtstp_cleanup)(void), (*my_abort_hook)(int); /* Executed when comming from shell */ extern int NEAR my_umask, /* Default creation mask */ - NEAR my_umask_dir, NEAR my_recived_signals, /* Signals we have got */ NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ NEAR my_dont_interrupt; /* call remember_intr when set */ -extern my_bool NEAR mysys_uses_curses, my_use_symdir; +extern my_bool NEAR mysys_uses_curses; extern long lCurMemory,lMaxMemory; /* from safemalloc */ extern ulong my_default_record_cache_size; extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io, NEAR my_disable_flush_key_blocks; extern char wild_many,wild_one,wild_prefix; -extern const char *charsets_dir; typedef struct wild_file_pack /* Struct to hold info when selecting files */ { @@ -211,13 +170,12 @@ typedef struct wild_file_pack /* Struct to hold info when selecting files */ typedef struct st_typelib { /* Different types saved here */ uint count; /* How many types */ - const char *name; /* Name of typelib */ - const char **type_names; + my_string name; /* Name of typelib */ + my_string *type_names; } TYPELIB; enum cache_type {READ_CACHE,WRITE_CACHE,READ_NET,WRITE_NET}; -enum flush_type { FLUSH_KEEP, FLUSH_RELEASE, FLUSH_IGNORE_CHANGED, - FLUSH_FORCE_WRITE}; +enum flush_type { FLUSH_KEEP, FLUSH_RELEASE, FLUSH_IGNORE_CHANGED}; typedef struct st_record_cache /* Used when cacheing records */ { @@ -271,11 +229,9 @@ typedef struct st_io_cache /* Used when cacheing files */ #endif enum cache_type type; int (*read_function)(struct st_io_cache *,byte *,uint); - char *file_name; /* if used with 'open_cached_file' */ + char *file_name; /* if used with 'open_cacheed_file' */ } IO_CACHE; -typedef int (*qsort2_cmp)(const void *, const void *, const void *); - /* defines for mf_iocache */ /* Test if buffer is inited */ @@ -371,7 +327,7 @@ extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags); extern my_off_t my_ftell(FILE *stream,myf MyFlags); extern gptr _mymalloc(uint uSize,const char *sFile, uint uLine, myf MyFlag); -extern gptr _myrealloc(gptr pPtr,uint uSize,const char *sFile, +extern gptr _myrealloc(my_string pPtr,uint uSize,const char *sFile, uint uLine, myf MyFlag); extern gptr my_multi_malloc _VARARGS((myf MyFlags, ...)); extern void _myfree(gptr pPtr,const char *sFile,uint uLine, myf MyFlag); @@ -392,9 +348,6 @@ extern int my_error _VARARGS((int nr,myf MyFlags, ...)); extern int my_printf_error _VARARGS((uint my_err, const char *format, myf MyFlags, ...) __attribute__ ((format (printf, 2, 4)))); -extern int my_vsnprintf( char *str, size_t n, - const char *format, va_list ap ); - extern int my_message(uint my_err, const char *str,myf MyFlags); extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags); extern int my_message_curses(uint my_err, const char *str,myf MyFlags); @@ -436,12 +389,11 @@ extern my_string my_path(my_string to,const char *progname, extern my_string my_load_path(my_string to, const char *path, const char *own_path_prefix); extern int wild_compare(const char *str,const char *wildstr); -extern my_string my_strcasestr(const char *src,const char *suffix); +extern my_string strcasestr(const char *src,const char *suffix); extern int my_strcasecmp(const char *s,const char *t); extern int my_strsortcmp(const char *s,const char *t); extern int my_casecmp(const char *s,const char *t,uint length); extern int my_sortcmp(const char *s,const char *t,uint length); -extern int my_sortncmp(const char *s,uint s_len, const char *t,uint t_len); extern WF_PACK *wf_comp(my_string str); extern int wf_test(struct wild_file_pack *wf_pack,const char *name); extern void wf_end(struct wild_file_pack *buffer); @@ -470,9 +422,6 @@ extern sig_handler my_set_alarm_variable(int signo); extern void my_string_ptr_sort(void *base,uint items,size_s size); extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements, size_s size_of_element,uchar *buffer[]); -extern qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size, - qsort2_cmp cmp, void *cmp_argument); -extern qsort2_cmp get_ptr_compare(uint); extern int init_io_cache(IO_CACHE *info,File file,uint cachesize, enum cache_type type,my_off_t seek_offset, pbool use_async_io, myf cache_myflags); @@ -484,15 +433,13 @@ extern int _my_b_net_read(IO_CACHE *info,byte *Buffer,uint Count); extern int _my_b_get(IO_CACHE *info); extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count); extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count); -extern int my_block_write(IO_CACHE *info, const byte *Buffer, - uint Count, my_off_t pos); extern int flush_io_cache(IO_CACHE *info); extern int end_io_cache(IO_CACHE *info); -extern my_bool open_cached_file(IO_CACHE *cache,const char *dir, +extern my_bool open_cacheed_file(IO_CACHE *cache,const char *dir, const char *prefix, uint cache_size, myf cache_myflags); extern my_bool real_open_cached_file(IO_CACHE *cache); -extern void close_cached_file(IO_CACHE *cache); +extern void close_cacheed_file(IO_CACHE *cache); extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size, uint init_alloc,uint alloc_increment); extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element); @@ -509,7 +456,7 @@ extern void freeze_size(DYNAMIC_ARRAY *array); extern int find_type(my_string x,TYPELIB *typelib,uint full_name); extern void make_type(my_string to,uint nr,TYPELIB *typelib); -extern const char *get_type(TYPELIB *typelib,uint nr); +extern my_string get_type(TYPELIB *typelib,uint nr); extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, uint init_alloc,uint alloc_increment); extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append); @@ -541,15 +488,17 @@ my_bool my_uncompress(byte *, ulong *, ulong *); byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen); ulong checksum(const byte *mem, uint count); -#if defined(_MSC_VER) && !defined(__WIN__) +#if defined(_MSC_VER) && !defined(__WIN32__) extern void sleep(int sec); #endif -#ifdef __WIN__ +#ifdef __WIN32__ extern my_bool have_tcpip; /* Is set if tcpip is used */ #endif #ifdef __cplusplus } #endif +#if defined(USE_RAID) #include "raid.h" +#endif #endif /* _my_sys_h */ diff --git a/ext/mysql/libmysql/my_tempnam.c b/ext/mysql/libmysql/my_tempnam.c index 7e5b953fe5..a288ecda4f 100644 --- a/ext/mysql/libmysql/my_tempnam.c +++ b/ext/mysql/libmysql/my_tempnam.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" #include <m_string.h> diff --git a/ext/mysql/libmysql/my_thr_init.c b/ext/mysql/libmysql/my_thr_init.c index d879da8e65..c515822468 100644 --- a/ext/mysql/libmysql/my_thr_init.c +++ b/ext/mysql/libmysql/my_thr_init.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* ** Functions to handle initializating and allocationg of all mysys & debug @@ -30,12 +16,11 @@ pthread_key(struct st_my_thread_var*, THR_KEY_mysys); pthread_key(struct st_my_thread_var, THR_KEY_mysys); #endif pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache, - THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_myisam,THR_LOCK_heap, - THR_LOCK_net, THR_LOCK_charset; + THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_heap,THR_LOCK_net; #ifndef HAVE_LOCALTIME_R pthread_mutex_t LOCK_localtime_r; #endif -#ifdef __WIN__ +#ifdef __WIN32__ pthread_mutex_t THR_LOCK_thread; #endif @@ -55,11 +40,9 @@ my_bool my_thread_global_init(void) pthread_mutex_init(&THR_LOCK_keycache,NULL); pthread_mutex_init(&THR_LOCK_lock,NULL); pthread_mutex_init(&THR_LOCK_isam,NULL); - pthread_mutex_init(&THR_LOCK_myisam,NULL); pthread_mutex_init(&THR_LOCK_heap,NULL); pthread_mutex_init(&THR_LOCK_net,NULL); - pthread_mutex_init(&THR_LOCK_charset,NULL); -#ifdef __WIN__ +#ifdef __WIN32__ pthread_mutex_init(&THR_LOCK_thread,NULL); #endif #ifndef HAVE_LOCALTIME_R @@ -81,7 +64,7 @@ my_bool my_thread_init(void) { struct st_my_thread_var *tmp; pthread_mutex_lock(&THR_LOCK_lock); -#if !defined(__WIN__) || defined(USE_TLS) +#if !defined(__WIN32__) || defined(USE_TLS) if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys)) { pthread_mutex_unlock(&THR_LOCK_lock); @@ -128,11 +111,11 @@ void my_thread_end(void) pthread_cond_destroy(&tmp->suspend); #endif pthread_mutex_destroy(&tmp->mutex); -#if !defined(__WIN__) || defined(USE_TLS) +#if !defined(__WIN32__) || defined(USE_TLS) free(tmp); #endif } -#if !defined(__WIN__) || defined(USE_TLS) +#if !defined(__WIN32__) || defined(USE_TLS) pthread_setspecific(THR_KEY_mysys,0); #endif } @@ -162,7 +145,7 @@ long my_thread_id() { #if defined(HAVE_PTHREAD_GETSEQUENCE_NP) return pthread_getsequence_np(pthread_self()); -#elif (defined(__sun) || defined(__sgi) || defined(__linux__)) && !defined(HAVE_mit_thread) +#elif defined(__sun) || defined(__sgi) || defined(__linux__) return pthread_self(); #else return my_thread_var->id; diff --git a/ext/mysql/libmysql/my_write.c b/ext/mysql/libmysql/my_write.c index 0ff32094ed..6ac221c194 100644 --- a/ext/mysql/libmysql/my_write.c +++ b/ext/mysql/libmysql/my_write.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include "mysys_priv.h" #include "mysys_err.h" diff --git a/ext/mysql/libmysql/mysql.h b/ext/mysql/libmysql/mysql.h index e83babb8fa..6f358da110 100644 --- a/ext/mysql/libmysql/mysql.h +++ b/ext/mysql/libmysql/mysql.h @@ -1,38 +1,19 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* defines for the libmysql library */ #ifndef _mysql_h #define _mysql_h -#ifndef MYSQL_SERVER #ifdef __cplusplus extern "C" { #endif -#endif - + #ifndef _global_h /* If not standard header */ #include <sys/types.h> typedef char my_bool; -#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) -#define __WIN__ -#endif -#if !defined(__WIN__) +#if !defined(WIN32) #define STDCALL #else #define STDCALL __stdcall @@ -56,7 +37,7 @@ typedef struct st_mem_root { #endif #ifndef my_socket_defined -#ifdef __WIN__ +#ifdef WIN32 #define my_socket SOCKET #else typedef int my_socket; @@ -90,7 +71,7 @@ typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */ #if defined(NO_CLIENT_LONG_LONG) typedef unsigned long my_ulonglong; -#elif defined (__WIN__) +#elif defined (WIN32) typedef unsigned __int64 my_ulonglong; #else typedef unsigned long long my_ulonglong; @@ -117,7 +98,7 @@ struct st_mysql_options { my_bool compress,named_pipe; unsigned int port; char *host,*init_command,*user,*password,*unix_socket,*db; - char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name; + char *my_cnf_file,*my_cnf_group; my_bool use_ssl; /* if to use SSL or not */ char *ssl_key; /* PEM key file */ char *ssl_cert; /* PEM cert file */ @@ -127,8 +108,7 @@ struct st_mysql_options { enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND, - MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, - MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME}; + MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP }; enum mysql_status { MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT}; @@ -141,7 +121,6 @@ typedef struct st_mysql { unsigned int port,client_flag,server_capabilities; unsigned int protocol_version; unsigned int field_count; - unsigned int server_status; unsigned long thread_id; /* Id for connection in server */ my_ulonglong affected_rows; my_ulonglong insert_id; /* id if insert on table with NEXTNR */ @@ -154,8 +133,6 @@ typedef struct st_mysql { my_bool reconnect; /* set to 1 if automatic reconnect */ struct st_mysql_options options; char scramble_buff[9]; - struct charset_info_st *charset; - unsigned int server_language; } MYSQL; @@ -176,23 +153,21 @@ typedef struct st_mysql_res { /* Functions to get information from the MYSQL and MYSQL_RES structures */ /* Should definitely be used if one uses shared libraries */ -my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res); -unsigned int STDCALL mysql_num_fields(MYSQL_RES *res); -my_bool STDCALL mysql_eof(MYSQL_RES *res); -MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res, - unsigned int fieldnr); -MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res); -MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res); -unsigned int STDCALL mysql_field_tell(MYSQL_RES *res); +my_ulonglong mysql_num_rows(MYSQL_RES *res); +unsigned int mysql_num_fields(MYSQL_RES *res); +my_bool mysql_eof(MYSQL_RES *res); +MYSQL_FIELD *mysql_fetch_field_direct(MYSQL_RES *res,unsigned int fieldnr); +MYSQL_FIELD *mysql_fetch_fields(MYSQL_RES *res); +MYSQL_ROWS *mysql_row_tell(MYSQL_RES *res); +unsigned int mysql_field_tell(MYSQL_RES *res); -unsigned int STDCALL mysql_field_count(MYSQL *mysql); -my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql); -my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql); -unsigned int STDCALL mysql_errno(MYSQL *mysql); -char * STDCALL mysql_error(MYSQL *mysql); -char * STDCALL mysql_info(MYSQL *mysql); -unsigned long STDCALL mysql_thread_id(MYSQL *mysql); -const char * STDCALL mysql_character_set_name(MYSQL *mysql); +unsigned int mysql_field_count(MYSQL *mysql); +my_ulonglong mysql_affected_rows(MYSQL *mysql); +my_ulonglong mysql_insert_id(MYSQL *mysql); +unsigned int mysql_errno(MYSQL *mysql); +char *mysql_error(MYSQL *mysql); +char *mysql_info(MYSQL *mysql); +unsigned long mysql_thread_id(MYSQL *mysql); MYSQL * STDCALL mysql_init(MYSQL *mysql); #ifdef HAVE_OPENSSL @@ -260,13 +235,8 @@ unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result); MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result); unsigned long STDCALL mysql_escape_string(char *to,const char *from, unsigned long from_length); -unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, - char *to,const char *from, - unsigned long length); void STDCALL mysql_debug(const char *debug); -char * STDCALL mysql_odbc_escape_string(MYSQL *mysql, - char *to, - unsigned long to_length, +char * STDCALL mysql_odbc_escape_string(char *to, unsigned long to_length, const char *from, unsigned long from_length, void *param, @@ -274,20 +244,14 @@ char * STDCALL mysql_odbc_escape_string(MYSQL *mysql, (*extend_buffer) (void *, char *to, unsigned long *length)); -void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); -unsigned int STDCALL mysql_thread_safe(void); - #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) /* new api functions */ #define HAVE_MYSQL_REAL_CONNECT -#ifndef MYSQL_SERVER #ifdef __cplusplus } #endif #endif - -#endif diff --git a/ext/mysql/libmysql/mysql_com.h b/ext/mysql/libmysql/mysql_com.h index 2a1471f735..c4c0ecfdd7 100644 --- a/ext/mysql/libmysql/mysql_com.h +++ b/ext/mysql/libmysql/mysql_com.h @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* ** Common definition between mysql server & client @@ -22,6 +8,9 @@ #ifndef _mysql_com_h #define _mysql_com_h +#ifdef __cplusplus +extern "C" { +#endif #define NAME_LEN 64 /* Field/table name length */ #define HOSTNAME_LENGTH 60 @@ -30,23 +19,23 @@ #define LOCAL_HOST "localhost" #define LOCAL_HOST_NAMEDPIPE "." +#define MYSQL_PORT 3306 /* Alloced by ISI for MySQL */ #if defined(__EMX__) || defined(__OS2__) #undef MYSQL_UNIX_ADDR #define MYSQL_OS2_ADDR "\\socket\\MySQL" #define MYSQL_UNIX_ADDR MYSQL_OS2_ADDR #endif -#if defined(__WIN__) && !defined( _CUSTOMCONFIG_) +#ifdef WIN32 #define MYSQL_NAMEDPIPE "MySQL" #define MYSQL_SERVICENAME "MySql" -#endif /* __WIN__ */ +#endif enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY, COM_FIELD_LIST,COM_CREATE_DB,COM_DROP_DB,COM_REFRESH, COM_SHUTDOWN,COM_STATISTICS, COM_PROCESS_INFO,COM_CONNECT,COM_PROCESS_KILL, COM_DEBUG,COM_PING,COM_TIME,COM_DELAYED_INSERT, - COM_CHANGE_USER, COM_BINLOG_DUMP, - COM_TABLE_DUMP}; + COM_CHANGE_USER}; #define NOT_NULL_FLAG 1 /* Field can't be NULL */ #define PRI_KEY_FLAG 2 /* Field is part of a primary key */ @@ -70,14 +59,6 @@ enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY, #define REFRESH_TABLES 4 /* close all tables */ #define REFRESH_HOSTS 8 /* Flush host cache */ #define REFRESH_STATUS 16 /* Flush status variables */ -#define REFRESH_THREADS 32 /* Flush status variables */ -#define REFRESH_SLAVE 64 /* Reset master info and restart slave - thread */ -#define REFRESH_MASTER 128 /* Remove all bin logs in the index - and truncate the index */ - -/* The following can't be set with mysql_refresh() */ -#define REFRESH_READ_LOCK 16384 /* Lock tables for read */ #define REFRESH_FAST 32768 /* Intern flag */ #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ @@ -93,10 +74,6 @@ enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY, #define CLIENT_INTERACTIVE 1024 /* This is an interactive client */ #define CLIENT_SSL 2048 /* Switch to SSL after handshake */ #define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */ -#define CLIENT_TRANSACTIONS 8196 /* Client knows about transactions */ - -#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ -#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ #define MYSQL_ERRMSG_SIZE 200 #define NET_READ_TIMEOUT 30 /* Timeout on read */ @@ -120,15 +97,10 @@ typedef struct st_net { unsigned char *buff,*buff_end,*write_pos,*read_pos; char last_error[MYSQL_ERRMSG_SIZE]; unsigned int last_errno,max_packet,timeout,pkt_nr; - unsigned char error; - my_bool return_errno,compress; - my_bool no_send_ok; /* needed if we are doing several - queries in one command ( as in LOAD TABLE ... FROM MASTER ), - and do not want to confuse the client with OK at the wrong time - */ + my_bool error,return_errno,compress; + unsigned long remain_in_buf,length, buf_length, where_b; - unsigned int *return_status; - unsigned char reading_or_writing; + my_bool more; char save_char; } NET; @@ -205,10 +177,6 @@ typedef struct st_udf_init /* Prototypes to password functions */ -#ifdef __cplusplus -extern "C" { -#endif - void randominit(struct rand_struct *,unsigned long seed1, unsigned long seed2); double rnd(struct rand_struct *); @@ -221,9 +189,6 @@ my_bool check_scramble(const char *, const char *message, unsigned long *salt,my_bool old_ver); char *get_tty_password(char *opt_message); void hash_password(unsigned long *result, const char *password); -#ifdef __cplusplus -} -#endif /* Some other useful functions */ @@ -233,10 +198,13 @@ void load_defaults(const char *conf_file, const char **groups, #define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ -#ifdef __WIN__ +#ifdef WIN32 #define socket_errno WSAGetLastError() #else #define socket_errno errno #endif +#ifdef __cplusplus +} +#endif #endif diff --git a/ext/mysql/libmysql/mysql_version.h b/ext/mysql/libmysql/mysql_version.h index 1f868704fe..b07e587aff 100644 --- a/ext/mysql/libmysql/mysql_version.h +++ b/ext/mysql/libmysql/mysql_version.h @@ -3,18 +3,8 @@ /* Version numbers for protocol & mysqld */ -#ifdef _CUSTOMCONFIG_ - #include <custom_conf.h> -#else -#define PROTOCOL_VERSION 10 -#define MYSQL_SERVER_VERSION "3.23.22-beta" +#define MYSQL_SERVER_VERSION "3.23.10-alpha" #define FRM_VER 6 -#define MYSQL_VERSION_ID 32322 -#define MYSQL_PORT 3306 -#define MYSQL_UNIX_ADDR "/tmp/mysql.sock" - +#define MYSQL_VERSION_ID 32310 /* mysqld compile time options */ -#ifndef MYSQL_CHARSET #define MYSQL_CHARSET "latin1" -#endif -#endif diff --git a/ext/mysql/libmysql/mysqld_error.h b/ext/mysql/libmysql/mysqld_error.h index d815e61f3b..da19af6138 100644 --- a/ext/mysql/libmysql/mysqld_error.h +++ b/ext/mysql/libmysql/mysqld_error.h @@ -176,21 +176,4 @@ #define ER_REQUIRES_PRIMARY_KEY 1173 #define ER_NO_RAID_COMPILED 1174 #define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175 -#define ER_KEY_DOES_NOT_EXITS 1176 -#define ER_CHECK_NO_SUCH_TABLE 1177 -#define ER_CHECK_NOT_IMPLEMENTED 1178 -#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179 -#define ER_ERROR_DURING_COMMIT 1180 -#define ER_ERROR_DURING_ROLLBACK 1181 -#define ER_ERROR_DURING_FLUSH_LOGS 1182 -#define ER_ERROR_DURING_CHECKPOINT 1183 -#define ER_NEW_ABORTING_CONNECTION 1184 -#define ER_DUMP_NOT_IMPLEMENTED 1185 -#define ER_FLUSH_MASTER_BINLOG_CLOSED 1186 -#define ER_INDEX_REBUILD 1187 -#define ER_MASTER 1188 -#define ER_MASTER_NET_READ 1189 -#define ER_MASTER_NET_WRITE 1190 -#define ER_FT_MATCHING_KEY_NOT_FOUND 1191 -#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192 -#define ER_ERROR_MESSAGES 193 +#define ER_ERROR_MESSAGES 176 diff --git a/ext/mysql/libmysql/mysys_err.h b/ext/mysql/libmysql/mysys_err.h index 7f5c3e1908..7264f21906 100644 --- a/ext/mysql/libmysql/mysys_err.h +++ b/ext/mysql/libmysql/mysys_err.h @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #ifndef _mysys_err_h #define _mysys_err_h @@ -22,7 +8,7 @@ extern "C" { #endif #define GLOB 0 /* Error maps */ -#define GLOBERRS 23 /* Max number of error messages in map's */ +#define GLOBERRS 22 /* Max number of error messages in map's */ #define EE(X) globerrs[ X ] /* Defines to add error to right map */ extern const char * NEAR globerrs[]; /* my_error_messages is here */ @@ -49,7 +35,6 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */ #define EE_OPEN_WARNING 19 #define EE_DISK_FULL 20 #define EE_CANT_MKDIR 21 -#define EE_UNKNOWN_CHARSET 22 #ifdef __cplusplus } diff --git a/ext/mysql/libmysql/mysys_priv.h b/ext/mysql/libmysql/mysys_priv.h index 86c32202e9..86bc74f38b 100644 --- a/ext/mysql/libmysql/mysys_priv.h +++ b/ext/mysql/libmysql/mysys_priv.h @@ -1,30 +1,12 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ #include <global.h> #include <my_sys.h> -#ifdef USE_SYSTEM_WRAPPERS -#include "system_wrappers.h" -#endif - #ifdef THREAD extern pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache, - THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_net,THR_LOCK_charset; + THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_net; #else /* THREAD */ #define pthread_mutex_lock(A) #define pthread_mutex_unlock(A) diff --git a/ext/mysql/libmysql/net.c b/ext/mysql/libmysql/net.c index 643b5e031c..9af0a54c3d 100644 --- a/ext/mysql/libmysql/net.c +++ b/ext/mysql/libmysql/net.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Write and read of logical packets to/from socket ** Writes are cached into net_buffer_length big packets. @@ -22,7 +8,7 @@ ** 3 byte length & 1 byte package-number. */ -#ifdef __WIN__ +#ifdef _WIN32 #include <winsock.h> #endif #include <global.h> @@ -30,29 +16,15 @@ #include <my_sys.h> #include <m_string.h> #include "mysql.h" -#include "mysqld_error.h" #include <signal.h> #include <errno.h> #include <sys/types.h> #include <violite.h> -#ifdef MYSQL_SERVER -ulong max_allowed_packet=65536; -extern ulong net_read_timeout,net_write_timeout; -extern uint test_flags; -#else -ulong max_allowed_packet=16*1024*1024L; -ulong net_read_timeout= NET_READ_TIMEOUT; -ulong net_write_timeout= NET_WRITE_TIMEOUT; -#endif -ulong net_buffer_length=8192; /* Default length. Enlarged if necessary */ - -#if !defined(__WIN__) && !defined(MSDOS) +#if !defined(__WIN32__) && !defined(MSDOS) #include <sys/socket.h> -#else -#undef MYSQL_SERVER // Win32 can't handle interrupts #endif -#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) +#if !defined(MSDOS) && !defined(__WIN32__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) #include <netinet/in_systm.h> #include <netinet/in.h> #include <netinet/ip.h> @@ -69,12 +41,11 @@ void sql_print_error(const char *format,...); extern ulong mysqld_net_retry_count; #else typedef my_bool thr_alarm_t; -typedef my_bool ALARM; #define thr_alarm_init(A) (*A)=0 #define thr_alarm_in_use(A) (A) #define thr_end_alarm(A) -#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C)) -static inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused))) +#define thr_alarm(A,B) local_thr_alarm((A),(B)) +static inline int local_thr_alarm(my_bool *A,int B __attribute__((unused))) { *A=1; return 0; @@ -87,8 +58,8 @@ static inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM extern ulong bytes_sent, bytes_received; extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received; #else -#undef statistic_add -#define statistic_add(A,B,C) +#undef thread_safe_add +#define thread_safe_add(A,B,C) #endif /* @@ -97,6 +68,14 @@ extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received; ** can't normally do this the client should have a bigger max-buffer. */ +#ifdef MYSQL_SERVER +ulong max_allowed_packet=65536; +extern uint test_flags; +#else +ulong max_allowed_packet=24*1024*1024L; +#endif +ulong net_buffer_length=8192; /* Default length. Enlarged if necessary */ + #define TEST_BLOCKING 8 static int net_write_buff(NET *net,const char *packet,uint len); @@ -111,20 +90,19 @@ int my_net_init(NET *net, Vio* vio) max_allowed_packet=net_buffer_length; net->buff_end=net->buff+(net->max_packet=net_buffer_length); net->vio = vio; - net->no_send_ok = 0; - net->error=0; net->return_errno=0; net->return_status=0; - net->timeout=(uint) net_read_timeout; /* Timeout for read */ + net->error=net->return_errno=0; + net->timeout=NET_READ_TIMEOUT; /* Timeout for read */ net->pkt_nr=0; net->write_pos=net->read_pos = net->buff; net->last_error[0]=0; - net->compress=0; net->reading_or_writing=0; + net->compress=net->more=0; net->where_b = net->remain_in_buf=0; net->last_errno=0; if (vio != 0) /* If real connection */ { net->fd = vio_fd(vio); /* For perl DBI/DBD */ -#if defined(MYSQL_SERVER) && !defined(___WIN__) && !defined(__EMX__) +#if defined(MYSQL_SERVER) && !defined(___WIN32__) && !defined(__EMX__) if (!(test_flags & TEST_BLOCKING)) vio_blocking(vio, FALSE); #endif @@ -147,12 +125,19 @@ static my_bool net_realloc(NET *net, ulong length) ulong pkt_length; if (length >= max_allowed_packet) { - DBUG_PRINT("error",("Packet too large (%lu)", length)); + DBUG_PRINT("error",("Packet too large (%ld)", length)); +#ifdef MYSQL_SERVER + sql_print_error("Packet too large (%ld)\n", length); +#else + fprintf(stderr,"Packet too large (%ld)\n", length); +#endif net->error=1; +#ifdef MYSQL_SERVER net->last_errno=ER_NET_PACKET_TOO_LARGE; +#endif return 1; } - pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1); + pkt_length = (length+IO_SIZE) & ~(IO_SIZE-1); if (!(buff=(uchar*) my_realloc((char*) net->buff, pkt_length, MYF(MY_WME)))) { net->error=1; @@ -168,40 +153,37 @@ static my_bool net_realloc(NET *net, ulong length) /* Remove unwanted characters from connection */ +#ifndef MYSQL_SERVER void net_clear(NET *net) { #ifndef EXTRA_DEBUG int count; - bool is_blocking=vio_is_blocking(net->vio); - if (is_blocking) - vio_blocking(net->vio, FALSE); + vio_blocking(net->vio, FALSE); if (!vio_is_blocking(net->vio)) /* Safety if SSL */ { while ( (count = vio_read(net->vio, (char*) (net->buff), net->max_packet)) > 0) DBUG_PRINT("info",("skipped %d bytes from file: %s", count,vio_description(net->vio))); - if (is_blocking) - vio_blocking(net->vio, TRUE); } #endif /* EXTRA_DEBUG */ net->pkt_nr=0; /* Ready for new command */ net->write_pos=net->buff; } +#endif /* MYSQL_SERVER */ /* Flush write_buffer if not empty. */ int net_flush(NET *net) { int error=0; - DBUG_ENTER("net_flush"); if (net->buff != net->write_pos) { error=net_real_write(net,(char*) net->buff, (uint) (net->write_pos - net->buff)); net->write_pos=net->buff; } - DBUG_RETURN(error); + return error; } @@ -271,17 +253,9 @@ net_real_write(NET *net,const char *packet,ulong len) int length; char *pos,*end; thr_alarm_t alarmed; -#if (!defined(__WIN__) && !defined(__EMX__)) - ALARM alarm_buff; -#endif uint retry_count=0; my_bool net_blocking = vio_is_blocking(net->vio); - DBUG_ENTER("net_real_write"); - - if (net->error == 2) - DBUG_RETURN(-1); /* socket can't be used */ - net->reading_or_writing=2; #ifdef HAVE_COMPRESS if (net->compress) { @@ -293,10 +267,9 @@ net_real_write(NET *net,const char *packet,ulong len) { #ifdef MYSQL_SERVER net->last_errno=ER_OUT_OF_RESOURCES; - net->error=2; + net->error=1; #endif - net->reading_or_writing=0; - DBUG_RETURN(1); + return 1; } memcpy(b+header_length,packet,len); @@ -318,7 +291,7 @@ net_real_write(NET *net,const char *packet,ulong len) #ifdef MYSQL_SERVER thr_alarm_init(&alarmed); if (net_blocking) - thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff); + thr_alarm(&alarmed,NET_WRITE_TIMEOUT); #else alarmed=0; #endif /* MYSQL_SERVER */ @@ -329,10 +302,10 @@ net_real_write(NET *net,const char *packet,ulong len) if ((int) (length=vio_write(net->vio,pos,(size_t) (end-pos))) <= 0) { my_bool interrupted = vio_should_retry(net->vio); -#if (!defined(__WIN__) && !defined(__EMX__)) +#if (!defined(__WIN32__) && !defined(__EMX__)) if ((interrupted || length==0) && !thr_alarm_in_use(alarmed)) { - if (!thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff)) + if (!thr_alarm(&alarmed,NET_WRITE_TIMEOUT)) { /* Always true for client */ if (!vio_is_blocking(net->vio)) { @@ -345,7 +318,7 @@ net_real_write(NET *net,const char *packet,ulong len) "%s: my_net_write: fcntl returned error %d, aborting thread\n", my_progname,vio_errno(net->vio)); #endif /* EXTRA_DEBUG */ - net->error=2; /* Close socket */ + net->error=1; /* Close socket */ goto end; } } @@ -354,7 +327,7 @@ net_real_write(NET *net,const char *packet,ulong len) } } else -#endif /* (!defined(__WIN__) && !defined(__EMX__)) */ +#endif /* (!defined(__WIN32__) && !defined(__EMX__)) */ if (thr_alarm_in_use(alarmed) && !thr_got_alarm(alarmed) && interrupted) { @@ -372,7 +345,7 @@ net_real_write(NET *net,const char *packet,ulong len) continue; } #endif /* defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) */ - net->error=2; /* Close socket */ + net->error=1; /* Close socket */ #ifdef MYSQL_SERVER net->last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED : ER_NET_ERROR_ON_WRITE); @@ -380,9 +353,9 @@ net_real_write(NET *net,const char *packet,ulong len) break; } pos+=length; - statistic_add(bytes_sent,length,&LOCK_bytes_sent); + thread_safe_add(bytes_sent,length,&LOCK_bytes_sent); } -#ifndef __WIN__ +#ifndef __WIN32__ end: #endif #ifdef HAVE_COMPRESS @@ -394,8 +367,7 @@ net_real_write(NET *net,const char *packet,ulong len) thr_end_alarm(&alarmed); vio_blocking(net->vio, net_blocking); } - net->reading_or_writing=0; - DBUG_RETURN(((int) (pos != end))); + return (int) (pos != end); } @@ -403,43 +375,6 @@ net_real_write(NET *net,const char *packet,ulong len) ** Read something from server/clinet *****************************************************************************/ -#ifdef MYSQL_SERVER - -/* - Help function to clear the commuication buffer when we get a too - big packet -*/ - -static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed) -{ - char buff[1024]; - ALARM alarm_buff; - uint retry_count=0; - if (!thr_alarm_in_use(alarmed)) - { - if (!thr_alarm(alarmed,net->timeout,&alarm_buff) || - (!vio_is_blocking(net->vio) && vio_blocking(net->vio,TRUE) < 0)) - return; // Can't setup, abort - } - while (remain > 0) - { - ulong length; - if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L) - { - my_bool interrupted = vio_should_retry(net->vio); - if (!thr_got_alarm(alarmed) && interrupted) - { /* Probably in MIT threads */ - if (retry_count++ < RETRY_COUNT) - continue; - } - return; - } - remain -=(ulong) length; - statistic_add(bytes_received,(ulong) length,&LOCK_bytes_received); - } -} -#endif /* MYSQL_SERVER */ - static uint my_real_read(NET *net, ulong *complen) @@ -449,19 +384,15 @@ my_real_read(NET *net, ulong *complen) uint i,retry_count=0; ulong len=packet_error; thr_alarm_t alarmed; -#if (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER) - ALARM alarm_buff; -#endif my_bool net_blocking=vio_is_blocking(net->vio); ulong remain= (net->compress ? NET_HEADER_SIZE+COMP_HEADER_SIZE : NET_HEADER_SIZE); *complen = 0; - net->reading_or_writing=1; thr_alarm_init(&alarmed); #ifdef MYSQL_SERVER if (net_blocking) - thr_alarm(&alarmed,net->timeout,&alarm_buff); + thr_alarm(&alarmed,net->timeout); #endif /* MYSQL_SERVER */ pos = net->buff + net->where_b; /* net->packet -4 */ @@ -476,7 +407,7 @@ my_real_read(NET *net, ulong *complen) DBUG_PRINT("info",("vio_read returned %d, errno: %d", length, vio_errno(net->vio))); -#if (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER) +#if (!defined(__WIN32__) && !defined(__EMX__)) || !defined(MYSQL_SERVER) /* We got an error that there was no data on the socket. We now set up an alarm to not 'read forever', change the socket to non blocking @@ -484,7 +415,7 @@ my_real_read(NET *net, ulong *complen) */ if ((interrupted || length == 0) && !thr_alarm_in_use(alarmed)) { - if (!thr_alarm(&alarmed,net->timeout,&alarm_buff)) /* Don't wait too long */ + if (!thr_alarm(&alarmed,net->timeout)) /* Don't wait too long */ { if (!vio_is_blocking(net->vio)) { @@ -502,7 +433,7 @@ my_real_read(NET *net, ulong *complen) my_progname,vio_errno(net->vio)); #endif /* EXTRA_DEBUG */ len= packet_error; - net->error=2; /* Close socket */ + net->error=1; /* Close socket */ #ifdef MYSQL_SERVER net->last_errno=ER_NET_FCNTL_ERROR; #endif @@ -513,7 +444,7 @@ my_real_read(NET *net, ulong *complen) continue; } } -#endif /* (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER) */ +#endif /* (!defined(__WIN32__) && !defined(__EMX__)) || !defined(MYSQL_SERVER) */ if (thr_alarm_in_use(alarmed) && !thr_got_alarm(alarmed) && interrupted) { /* Probably in MIT threads */ @@ -533,7 +464,7 @@ my_real_read(NET *net, ulong *complen) #endif DBUG_PRINT("error",("Couldn't read packet: remain: %d errno: %d length: %d alarmed: %d", remain,vio_errno(net->vio),length,alarmed)); len= packet_error; - net->error=2; /* Close socket */ + net->error=1; /* Close socket */ #ifdef MYSQL_SERVER net->last_errno= (interrupted ? ER_NET_READ_INTERRUPTED : ER_NET_READ_ERROR); @@ -542,7 +473,7 @@ my_real_read(NET *net, ulong *complen) } remain -= (ulong) length; pos+= (ulong) length; - statistic_add(bytes_received,(ulong) length,&LOCK_bytes_received); + thread_safe_add(bytes_received,(ulong) length,&LOCK_bytes_received); } if (i == 0) { /* First parts is packet length */ @@ -581,13 +512,8 @@ my_real_read(NET *net, ulong *complen) /* The necessary size of net->buff */ if (helping >= net->max_packet) { - /* We must allocate one extra byte for the end null */ - if (net_realloc(net,helping+1)) + if (net_realloc(net,helping)) { -#ifdef MYSQL_SERVER - if (i == 1) - my_net_skip_rest(net, len, &alarmed); -#endif len= packet_error; /* Return error */ goto end; } @@ -603,10 +529,10 @@ end: thr_end_alarm(&alarmed); vio_blocking(net->vio, net_blocking); } - net->reading_or_writing=0; return(len); } + uint my_net_read(NET *net) { @@ -661,7 +587,7 @@ my_net_read(NET *net) if (my_uncompress((byte*) net->buff + net->where_b, &len, &complen)) { len= packet_error; - net->error=2; /* caller will close socket */ + net->error=1; /* caller will close socket */ #ifdef MYSQL_SERVER net->last_errno=ER_NET_UNCOMPRESS_ERROR; #endif diff --git a/ext/mysql/libmysql/password.c b/ext/mysql/libmysql/password.c index 0fd5861873..46667993d5 100644 --- a/ext/mysql/libmysql/password.c +++ b/ext/mysql/libmysql/password.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* password checking routines */ /***************************************************************************** diff --git a/ext/mysql/libmysql/safemalloc.c b/ext/mysql/libmysql/safemalloc.c index d715f69e38..5a44745bed 100644 --- a/ext/mysql/libmysql/safemalloc.c +++ b/ext/mysql/libmysql/safemalloc.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* * [This posting refers to an article entitled "oops, corrupted memory @@ -207,7 +193,7 @@ gptr _mymalloc (uint uSize, const char *sFile, uint uLine, myf MyFlags) * Free then old memoryblock */ -gptr _myrealloc (register gptr pPtr, register uint uSize, +gptr _myrealloc (register my_string pPtr, register uint uSize, const char *sFile, uint uLine, myf MyFlags) { struct remember *pRec; @@ -223,8 +209,7 @@ gptr _myrealloc (register gptr pPtr, register uint uSize, if (check_ptr("Reallocating",(byte*) pPtr,sFile,uLine)) DBUG_RETURN((gptr) NULL); - pRec = (struct remember *) ((char*) pPtr - sizeof (struct irem)- - sf_malloc_prehunc); + pRec = (struct remember *) (pPtr - sizeof (struct irem)-sf_malloc_prehunc); if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc)) != MAGICKEY) { @@ -482,7 +467,6 @@ int _sanity (const char *sFile, uint uLine) count=cNewCount; for (pTmp = pRememberRoot; pTmp != NULL && count-- ; pTmp = pTmp -> pNext) flag+=_checkchunk (pTmp, sFile, uLine); - pthread_mutex_unlock(&THR_LOCK_malloc); if (count || pTmp) { const char *format="Safemalloc link list destroyed, discovered at '%s:%d'"; @@ -491,6 +475,7 @@ int _sanity (const char *sFile, uint uLine) DBUG_PRINT("safe",(format, sFile, uLine)); flag=1; } + pthread_mutex_unlock(&THR_LOCK_malloc); return flag; } /* _sanity */ diff --git a/ext/mysql/libmysql/str2int.c b/ext/mysql/libmysql/str2int.c index 55fcd56adb..c6de1a436a 100644 --- a/ext/mysql/libmysql/str2int.c +++ b/ext/mysql/libmysql/str2int.c @@ -1,20 +1,3 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - /* str2int(src, radix, lower, upper, &val) converts the string pointed to by src to an integer and stores it in diff --git a/ext/mysql/libmysql/strcend.c b/ext/mysql/libmysql/strcend.c index 246b81d7f7..f65eb16837 100644 --- a/ext/mysql/libmysql/strcend.c +++ b/ext/mysql/libmysql/strcend.c @@ -1,20 +1,3 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - /* File : strcend.c Author : Michael Widenius: ifdef MC68000 Updated: 20 April 1984 diff --git a/ext/mysql/libmysql/strcont.c b/ext/mysql/libmysql/strcont.c index 5c7d5d2e55..5ed0738dec 100644 --- a/ext/mysql/libmysql/strcont.c +++ b/ext/mysql/libmysql/strcont.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* File : strcont.c Author : Monty diff --git a/ext/mysql/libmysql/strfill.c b/ext/mysql/libmysql/strfill.c index ef0ccb567d..6a718db9c1 100644 --- a/ext/mysql/libmysql/strfill.c +++ b/ext/mysql/libmysql/strfill.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* File : strfill.c Author : Monty diff --git a/ext/mysql/libmysql/string.c b/ext/mysql/libmysql/string.c index 0696c72b92..a14cc138fa 100644 --- a/ext/mysql/libmysql/string.c +++ b/ext/mysql/libmysql/string.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Code for handling strings with can grow dynamicly. @@ -33,7 +19,7 @@ my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, if (!alloc_increment) alloc_increment=128; length=1; - if (init_str && (length= (uint) strlen(init_str)+1) < init_alloc) + if (init_str && (length=strlen(init_str)+1) < init_alloc) init_alloc=((length+alloc_increment-1)/alloc_increment)*alloc_increment; if (!init_alloc) init_alloc=alloc_increment; @@ -53,7 +39,7 @@ my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str) uint length; DBUG_ENTER("dynstr_set"); - if (init_str && (length= (uint) strlen(init_str)+1) > str->max_length) + if (init_str && (length=strlen(init_str)+1) > str->max_length) { str->max_length=((length+str->alloc_increment-1)/str->alloc_increment)* str->alloc_increment; diff --git a/ext/mysql/libmysql/strinstr.c b/ext/mysql/libmysql/strinstr.c index e1d502f400..459cfbc3e6 100644 --- a/ext/mysql/libmysql/strinstr.c +++ b/ext/mysql/libmysql/strinstr.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* File : strinstr.c Author : Monty & David diff --git a/ext/mysql/libmysql/strmake.c b/ext/mysql/libmysql/strmake.c index d4edce689a..65792625ae 100644 --- a/ext/mysql/libmysql/strmake.c +++ b/ext/mysql/libmysql/strmake.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* File : strmake.c Author : Michael Widenius diff --git a/ext/mysql/libmysql/strmov.c b/ext/mysql/libmysql/strmov.c index 8f5beb41f4..b41470aef4 100644 --- a/ext/mysql/libmysql/strmov.c +++ b/ext/mysql/libmysql/strmov.c @@ -1,20 +1,3 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - /* strmov(dst, src) moves all the characters of src (including the closing NUL) to dst, and returns a pointer to the new closing NUL in @@ -31,13 +14,11 @@ #define strmov strmov_overlapp #endif -#ifndef strmov - #if !defined(MC68000) && !defined(DS90) char *strmov(register char *dst, register const char *src) { - while ((*dst++ = *src++)) ; + while (*dst++ = *src++) ; return dst-1; } @@ -55,5 +36,3 @@ char *strmov(dst, src) } #endif - -#endif /* strmov */ diff --git a/ext/mysql/libmysql/strnmov.c b/ext/mysql/libmysql/strnmov.c index ffc4a62f75..2e93908524 100644 --- a/ext/mysql/libmysql/strnmov.c +++ b/ext/mysql/libmysql/strnmov.c @@ -1,20 +1,3 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - /* strnmov(dst,src,length) moves length characters, or until end, of src to dst and appends a closing NUL to dst if src is shorter than length. diff --git a/ext/mysql/libmysql/strto.c b/ext/mysql/libmysql/strto.c index eb8caab2ab..a2acd9c786 100644 --- a/ext/mysql/libmysql/strto.c +++ b/ext/mysql/libmysql/strto.c @@ -1,20 +1,3 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - /* strtol,strtoul,strtoll,strtoull convert string to long, unsigned long, long long or unsigned long long. diff --git a/ext/mysql/libmysql/strtoll.c b/ext/mysql/libmysql/strtoll.c index f43dae726f..3b8f9bf368 100644 --- a/ext/mysql/libmysql/strtoll.c +++ b/ext/mysql/libmysql/strtoll.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright (C) 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + For a more info consult the file COPYRIGHT distributed with this file */ /* This is defines strtoll() if neaded */ diff --git a/ext/mysql/libmysql/strtoull.c b/ext/mysql/libmysql/strtoull.c index 42ce5ea417..fbb23e0f20 100644 --- a/ext/mysql/libmysql/strtoull.c +++ b/ext/mysql/libmysql/strtoull.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright (C) 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + For a more info consult the file COPYRIGHT distributed with this file */ /* This is defines strtoull() */ diff --git a/ext/mysql/libmysql/strxmov.c b/ext/mysql/libmysql/strxmov.c index 7ee1d303ee..13811d043f 100644 --- a/ext/mysql/libmysql/strxmov.c +++ b/ext/mysql/libmysql/strxmov.c @@ -23,7 +23,7 @@ char *strxmov(char *dst,const char *src, ...) va_start(pvar,src); while (src != NullS) { - while ((*dst++ = *src++)) ; + while (*dst++ = *src++) ; dst--; src = va_arg(pvar, char *); } diff --git a/ext/mysql/libmysql/thr_alarm.h b/ext/mysql/libmysql/thr_alarm.h index 0c268c09f0..b2c599f697 100644 --- a/ext/mysql/libmysql/thr_alarm.h +++ b/ext/mysql/libmysql/thr_alarm.h @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Prototypes when using thr_alarm library functions */ @@ -23,13 +9,6 @@ extern "C" { #endif -typedef struct st_alarm { - ulong expire_time; - int alarmed; /* 1 when alarm is due */ - pthread_t thread; - my_bool malloced; -} ALARM; - #ifndef USE_ALARM_THREAD #define USE_ONE_SIGNAL_HAND /* One must call process_alarm */ #endif @@ -67,10 +46,10 @@ typedef struct st_win_timer #else -#ifdef __WIN__ +#ifdef __WIN32__ typedef struct st_win_timer { - rf_SetTimer crono; + uint crono; } thr_alarm_t; bool thr_got_alarm(thr_alarm_t *alrm); @@ -87,9 +66,9 @@ typedef int* thr_alarm_t; void init_thr_alarm(uint max_alarm); void thr_alarm_kill(pthread_t thread_id); sig_handler process_alarm(int); -#endif /* __WIN__ */ +#endif /* __WIN32__ */ -bool thr_alarm(thr_alarm_t *alarmed,uint sec, ALARM *buff); +bool thr_alarm(thr_alarm_t *alarmed,uint sec); void thr_end_alarm(thr_alarm_t *alarmed); void end_thr_alarm(void); #endif /* DONT_USE_THR_ALARM */ diff --git a/ext/mysql/libmysql/thr_mutex.c b/ext/mysql/libmysql/thr_mutex.c index 9b9c7a8e40..3ac2013efd 100644 --- a/ext/mysql/libmysql/thr_mutex.c +++ b/ext/mysql/libmysql/thr_mutex.c @@ -1,32 +1,18 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* This makes a wrapper for mutex handling to make it easier to debug mutex */ #include <global.h> -#if defined(HAVE_LINUXTHREADS) && !defined (__USE_UNIX98) -#define __USE_UNIX98 /* To get rw locks under Linux */ +#ifdef HAVE_LINUXTHREADS /* Some extra safety */ +#define __USE_UNIX98 #endif #include <m_string.h> #if defined(THREAD) && defined(SAFE_MUTEX) -#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */ +#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */ #include <my_pthread.h> -#ifndef DO_NOT_REMOVE_THREAD_WRAPPERS + /* Remove wrappers */ #undef pthread_mutex_init #undef pthread_mutex_lock @@ -37,17 +23,15 @@ #ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT #define pthread_mutex_init(a,b) my_pthread_mutex_init((a),(b)) #endif -#endif /* DO_NOT_REMOVE_THREAD_WRAPPERS */ -int safe_mutex_init(safe_mutex_t *mp, - const pthread_mutexattr_t *attr __attribute__((unused))) +int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr) { bzero((char*) mp,sizeof(*mp)); #ifdef HAVE_LINUXTHREADS /* Some extra safety */ { pthread_mutexattr_t tmp; pthread_mutexattr_init(&tmp); - pthread_mutexattr_setkind_np(&tmp,PTHREAD_MUTEX_ERRORCHECK_NP); + pthread_mutexattr_settype(&tmp,PTHREAD_MUTEX_ERRORCHECK_NP); pthread_mutex_init(&mp->global,&tmp); pthread_mutex_init(&mp->mutex, &tmp); pthread_mutexattr_destroy(&tmp); @@ -199,16 +183,16 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, return error; } -int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line) +int safe_mutex_destroy(safe_mutex_t *mp) { if (mp->count != 0) { - fprintf(stderr,"safe_mutex: Trying to destroy a mutex that was locked at %s, line %d at %s, line %d\n", - mp->file,mp->line, file, line); + fprintf(stderr,"safe_mutex: Trying to destroy a mutex that was locked at %s, line %d\n", + mp->file,mp->line); abort(); } pthread_mutex_destroy(&mp->global); return pthread_mutex_destroy(&mp->mutex); } -#endif /* THREAD && SAFE_MUTEX */ +#endif /* SAFE_MUTEX */ diff --git a/ext/mysql/libmysql/typelib.c b/ext/mysql/libmysql/typelib.c index 903a730406..2612d2c9a0 100644 --- a/ext/mysql/libmysql/typelib.c +++ b/ext/mysql/libmysql/typelib.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ /* Functions to handle typelib */ @@ -34,8 +20,7 @@ int find_type(my_string x, TYPELIB *typelib, uint full_name) { int find,pos,findpos; - reg1 my_string i; - reg2 const char *j; + reg1 my_string i,j; DBUG_ENTER("find_type"); DBUG_PRINT("enter",("x: '%s' lib: %lx",x,typelib)); @@ -98,9 +83,9 @@ void make_type(register my_string to, register uint nr, register TYPELIB *typeli /* Get type */ /* Warning first type is 0 */ -const char *get_type(TYPELIB *typelib, uint nr) +my_string get_type(TYPELIB *typelib, uint nr) { if (nr < (uint) typelib->count && typelib->type_names) return(typelib->type_names[nr]); - return "?"; + return((char*) "?"); } diff --git a/ext/mysql/libmysql/violite.c b/ext/mysql/libmysql/violite.c index 349a6fbd84..396abfd2db 100644 --- a/ext/mysql/libmysql/violite.c +++ b/ext/mysql/libmysql/violite.c @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 2000 Monty Program KB + This file is public domain and comes with NO WARRANTY of any kind */ /* Note that we can't have assertion on file descriptors; The reason for @@ -39,22 +25,22 @@ #undef HAVE_FCNTL #endif /* defined(__EMX__) */ -#if defined(MSDOS) || defined(__WIN__) -#ifdef __WIN__ +#if defined(MSDOS) || defined(__WIN32__) +#ifdef __WIN32__ #undef errno #undef EINTR #undef EAGAIN #define errno WSAGetLastError() #define EINTR WSAEINTR #define EAGAIN WSAEINPROGRESS -#endif /* __WIN__ */ +#endif /* __WIN32__ */ #define O_NONBLOCK 1 /* For emulation of fcntl() */ #endif #ifndef EWOULDBLOCK #define EWOULDBLOCK EAGAIN #endif -#ifndef __WIN__ +#ifndef __WIN32__ #define HANDLE void * #endif @@ -99,11 +85,11 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost) { vio_reset(vio, type, sd, 0, localhost); sprintf(vio->desc, "socket (%d)", vio->sd); -#if !defined(___WIN__) && !defined(__EMX__) +#if !defined(___WIN32__) && !defined(__EMX__) #if !defined(NO_FCNTL_NONBLOCK) vio->fcntl_mode = fcntl(sd, F_GETFL); #endif -#else /* !defined(__WIN__) && !defined(__EMX__) */ +#else /* !defined(__WIN32__) && !defined(__EMX__) */ { /* set to blocking mode by default */ ulong arg=0; @@ -115,7 +101,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost) } -#ifdef __WIN__ +#ifdef __WIN32__ Vio *vio_new_win32pipe(HANDLE hPipe) { @@ -154,7 +140,7 @@ int vio_read(Vio * vio, gptr buf, int size) int r; DBUG_ENTER("vio_read"); DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size)); -#ifdef __WIN__ +#ifdef __WIN32__ if (vio->type == VIO_TYPE_NAMEDPIPE) { DWORD length; @@ -166,7 +152,7 @@ int vio_read(Vio * vio, gptr buf, int size) #else errno=0; /* For linux */ r = read(vio->sd, buf, size); -#endif /* __WIN__ */ +#endif /* __WIN32__ */ #ifndef DBUG_OFF if (r < 0) { @@ -183,7 +169,7 @@ int vio_write(Vio * vio, const gptr buf, int size) int r; DBUG_ENTER("vio_write"); DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size)); -#ifdef __WIN__ +#ifdef __WIN32__ if ( vio->type == VIO_TYPE_NAMEDPIPE) { DWORD length; @@ -194,7 +180,7 @@ int vio_write(Vio * vio, const gptr buf, int size) r = send(vio->sd, buf, size,0); #else r = write(vio->sd, buf, size); -#endif /* __WIN__ */ +#endif /* __WIN32__ */ #ifndef DBUG_OFF if (r < 0) { @@ -212,7 +198,7 @@ int vio_blocking(Vio * vio, my_bool set_blocking_mode) DBUG_ENTER("vio_blocking"); DBUG_PRINT("enter", ("set_blocking_mode: %d", (int) set_blocking_mode)); -#if !defined(___WIN__) && !defined(__EMX__) +#if !defined(___WIN32__) && !defined(__EMX__) #if !defined(NO_FCNTL_NONBLOCK) if (vio->sd >= 0) @@ -226,7 +212,7 @@ int vio_blocking(Vio * vio, my_bool set_blocking_mode) r = fcntl(vio->sd, F_SETFL, vio->fcntl_mode); } #endif /* !defined(NO_FCNTL_NONBLOCK) */ -#else /* !defined(__WIN__) && !defined(__EMX__) */ +#else /* !defined(__WIN32__) && !defined(__EMX__) */ #ifndef __EMX__ if (vio->type != VIO_TYPE_NAMEDPIPE) #endif @@ -246,7 +232,7 @@ int vio_blocking(Vio * vio, my_bool set_blocking_mode) if (old_fcntl != vio->fcntl_mode) r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg)); } -#endif /* !defined(__WIN__) && !defined(__EMX__) */ +#endif /* !defined(__WIN32__) && !defined(__EMX__) */ DBUG_RETURN(r); } @@ -318,7 +304,7 @@ int vio_close(Vio * vio) { int r; DBUG_ENTER("vio_close"); -#ifdef __WIN__ +#ifdef __WIN32__ if (vio->type == VIO_TYPE_NAMEDPIPE) { #if defined(__NT__) && defined(MYSQL_SERVER) @@ -328,7 +314,7 @@ int vio_close(Vio * vio) r=CloseHandle(vio->hPipe); } else if (vio->type != VIO_CLOSED) -#endif /* __WIN__ */ +#endif /* __WIN32__ */ { r=0; if (shutdown(vio->sd,2)) diff --git a/ext/mysql/libmysql/violite.h b/ext/mysql/libmysql/violite.h index e7c3e8ede8..476e0ea16f 100644 --- a/ext/mysql/libmysql/violite.h +++ b/ext/mysql/libmysql/violite.h @@ -1,19 +1,5 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright Abandoned 2000 Monty Program KB + This file is public domain and comes with NO WARRANTY of any kind */ /* * Vio Lite. @@ -47,7 +33,7 @@ enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, Vio* vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost); -#ifdef __WIN__ +#ifdef __WIN32__ Vio* vio_new_win32pipe(HANDLE hPipe); #endif void vio_delete(Vio* vio); |