Fixes for Ia64

This commit is contained in:
monty@donna.mysql.com 2000-08-23 15:02:27 +03:00
parent 7ef8d67d6b
commit d564acf14e
30 changed files with 173 additions and 142 deletions

View File

@ -5004,12 +5004,11 @@ and that provides output about what is happening.
@xref{Debugging server}. @xref{Debugging server}.
@item @item
If your client programs are using threads, you need to compile the If your client programs are using threads, you need to also compile a
@strong{MySQL} client library to be thread safe with thread safe version of the @strong{MySQL} client library with the
@code{--with-thread-safe-client}; this forces the library to use thread @code{--with-thread-safe-client} configure options. This will create a
safe functions calls for some functions that are not thread safe by @code{libmysqlclient_r} library with which you should link your threaded
default. You pay a very small performance penalty by doing this, but applications. @xref{Thread-safe clients}.
generally it's quite safe to use this option.
@item @item
Options that pertain to particular systems can be found in the Options that pertain to particular systems can be found in the
@ -30101,24 +30100,8 @@ The @strong{MySQL} server shrinks each communication buffer to
the buffer associated with a connection is not decreased until the connection the buffer associated with a connection is not decreased until the connection
is closed, at which time client memory is reclaimed. is closed, at which time client memory is reclaimed.
If you are programming with threads, you should compile the For programming with threads, consult the 'how to make a thread safe
@strong{MySQL} C API with @code{--with-thread-safe-client}. This will make client' chapter. @xref{Thread-safe clients}.
the C API thread safe per connection. You can let two threads share the same
connection as long as you do the following:
@table @asis
@item
Two threads can't send a query to the @strong{MySQL} at the same time on
the same connection. In particular you have to ensure that between a
@code{mysql_query()} and @code{mysql_store_result()} no other thread is using
the same connection.
@item
Many threads can access different result sets that are retrieved with
@code{mysql_store_result()}.
@item
If you use @code{mysql_use_result}, you have to ensure that no other thread
is asking anything on the same connection until the result set is closed.
@end table
@node C API datatypes, C API function overview, C, Clients @node C API datatypes, C API function overview, C, Clients
@section C API datatypes @section C API datatypes
@ -32769,18 +32752,21 @@ have your own alarm that can break a long read to a server. If you
install an interrupt handlers for the @code{SIGPIPE} interrupt, install an interrupt handlers for the @code{SIGPIPE} interrupt,
the socket handling should be thread safe. the socket handling should be thread safe.
In the standard binaries we distribute on our web site, the client libraries In the older binaries we distribute on our web site, the client
are not normally compiled with the thread safe option. libraries are not normally compiled with the thread safe option (the
windows binaries are however by default compiled to be thread safe).
Newer binary distributions should however have both a normal and a
threadsafe client library.
To get a really thread-safe client where you can interrupt the client To get a really thread-safe client where you can interrupt the client
from other threads and set timeouts when talking with the MySQL server, from other threads and set timeouts when talking with the MySQL server,
you should use the @code{-lmysys}, @code{-lstring} and @code{-ldbug} you should use the @code{-lmysys}, @code{-lstring} and @code{-ldbug}
libraries and the @code{net_serv.o} code that the server uses. libraries and the @code{net_serv.o} code that the server uses.
If you don't need interrupts or timeouts you can just compile the client If you don't need interrupts or timeouts you can just compile a tread
library @code{(mysqlclient)} to be thread safe and use this. In this safe client library @code{(mysqlclient_r)} and use this. @xref{C,,
case you don't have to worry about the @code{net_serv.o} object file or MySQL C API}. In this case you don't have to worry about the
the other @strong{MySQL} libraries. @code{net_serv.o} object file or the other @strong{MySQL} libraries.
When using a threaded client and you want to use timeouts and interrupts, When using a threaded client and you want to use timeouts and interrupts,
you can make great use of the routines in the @file{thr_alarm.c} file. you can make great use of the routines in the @file{thr_alarm.c} file.
@ -32798,36 +32784,43 @@ To make @code{mysql_real_connect()} thread-safe, you must recompile the
client library with this command: client library with this command:
@example @example
shell> ./configure --enable-thread-safe-client shell> ./configure --with-thread-safe-client
@end example @end example
This will ensure that the client library will use the header files required This will create a thread safe client library @code{libmysqlclient_r}.
for thread safe programs and also that @code{mysql_real_connect()} will use @code{--with-thread-safe-client}. This library is is thread safe per
a thread safe version of the @code{gethostbyname()} call. connection. You can let two threads share the same connection as long
as you do the following:
You may get some errors because of undefined symbols when linking the @table @asis
standard client, because the pthread libraries are not included by @item
default. Two threads can't send a query to the @strong{MySQL} at the same time on
the same connection. In particular you have to ensure that between a
The resulting @file{libmysqlclient.a} library is now thread-safe. What this @code{mysql_query()} and @code{mysql_store_result()} no other thread is using
means is that client code is thread-safe as long as two threads don't query the same connection.
the same connection handle returned by @code{mysql_real_connect()} at the @item
same time; the client/server protocol allows only one request at a time on a Many threads can access different result sets that are retrieved with
given connection. If you want to use multiple threads on the same @code{mysql_store_result()}.
connection, you must have a mutex lock around your @code{mysql_query()} and @item
If you use @code{mysql_use_result}, you have to ensure that no other thread
is asking anything on the same connection until the result set is closed.
However, it really is best for threaded clients that share the same
connection to use @code{mysql_use_result()}.
@item
If you want to use multiple threads on the same connection, you must
have a mutex lock around your @code{mysql_query()} and
@code{mysql_store_result()} call combination. Once @code{mysql_store_result()} call combination. Once
@code{mysql_store_result()} is ready, the lock can be released and other @code{mysql_store_result()} is ready, the lock can be released and other
threads may query the same connection. (In other words, different threads threads may query the same connection.
can use different @code{MYSQL_RES} pointers that were created with @item
@code{mysql_store_result()}, as long as they use the proper locking If you program with POSIX threads, you can use
protocol.) If you program with POSIX threads, you can use @code{pthread_mutex_lock()} and @code{pthread_mutex_unlock()} to
@code{pthread_mutex_lock()} and @code{pthread_mutex_unlock()} to establish establish and release a mutex lock.
and release a mutex lock. @end table
If you used @code{mysql_use_result()} rather than @code{mysql_store_result()}, You may get some errors because of undefined symbols when linking your
the lock would need to surround @code{mysql_use_result()} and the calls client with @code{mysqlclient_r}; In most cases this is because you haven't
to @code{mysql_fetch_row()}. However, it really is best for threaded included the thread libraries on the link/compile line.
clients not to use @code{mysql_use_result()}.
@node Perl, Eiffel, C API functions, Clients @node Perl, Eiffel, C API functions, Clients
@section MySQL Perl API @section MySQL Perl API
@ -34652,9 +34645,8 @@ The @strong{MySQL} GUI client homepage. By Sinisa at MySQL AB.
An administration tool for the @strong{MySQL} server using QT / KDE. Tested An administration tool for the @strong{MySQL} server using QT / KDE. Tested
only on Linux. only on Linux.
@item @uref{http://www.mysql.com/Downloads/Contrib/mysql-admin-using-java+swing.tar.gz, Java client @item @uref{http://www.mysql.com/Downloads/Contrib/mysql-admin-using-java+swing.tar.gz, Java client using Swing} By Fredy Fischer, @email{se-afs@@dial.eunet.ch}.
using Swing} By Fredy Fischer, @email{se-afs@@dial.eunet.ch}. You can You can always find the latest version
always find the latest version
@uref{http://www.trash.net/~ffischer/admin/index.html, here}. @uref{http://www.trash.net/~ffischer/admin/index.html, here}.
@item @uref{http://www.mysql.com/Downloads/Contrib/mysqlwinadmn.zip, mysqlwinadmn.zip} @item @uref{http://www.mysql.com/Downloads/Contrib/mysqlwinadmn.zip, mysqlwinadmn.zip}
@ -34676,6 +34668,14 @@ URL @url{http://www.it-netservice.de/pages/software/index.html}.
Home page for this can be found at: @uref{http://www.artronic.hr}. Home page for this can be found at: @uref{http://www.artronic.hr}.
@item @uref{http://www.mysql.com/Downloads/Win32/W9xstop.zip,Utility from Artronic to stop MySQL on win9x} @item @uref{http://www.mysql.com/Downloads/Win32/W9xstop.zip,Utility from Artronic to stop MySQL on win9x}
@item @uref{http://dbtools.vila.bol.com.br/, Dbtools}
A tool to manage @strong{MySQL} databases. Currently only for Win32.
Some features:
@itemize @bullet
@item manage servers, databases, tables, columns, indexes and users
@item import wizard to import structure and data from a MS Access, MS Excel, Dbase, FoxPro, Paradox and ODBC Databases.
@end itemize
@item @uref{http://www.mysql.com/Downloads/Contrib/xmysqladmin-1.0.tar.gz, xmysqladmin-1.0.tar.gz} @item @uref{http://www.mysql.com/Downloads/Contrib/xmysqladmin-1.0.tar.gz, xmysqladmin-1.0.tar.gz}
An X based front end to the @strong{MySQL} database engine. It allows reloads, An X based front end to the @strong{MySQL} database engine. It allows reloads,
status check, process control, myisamchk, grant/revoke privileges, status check, process control, myisamchk, grant/revoke privileges,

View File

@ -1,6 +1,6 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This library is free software; you can redistribute it and/or This program file is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version. version 2 of the License, or (at your option) any later version.
@ -127,7 +127,7 @@ bool String::set(double num,uint decimals)
if (decimals >= NOT_FIXED_DEC) if (decimals >= NOT_FIXED_DEC)
{ {
sprintf(buff,"%.14g",num); // Enough for a DATETIME sprintf(buff,"%.14g",num); // Enough for a DATETIME
return copy(buff,strlen(buff)); return copy(buff, (uint32) strlen(buff));
} }
#ifdef HAVE_FCONVERT #ifdef HAVE_FCONVERT
int decpt,sign; int decpt,sign;
@ -142,7 +142,7 @@ bool String::set(double num,uint decimals)
buff[0]='-'; buff[0]='-';
pos=buff; pos=buff;
} }
return copy(pos,strlen(pos)); return copy(pos,(uint32) strlen(pos));
} }
if (alloc((uint32) ((uint32) decpt+3+decimals))) if (alloc((uint32) ((uint32) decpt+3+decimals)))
return TRUE; return TRUE;
@ -186,12 +186,13 @@ end:
str_length=(uint32) (to-Ptr); str_length=(uint32) (to-Ptr);
return FALSE; return FALSE;
#else #else
#ifdef HAVE_SNPRINTF_ #ifdef HAVE_SNPRINTF
snprintf(buff,sizeof(buff), "%.*f",(int) decimals,num); buff[sizeof(buff)-1]=0; // Safety
snprintf(buff,sizeof(buff)-1, "%.*f",(int) decimals,num);
#else #else
sprintf(buff,"%.*f",(int) decimals,num); sprintf(buff,"%.*f",(int) decimals,num);
#endif #endif
return copy(buff,strlen(buff)); return copy(buff,(uint32) strlen(buff));
#endif #endif
} }
@ -260,7 +261,7 @@ bool String::append(const String &s)
bool String::append(const char *s,uint32 arg_length) bool String::append(const char *s,uint32 arg_length)
{ {
if (!arg_length) // Default argument if (!arg_length) // Default argument
arg_length=strlen(s); arg_length= (uint32) strlen(s);
if (realloc(str_length+arg_length)) if (realloc(str_length+arg_length))
return TRUE; return TRUE;
memcpy(Ptr+str_length,s,arg_length); memcpy(Ptr+str_length,s,arg_length);
@ -268,6 +269,19 @@ bool String::append(const char *s,uint32 arg_length)
return FALSE; return FALSE;
} }
bool String::append(FILE* file, uint32 arg_length, myf my_flags)
{
if (realloc(str_length+arg_length))
return TRUE;
if (my_fread(file, (byte*) Ptr + str_length, arg_length, my_flags))
{
shrink(str_length);
return TRUE;
}
str_length+=arg_length;
return FALSE;
}
uint32 String::numchars() uint32 String::numchars()
{ {
#ifdef USE_MB #ifdef USE_MB
@ -305,7 +319,7 @@ int String::charpos(int i,uint32 offset)
if ( INT_MAX32-i <= (int) (mbstr-Ptr-offset)) if ( INT_MAX32-i <= (int) (mbstr-Ptr-offset))
return INT_MAX32; return INT_MAX32;
else else
return (mbstr-Ptr-offset)+i; return (int) ((mbstr-Ptr-offset)+i);
} }
else else
#endif #endif
@ -317,7 +331,7 @@ int String::strstr(const String &s,uint32 offset)
if (s.length()+offset <= str_length) if (s.length()+offset <= str_length)
{ {
if (!s.length()) if (!s.length())
return offset; // Empty string is always found return ((int) offset); // Empty string is always found
register const char *str = Ptr+offset; register const char *str = Ptr+offset;
register const char *search=s.ptr(); register const char *search=s.ptr();
@ -587,6 +601,7 @@ static int wild_case_compare(const char *str,const char *str_end,
#ifdef USE_MB #ifdef USE_MB
const char* mb = wildstr; const char* mb = wildstr;
int mblen; int mblen;
LINT_INIT(mblen);
if (use_mb_flag) if (use_mb_flag)
mblen = my_ismbchar(default_charset_info, wildstr, wildend); mblen = my_ismbchar(default_charset_info, wildstr, wildend);
#endif #endif

View File

@ -36,7 +36,7 @@ public:
String(uint32 length_arg) String(uint32 length_arg)
{ alloced=0; Alloced_length=0; (void) real_alloc(length_arg); } { alloced=0; Alloced_length=0; (void) real_alloc(length_arg); }
String(const char *str) String(const char *str)
{ Ptr=(char*) str; str_length=strlen(str); Alloced_length=0; alloced=0;} { Ptr=(char*) str; str_length=(uint) strlen(str); Alloced_length=0; alloced=0;}
String(const char *str,uint32 len) String(const char *str,uint32 len)
{ Ptr=(char*) str; str_length=len; Alloced_length=0; alloced=0;} { Ptr=(char*) str; str_length=len; Alloced_length=0; alloced=0;}
String(char *str,uint32 len) String(char *str,uint32 len)
@ -45,7 +45,7 @@ public:
{ Ptr=str.Ptr ; str_length=str.str_length ; { Ptr=str.Ptr ; str_length=str.str_length ;
Alloced_length=str.Alloced_length; alloced=0; } Alloced_length=str.Alloced_length; alloced=0; }
static void *operator new(size_t size) { return (void*) sql_alloc(size); } static void *operator new(size_t size) { return (void*) sql_alloc((uint) size); }
static void operator delete(void *ptr_arg,size_t size) /*lint -e715 */ static void operator delete(void *ptr_arg,size_t size) /*lint -e715 */
{ sql_element_free(ptr_arg); } { sql_element_free(ptr_arg); }
~String() { free(); } ~String() { free(); }
@ -123,7 +123,7 @@ public:
if (arg_length < Alloced_length) if (arg_length < Alloced_length)
{ {
char *new_ptr; char *new_ptr;
if (!(new_ptr=my_realloc(Ptr,arg_length,MYF(0)))) if (!(new_ptr=(char*) my_realloc(Ptr,arg_length,MYF(0))))
{ {
(void) my_free(Ptr,MYF(0)); (void) my_free(Ptr,MYF(0));
real_alloc(arg_length); real_alloc(arg_length);
@ -152,6 +152,7 @@ public:
bool copy(const char *s,uint32 arg_length); // Allocate new string bool copy(const char *s,uint32 arg_length); // Allocate new string
bool append(const String &s); bool append(const String &s);
bool append(const char *s,uint32 arg_length=0); bool append(const char *s,uint32 arg_length=0);
bool append(FILE* file, uint32 arg_length, myf my_flags);
int strstr(const String &search,uint32 offset=0); // Returns offset to substring or -1 int strstr(const String &search,uint32 offset=0); // Returns offset to substring or -1
int strrstr(const String &search,uint32 offset=0); // Returns offset to substring or -1 int strrstr(const String &search,uint32 offset=0); // Returns offset to substring or -1
bool replace(uint32 offset,uint32 arg_length,const String &to); bool replace(uint32 offset,uint32 arg_length,const String &to);

View File

@ -272,7 +272,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
pa->max_length=PS_MALLOC-MALLOC_OVERHEAD; pa->max_length=PS_MALLOC-MALLOC_OVERHEAD;
pa->array_allocs=1; pa->array_allocs=1;
} }
length=strlen(name)+1; length=(uint) strlen(name)+1;
if (pa->length+length >= pa->max_length) if (pa->length+length >= pa->max_length)
{ {
if (!(new_pos= (byte*) my_realloc((gptr) pa->str, if (!(new_pos= (byte*) my_realloc((gptr) pa->str,
@ -415,7 +415,7 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count,
DBUG_RETURN(0); DBUG_RETURN(0);
} }
states+=len+1; states+=len+1;
result_len+=strlen(to[i])+1; result_len+=(uint) strlen(to[i])+1;
if (len > max_length) if (len > max_length)
max_length=len; max_length=len;
} }
@ -1021,7 +1021,7 @@ FILE *in,*out;
end_of_line++; end_of_line++;
if (end_of_line == buffer+bufbytes) if (end_of_line == buffer+bufbytes)
{ {
retain=end_of_line - start_of_line; retain= (int) (end_of_line - start_of_line);
break; /* No end of line, read more */ break; /* No end of line, read more */
} }
save_char=end_of_line[0]; save_char=end_of_line[0];

View File

@ -32,11 +32,17 @@
#define SYSTEM_TYPE "Win95/Win98" #define SYSTEM_TYPE "Win95/Win98"
#endif #endif
#ifdef _WIN32 #ifdef _WIN64
#define MACHINE_TYPE "i32" /* Define to machine type name */
#else
#define MACHINE_TYPE "i64" /* Define to machine type name */ #define MACHINE_TYPE "i64" /* Define to machine type name */
#else
#define MACHINE_TYPE "i32" /* Define to machine type name */
#ifndef _WIN32
#define _WIN32 /* Compatible with old source */
#endif #endif
#ifndef __WIN32__
#define __WIN32__
#endif
#endif /* _WIN64 */
#ifndef __WIN__ #ifndef __WIN__
#define __WIN__ /* To make it easier in VC++ */ #define __WIN__ /* To make it easier in VC++ */
#endif #endif

View File

@ -21,7 +21,7 @@
#ifndef _global_h #ifndef _global_h
#define _global_h #define _global_h
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
#include <config-win.h> #include <config-win.h>
#else #else
#include <my_config.h> #include <my_config.h>
@ -54,7 +54,9 @@
#endif #endif
#if defined(THREAD) && !defined(__WIN__) #if defined(THREAD) && !defined(__WIN__)
#ifndef _POSIX_PTHREAD_SEMANTICS
#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ #define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
#endif
/* was #if defined(HAVE_LINUXTHREADS) || defined(HAVE_DEC_THREADS) || defined(HPUX) */ /* was #if defined(HAVE_LINUXTHREADS) || defined(HAVE_DEC_THREADS) || defined(HPUX) */
#if !defined(SCO) #if !defined(SCO)
#define _REENTRANT 1 /* Some thread libraries require this */ #define _REENTRANT 1 /* Some thread libraries require this */

View File

@ -241,11 +241,12 @@ int nisam_create(const char *name,uint keys,N_KEYDEF *keyinfo,
share.base.keystart = share.state.key_file_length=MY_ALIGN(info_length, share.base.keystart = share.state.key_file_length=MY_ALIGN(info_length,
nisam_block_size); nisam_block_size);
share.base.max_block=max_block; share.base.max_block=max_block;
share.base.max_key_length=ALIGN_SIZE(max_key_length+4); share.base.max_key_length=(uint) ALIGN_SIZE(max_key_length+4);
share.base.records=records; share.base.records=records;
share.base.reloc=reloc; share.base.reloc=reloc;
share.base.reclength=reclength; share.base.reclength=reclength;
share.base.pack_reclength=reclength+packed-share.base.blobs*sizeof(char*); share.base.pack_reclength=
(uint) (reclength+packed-share.base.blobs*sizeof(char*));
share.base.max_pack_length=pack_reclength; share.base.max_pack_length=pack_reclength;
share.base.min_pack_length=min_pack_length; share.base.min_pack_length=min_pack_length;
share.base.pack_bits=packed; share.base.pack_bits=packed;

View File

@ -439,7 +439,7 @@ static int underflow(register N_INFO *info, register N_KEYDEF *keyinfo,
t_length=(int) _nisam_get_pack_key_length(keyinfo,nod_flag,(uchar*) 0, t_length=(int) _nisam_get_pack_key_length(keyinfo,nod_flag,(uchar*) 0,
(uchar*) 0, leaf_key,&s_temp); (uchar*) 0, leaf_key,&s_temp);
s_temp.n_length= *half_pos; /* For _nisam_store_key */ s_temp.n_length= *half_pos; /* For _nisam_store_key */
length=(buff+getint(buff))-half_pos; length=(uint) ((buff+getint(buff))-half_pos);
bmove((byte*) buff+p_length+t_length,(byte*) half_pos,(size_t) length); bmove((byte*) buff+p_length+t_length,(byte*) half_pos,(size_t) length);
_nisam_store_key(keyinfo,buff+p_length,&s_temp); _nisam_store_key(keyinfo,buff+p_length,&s_temp);
putint(buff,length+t_length+p_length,nod_flag); putint(buff,length+t_length+p_length,nod_flag);
@ -566,7 +566,7 @@ static uint remove_key(N_KEYDEF *keyinfo, uint nod_flag,
else else
{ /* Let keypos point at next key */ { /* Let keypos point at next key */
VOID((*keyinfo->get_key)(keyinfo,nod_flag,&keypos,lastkey)); VOID((*keyinfo->get_key)(keyinfo,nod_flag,&keypos,lastkey));
s_length=(keypos-start); s_length=(uint) (keypos-start);
if (keyinfo->base.flag & HA_PACK_KEY) if (keyinfo->base.flag & HA_PACK_KEY)
{ {
diff_flag= (keyinfo->seg[0].base.flag & HA_SPACE_PACK); diff_flag= (keyinfo->seg[0].base.flag & HA_SPACE_PACK);
@ -576,12 +576,12 @@ static uint remove_key(N_KEYDEF *keyinfo, uint nod_flag,
if ((r_length= *keypos++ & 127) == 0) if ((r_length= *keypos++ & 127) == 0)
{ /* Same key after */ { /* Same key after */
if (first & 128) if (first & 128)
start++; /* Skipp ref length */ start++; /* Skip ref length */
if (diff_flag) if (diff_flag)
start+= *start+1; /* Skipp key length */ start+= *start+1; /* Skip key length */
else else
start+=keyinfo->seg[0].base.length- (first & 127); start+=keyinfo->seg[0].base.length- (first & 127);
s_length=(keypos-start); /* Remove pointers and next-key-flag */ s_length=(uint)(keypos-start); /* Remove pntrs and next-key-flag */
} }
else if (! (first & 128)) else if (! (first & 128))
{ /* Deleted key was not compressed */ { /* Deleted key was not compressed */
@ -589,12 +589,12 @@ static uint remove_key(N_KEYDEF *keyinfo, uint nod_flag,
{ {
*start= (uchar) (r_length+ *keypos); *start= (uchar) (r_length+ *keypos);
start+=r_length+1; /* Let ref-part remain */ start+=r_length+1; /* Let ref-part remain */
s_length=(keypos-start)+1; /* Skipp everything between */ s_length=(uint) (keypos-start)+1; /* Skip everything between */
} }
else else
{ {
start+=r_length+1; /* Let ref-part remain */ start+=r_length+1; /* Let ref-part remain */
s_length=(keypos-start); /* Skipp everything between */ s_length=(uint) (keypos-start); /* Skip everything between */
} }
} }
else if ((first & 127) < r_length) else if ((first & 127) < r_length)
@ -604,7 +604,7 @@ static uint remove_key(N_KEYDEF *keyinfo, uint nod_flag,
if (diff_flag) if (diff_flag)
*start++= (uchar) (*keypos++ + r_length); *start++= (uchar) (*keypos++ + r_length);
start+= r_length; start+= r_length;
s_length=(keypos-start); /* Skipp everything between */ s_length=(uint) (keypos-start); /* Skip everything between */
} }
} }
} }
@ -613,3 +613,5 @@ static uint remove_key(N_KEYDEF *keyinfo, uint nod_flag,
(uint) (page_end-start-s_length)); (uint) (page_end-start-s_length));
DBUG_RETURN((uint) s_length); DBUG_RETURN((uint) s_length);
} /* remove_key */ } /* remove_key */

View File

@ -247,7 +247,7 @@ int _nisam_insert(register N_INFO *info, register N_KEYDEF *keyinfo,
s_temp.n_ref_length,s_temp.n_length,s_temp.key)); s_temp.n_ref_length,s_temp.n_length,s_temp.key));
} }
#endif #endif
key_offset = (endpos-key_pos); key_offset = (uint)(endpos-key_pos);
if((int) t_length < 0) if((int) t_length < 0)
key_offset += (int) t_length; key_offset += (int) t_length;
if (key_offset < 0) if (key_offset < 0)

View File

@ -53,6 +53,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
mf_pack.lo my_messnc.lo mf_dirname.lo mf_fn_ext.lo\ mf_pack.lo my_messnc.lo mf_dirname.lo mf_fn_ext.lo\
mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo \ mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo \
mf_format.lo mf_path.lo mf_unixpath.lo my_fopen.lo \ mf_format.lo mf_path.lo mf_unixpath.lo my_fopen.lo \
my_fstream.lo \
mf_loadpath.lo my_pthread.lo my_thr_init.lo \ mf_loadpath.lo my_pthread.lo my_thr_init.lo \
thr_mutex.lo mulalloc.lo string.lo default.lo \ thr_mutex.lo mulalloc.lo string.lo default.lo \
my_compress.lo array.lo my_once.lo list.lo my_net.lo \ my_compress.lo array.lo my_once.lo list.lo my_net.lo \

View File

@ -1269,7 +1269,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
host=LOCAL_HOST; host=LOCAL_HOST;
sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host); sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host);
DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port)); DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port));
if ((sock = socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR) /* _WIN64 ; Assume that the (int) range is enough for socket() */
if ((sock = (int) socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR)
{ {
net->last_errno=CR_IPSOCK_ERROR; net->last_errno=CR_IPSOCK_ERROR;
sprintf(net->last_error,ER(net->last_errno),ERRNO); sprintf(net->last_error,ER(net->last_errno),ERRNO);

View File

@ -326,7 +326,7 @@ net_real_write(NET *net,const char *packet,ulong len)
pos=(char*) packet; end=pos+len; pos=(char*) packet; end=pos+len;
while (pos != end) while (pos != end)
{ {
if ((int) (length=vio_write(net->vio,pos,(size_t) (end-pos))) <= 0) if ((int) (length=vio_write(net->vio,pos,(int) (end-pos))) <= 0)
{ {
my_bool interrupted = vio_should_retry(net->vio); my_bool interrupted = vio_should_retry(net->vio);
#if (!defined(__WIN__) && !defined(__EMX__)) #if (!defined(__WIN__) && !defined(__EMX__))

View File

@ -527,7 +527,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
(uchar*) 0, (uchar *) 0, (uchar*) 0, (uchar *) 0,
leaf_key, &s_temp); leaf_key, &s_temp);
/* t_length will always be > 0 for a new page !*/ /* t_length will always be > 0 for a new page !*/
length=(buff+mi_getint(buff))-half_pos; length=(uint) ((buff+mi_getint(buff))-half_pos);
bmove((byte*) buff+p_length+t_length,(byte*) half_pos,(size_t) length); bmove((byte*) buff+p_length+t_length,(byte*) half_pos,(size_t) length);
(*keyinfo->store_key)(keyinfo,buff+p_length,&s_temp); (*keyinfo->store_key)(keyinfo,buff+p_length,&s_temp);
mi_putint(buff,length+t_length+p_length,nod_flag); mi_putint(buff,length+t_length+p_length,nod_flag);
@ -683,7 +683,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag,
DBUG_RETURN(0); /* Error */ DBUG_RETURN(0); /* Error */
if (next_block && nod_flag) if (next_block && nod_flag)
*next_block= _mi_kpos(nod_flag,keypos); *next_block= _mi_kpos(nod_flag,keypos);
s_length=(keypos-start); s_length=(int) (keypos-start);
if (keypos != page_end) if (keypos != page_end)
{ {
if (keyinfo->flag & HA_BINARY_PACK_KEY) if (keyinfo->flag & HA_BINARY_PACK_KEY)
@ -699,7 +699,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag,
(next_length-prev_length)); (next_length-prev_length));
keypos-=(next_length-prev_length)+prev_pack_length; keypos-=(next_length-prev_length)+prev_pack_length;
store_key_length(keypos,prev_length); store_key_length(keypos,prev_length);
s_length=(keypos-start); s_length=(int) (keypos-start);
} }
} }
else else
@ -746,7 +746,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag,
rest_length+=tmp; rest_length+=tmp;
pack_length= prev_length ? get_pack_length(rest_length): 0; pack_length= prev_length ? get_pack_length(rest_length): 0;
keypos-=tmp+pack_length+prev_pack_length; keypos-=tmp+pack_length+prev_pack_length;
s_length=(keypos-start); s_length=(int) (keypos-start);
if (prev_length) /* Pack against prev key */ if (prev_length) /* Pack against prev key */
{ {
*keypos++= start[0]; *keypos++= start[0];

View File

@ -1588,7 +1588,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
key++; org_key++; key++; org_key++;
} }
} }
if ((new_ref_length= (key - start))) if ((new_ref_length= (uint) (key - start)))
new_ref_length+=pack_marker; new_ref_length+=pack_marker;
} }

View File

@ -799,7 +799,7 @@ String *Field_tiny::val_str(String *val_buffer,
if (unsigned_flag) if (unsigned_flag)
length= (uint) (int10_to_str((long) *((uchar*) ptr),to,10)-to); length= (uint) (int10_to_str((long) *((uchar*) ptr),to,10)-to);
else else
length=(int10_to_str((long) *((signed char*) ptr),to,-10)-to); length= (uint) (int10_to_str((long) *((signed char*) ptr),to,-10)-to);
val_buffer->length(length); val_buffer->length(length);
if (zerofill) if (zerofill)
prepend_zeros(val_buffer); prepend_zeros(val_buffer);

View File

@ -33,7 +33,7 @@ class Field {
Field(const Item &); /* Prevent use of theese */ Field(const Item &); /* Prevent use of theese */
void operator=(Field &); void operator=(Field &);
public: public:
static void *operator new(size_t size) {return (void*) sql_alloc(size); } static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); }
static void operator delete(void *ptr_arg, size_t size) {} /*lint -e715 */ static void operator delete(void *ptr_arg, size_t size) {} /*lint -e715 */
enum utype { NONE,DATE,SHIELD,NOEMPTY,CASEUP,PNR,BGNR,PGNR,YES,NO,REL, enum utype { NONE,DATE,SHIELD,NOEMPTY,CASEUP,PNR,BGNR,PGNR,YES,NO,REL,

View File

@ -26,7 +26,7 @@ class Item {
Item(const Item &); /* Prevent use of theese */ Item(const Item &); /* Prevent use of theese */
void operator=(Item &); void operator=(Item &);
public: public:
static void *operator new(size_t size) {return (void*) sql_alloc(size); } static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); }
static void operator delete(void *ptr,size_t size) {} /*lint -e715 */ static void operator delete(void *ptr,size_t size) {} /*lint -e715 */
enum Type {FIELD_ITEM,FUNC_ITEM,SUM_FUNC_ITEM,STRING_ITEM, enum Type {FIELD_ITEM,FUNC_ITEM,SUM_FUNC_ITEM,STRING_ITEM,
@ -167,7 +167,7 @@ public:
Item_int(const char *str_arg) : Item_int(const char *str_arg) :
value(str_arg[0] == '-' ? strtoll(str_arg,(char**) 0,10) : value(str_arg[0] == '-' ? strtoll(str_arg,(char**) 0,10) :
(longlong) strtoull(str_arg,(char**) 0,10)) (longlong) strtoull(str_arg,(char**) 0,10))
{ max_length=strlen(str_arg); name=(char*) str_arg;} { max_length= (uint) strlen(str_arg); name=(char*) str_arg;}
enum Type type() const { return INT_ITEM; } enum Type type() const { return INT_ITEM; }
virtual enum Item_result result_type () const { return INT_RESULT; } virtual enum Item_result result_type () const { return INT_RESULT; }
longlong val_int() { return value; } longlong val_int() { return value; }

View File

@ -418,7 +418,7 @@ redo:
i=(char*) ptr+1; j=(char*) search+1; i=(char*) ptr+1; j=(char*) search+1;
while (j != search_end) while (j != search_end)
if (*i++ != *j++) goto skipp; if (*i++ != *j++) goto skipp;
offset=ptr-res->ptr(); offset= (int) (ptr-res->ptr());
if (res->length()-from_length + to_length > max_allowed_packet) if (res->length()-from_length + to_length > max_allowed_packet)
goto null; goto null;
if (!alloced) if (!alloced)
@ -740,12 +740,12 @@ String *Item_func_substr_index::val_str(String *str)
if (c) return res; /* Not found, return original string */ if (c) return res; /* Not found, return original string */
if (count>0) /* return left part */ if (count>0) /* return left part */
{ {
tmp_value.set(*res,0,ptr-res->ptr()); tmp_value.set(*res,0,(ulong) (ptr-res->ptr()));
} }
else /* return right part */ else /* return right part */
{ {
ptr+=delimeter_length; ptr+=delimeter_length;
tmp_value.set(*res,ptr-res->ptr(),strend-ptr); tmp_value.set(*res,(ulong) (ptr-res->ptr()), (ulong) (strend-ptr));
} }
} }
} }

View File

@ -262,7 +262,7 @@ void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table)
if (locked->locks[i]->type != TL_UNLOCK) if (locked->locks[i]->type != TL_UNLOCK)
*prev++ = locked->locks[i]; *prev++ = locked->locks[i];
} }
locked->lock_count=(prev - locked->locks); locked->lock_count=(uint) (prev - locked->locks);
} }
} }

View File

@ -51,7 +51,7 @@ static int find_uniq_filename(char *name)
length=dirname_part(buff,name); length=dirname_part(buff,name);
char *start=name+length,*end=strend(start); char *start=name+length,*end=strend(start);
*end='.'; *end='.';
length=end-start+1; length= (uint) (end-start+1);
if (!(dir_info = my_dir(buff,MYF(MY_DONT_SORT)))) if (!(dir_info = my_dir(buff,MYF(MY_DONT_SORT))))
{ // This shouldn't happen { // This shouldn't happen

View File

@ -99,7 +99,7 @@ public:
{ {
time_t end_time; time_t end_time;
time(&end_time); time(&end_time);
exec_time = end_time - thd->start_time; exec_time = (ulong) (end_time - thd->start_time);
valid_exec_time = 1; valid_exec_time = 1;
db_len = (db) ? (uint) strlen(db) : 0; db_len = (db) ? (uint) strlen(db) : 0;
} }
@ -187,7 +187,7 @@ public:
{ {
time_t end_time; time_t end_time;
time(&end_time); time(&end_time);
exec_time = end_time - thd->start_time; exec_time = (ulong) (end_time - thd->start_time);
valid_exec_time = 1; valid_exec_time = 1;
db_len = (db) ? (uint) strlen(db) : 0; db_len = (db) ? (uint) strlen(db) : 0;
table_name_len = (table_name) ? (uint) strlen(table_name) : 0; table_name_len = (table_name) ? (uint) strlen(table_name) : 0;

View File

@ -326,7 +326,7 @@ net_real_write(NET *net,const char *packet,ulong len)
pos=(char*) packet; end=pos+len; pos=(char*) packet; end=pos+len;
while (pos != end) while (pos != end)
{ {
if ((int) (length=vio_write(net->vio,pos,(size_t) (end-pos))) <= 0) if ((int) (length=vio_write(net->vio,pos,(int) (end-pos))) <= 0)
{ {
my_bool interrupted = vio_should_retry(net->vio); my_bool interrupted = vio_should_retry(net->vio);
#if (!defined(__WIN__) && !defined(__EMX__)) #if (!defined(__WIN__) && !defined(__EMX__))

View File

@ -25,7 +25,7 @@
class Sql_alloc class Sql_alloc
{ {
public: public:
static void *operator new(size_t size) {return (void*) sql_alloc(size); } static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); }
static void operator delete(void *ptr, size_t size) {} /*lint -e715 */ static void operator delete(void *ptr, size_t size) {} /*lint -e715 */
inline Sql_alloc() {}; inline Sql_alloc() {};
inline ~Sql_alloc() {}; inline ~Sql_alloc() {};

View File

@ -323,7 +323,7 @@ pthread_handler_decl(handle_one_connection,arg)
{ {
THD *thd=(THD*) arg; THD *thd=(THD*) arg;
uint launch_time = uint launch_time =
(thd->thr_create_time = time(NULL)) - thd->connect_time; (uint) ((thd->thr_create_time = time(NULL)) - thd->connect_time);
if (launch_time >= slow_launch_time) if (launch_time >= slow_launch_time)
statistic_increment(slow_launch_threads,&LOCK_status ); statistic_increment(slow_launch_threads,&LOCK_status );

View File

@ -32,8 +32,7 @@ static TABLE_LIST *rename_tables(THD *thd, TABLE_LIST *table_list,
bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list) bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
{ {
bool error=1,got_all_locks=1; bool error=1,got_all_locks=1;
db_type table_type; TABLE_LIST *lock_table,*ren_table=0;
TABLE_LIST *lock_table,*ren_table=0,*new_table;
DBUG_ENTER("mysql_rename_tables"); DBUG_ENTER("mysql_rename_tables");
/* Avoid problems with a rename on a table that we have locked or /* Avoid problems with a rename on a table that we have locked or

View File

@ -2606,7 +2606,7 @@ static void clear_tables(JOIN *join)
class COND_CMP :public ilink { class COND_CMP :public ilink {
public: public:
static void *operator new(size_t size) {return (void*) sql_alloc(size); } static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); }
static void operator delete(void *ptr __attribute__((unused)), static void operator delete(void *ptr __attribute__((unused)),
size_t size __attribute__((unused))) {} /*lint -e715 */ size_t size __attribute__((unused))) {} /*lint -e715 */
@ -3229,7 +3229,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
*(reg_field++) =new_field; *(reg_field++) =new_field;
} }
} }
field_count=reg_field - table->field; field_count= (uint) (reg_field - table->field);
/* If result table is small; use a heap */ /* If result table is small; use a heap */
if (blob_count || using_unique_constraint || if (blob_count || using_unique_constraint ||

View File

@ -818,11 +818,12 @@ store_create_info(THD *thd, TABLE *table, String* packet)
class thread_info :public ilink { class thread_info :public ilink {
public: public:
static void *operator new(size_t size) {return (void*) sql_alloc(size); } static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); }
static void operator delete(void *ptr __attribute__((unused)), static void operator delete(void *ptr __attribute__((unused)),
size_t size __attribute__((unused))) {} /*lint -e715 */ size_t size __attribute__((unused))) {} /*lint -e715 */
ulong thread_id,start_time; ulong thread_id;
time_t start_time;
uint command; uint command;
const char *user,*host,*db,*proc_info,*state_info; const char *user,*host,*db,*proc_info,*state_info;
char *query; char *query;

View File

@ -1,18 +1,19 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify This program file is free software; you can redistribute it and/or
it under the terms of the GNU General Public License as published by modify it under the terms of the GNU Library General Public
the Free Software Foundation; either version 2 of the License, or License as published by the Free Software Foundation; either
(at your option) any later version. version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
GNU General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Library General Public
along with this program; if not, write to the Free Software License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
/* This file is originally from the mysql distribution. Coded by monty */ /* This file is originally from the mysql distribution. Coded by monty */
@ -126,7 +127,7 @@ bool String::set(double num,uint decimals)
if (decimals >= NOT_FIXED_DEC) if (decimals >= NOT_FIXED_DEC)
{ {
sprintf(buff,"%.14g",num); // Enough for a DATETIME sprintf(buff,"%.14g",num); // Enough for a DATETIME
return copy(buff,(uint) strlen(buff)); return copy(buff, (uint32) strlen(buff));
} }
#ifdef HAVE_FCONVERT #ifdef HAVE_FCONVERT
int decpt,sign; int decpt,sign;
@ -141,7 +142,7 @@ bool String::set(double num,uint decimals)
buff[0]='-'; buff[0]='-';
pos=buff; pos=buff;
} }
return copy(pos,(uint) strlen(pos)); return copy(pos,(uint32) strlen(pos));
} }
if (alloc((uint32) ((uint32) decpt+3+decimals))) if (alloc((uint32) ((uint32) decpt+3+decimals)))
return TRUE; return TRUE;
@ -191,7 +192,7 @@ end:
#else #else
sprintf(buff,"%.*f",(int) decimals,num); sprintf(buff,"%.*f",(int) decimals,num);
#endif #endif
return copy(buff,(uint) strlen(buff)); return copy(buff,(uint32) strlen(buff));
#endif #endif
} }
@ -260,7 +261,7 @@ bool String::append(const String &s)
bool String::append(const char *s,uint32 arg_length) bool String::append(const char *s,uint32 arg_length)
{ {
if (!arg_length) // Default argument if (!arg_length) // Default argument
arg_length=(uint) strlen(s); arg_length= (uint32) strlen(s);
if (realloc(str_length+arg_length)) if (realloc(str_length+arg_length))
return TRUE; return TRUE;
memcpy(Ptr+str_length,s,arg_length); memcpy(Ptr+str_length,s,arg_length);
@ -318,7 +319,7 @@ int String::charpos(int i,uint32 offset)
if ( INT_MAX32-i <= (int) (mbstr-Ptr-offset)) if ( INT_MAX32-i <= (int) (mbstr-Ptr-offset))
return INT_MAX32; return INT_MAX32;
else else
return (mbstr-Ptr-offset)+i; return (int) ((mbstr-Ptr-offset)+i);
} }
else else
#endif #endif
@ -330,7 +331,7 @@ int String::strstr(const String &s,uint32 offset)
if (s.length()+offset <= str_length) if (s.length()+offset <= str_length)
{ {
if (!s.length()) if (!s.length())
return offset; // Empty string is always found return ((int) offset); // Empty string is always found
register const char *str = Ptr+offset; register const char *str = Ptr+offset;
register const char *search=s.ptr(); register const char *search=s.ptr();

View File

@ -1,18 +1,19 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify This library is free software; you can redistribute it and/or
it under the terms of the GNU General Public License as published by modify it under the terms of the GNU Library General Public
the Free Software Foundation; either version 2 of the License, or License as published by the Free Software Foundation; either
(at your option) any later version. version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
GNU General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Library General Public
along with this program; if not, write to the Free Software License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
/* This file is originally from the mysql distribution. Coded by monty */ /* This file is originally from the mysql distribution. Coded by monty */
@ -44,7 +45,7 @@ public:
{ Ptr=str.Ptr ; str_length=str.str_length ; { Ptr=str.Ptr ; str_length=str.str_length ;
Alloced_length=str.Alloced_length; alloced=0; } Alloced_length=str.Alloced_length; alloced=0; }
static void *operator new(size_t size) { return (void*) sql_alloc(size); } static void *operator new(size_t size) { return (void*) sql_alloc((uint) size); }
static void operator delete(void *ptr_arg,size_t size) /*lint -e715 */ static void operator delete(void *ptr_arg,size_t size) /*lint -e715 */
{ sql_element_free(ptr_arg); } { sql_element_free(ptr_arg); }
~String() { free(); } ~String() { free(); }

View File

@ -113,7 +113,7 @@ long my_gmt_sec(TIME *t)
if ((my_time_zone >=0 ? my_time_zone: -my_time_zone) > 3600L*12) if ((my_time_zone >=0 ? my_time_zone: -my_time_zone) > 3600L*12)
my_time_zone=0; /* Wrong date */ my_time_zone=0; /* Wrong date */
pthread_mutex_unlock(&LOCK_timezone); pthread_mutex_unlock(&LOCK_timezone);
return tmp; return (long) tmp;
} /* my_gmt_sec */ } /* my_gmt_sec */