Commit 20e237e5 authored by unknown's avatar unknown

Windows portabilty fixups (last commit caused some errors, so recomitting) - SCRUM


strings/strto.c:
  Windows won't compile for a wrong argument passing, expects a charset pointer
sql/filesort.cc:
  Remove unused variable
sql/lex.h:
  Change POINT->POINT_SYM due to redefination error from windef.h
sql/mysqld.cc:
  Fix Embedded Server related code
sql/protocol.cc:
  Remove unused variables from Embedded Server
sql/sql_class.h:
  Remove silly usage
sql/sql_derived.cc:
  Windows won't let you compile for this kind of assignments
sql/sql_help.cc:
  Need a cast to make it compile
sql/sql_parse.cc:
  Remove unused variables from Embedded server
sql/sql_yacc.yy:
  Change POINT->POINT_SYM due to redefination error from windef.h
mysys/mf_keycache.c:
  Add a correct cast and remove the unused variables
libmysqld/lib_sql.cc:
  Remove unused variable
libmysqld/libmysqld.c:
  Port the netware change to remove mysql_once_init to libmysqld
parent 6963b121
...@@ -468,7 +468,6 @@ uint STDCALL mysql_warning_count(MYSQL *mysql) ...@@ -468,7 +468,6 @@ uint STDCALL mysql_warning_count(MYSQL *mysql)
void Protocol_simple::prepare_for_resend() void Protocol_simple::prepare_for_resend()
{ {
MYSQL_ROWS *cur; MYSQL_ROWS *cur;
ulong len;
MYSQL_DATA *result= thd->mysql->result->data; MYSQL_DATA *result= thd->mysql->result->data;
DBUG_ENTER("send_data"); DBUG_ENTER("send_data");
......
...@@ -66,7 +66,7 @@ TYPELIB sql_protocol_typelib = {array_elements(sql_protocol_names_lib)-1,"", ...@@ -66,7 +66,7 @@ TYPELIB sql_protocol_typelib = {array_elements(sql_protocol_names_lib)-1,"",
#define closesocket(A) close(A) #define closesocket(A) close(A)
#endif #endif
static void mysql_once_init(void); void mysql_once_init(void);
static void end_server(MYSQL *mysql); static void end_server(MYSQL *mysql);
static void append_wild(char *to,char *end,const char *wild); static void append_wild(char *to,char *end,const char *wild);
static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
......
...@@ -676,7 +676,7 @@ static inline void reg_requests(BLOCK_LINK *block, int count) ...@@ -676,7 +676,7 @@ static inline void reg_requests(BLOCK_LINK *block, int count)
static inline void unreg_request(BLOCK_LINK *block, int at_end) static inline void unreg_request(BLOCK_LINK *block, int at_end)
{ {
if (! --block->requests) if (! --block->requests)
link_block(block, at_end); link_block(block, (my_bool)at_end);
} }
/* /*
...@@ -1000,7 +1000,7 @@ static BLOCK_LINK *find_key_block(int file, my_off_t filepos, ...@@ -1000,7 +1000,7 @@ static BLOCK_LINK *find_key_block(int file, my_off_t filepos,
if (block->wqueue[COND_FOR_SAVED].last_thread) if (block->wqueue[COND_FOR_SAVED].last_thread)
release_queue(&block->wqueue[COND_FOR_SAVED]); release_queue(&block->wqueue[COND_FOR_SAVED]);
} }
link_to_file_list(block, file, block->hash_link ? 1 : 0); link_to_file_list(block, file, (my_bool)(block->hash_link ? 1 : 0));
block->status=error? BLOCK_ERROR : 0; block->status=error? BLOCK_ERROR : 0;
block->length=0; block->length=0;
block->offset=key_cache_block_size; block->offset=key_cache_block_size;
...@@ -1150,7 +1150,7 @@ byte *key_cache_read(File file, my_off_t filepos, byte *buff, uint length, ...@@ -1150,7 +1150,7 @@ byte *key_cache_read(File file, my_off_t filepos, byte *buff, uint length,
{ {
/* The requested page is to be read into the block buffer */ /* The requested page is to be read into the block buffer */
read_block(block,key_cache_block_size,read_length+offset, read_block(block,key_cache_block_size,read_length+offset,
page_st == PAGE_TO_BE_READ); (my_bool)(page_st == PAGE_TO_BE_READ));
} }
else if (! (block->status & BLOCK_ERROR) && else if (! (block->status & BLOCK_ERROR) &&
block->length < read_length + offset) block->length < read_length + offset)
...@@ -1270,7 +1270,7 @@ int key_cache_write(File file, my_off_t filepos, byte *buff, uint length, ...@@ -1270,7 +1270,7 @@ int key_cache_write(File file, my_off_t filepos, byte *buff, uint length,
read_block(block, read_block(block,
offset + read_length >= key_cache_block_size? offset + read_length >= key_cache_block_size?
offset : key_cache_block_size, offset : key_cache_block_size,
offset,page_st == PAGE_TO_BE_READ); offset,(my_bool)(page_st == PAGE_TO_BE_READ));
if (!dont_write) if (!dont_write)
{ /* buff has been written to disk at start */ { /* buff has been written to disk at start */
......
...@@ -70,7 +70,6 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, ...@@ -70,7 +70,6 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
int error; int error;
ulong memavl; ulong memavl;
uint maxbuffer; uint maxbuffer;
uint i;
BUFFPEK *buffpek; BUFFPEK *buffpek;
ha_rows records; ha_rows records;
uchar **sort_keys; uchar **sort_keys;
......
...@@ -290,7 +290,7 @@ static SYMBOL symbols[] = { ...@@ -290,7 +290,7 @@ static SYMBOL symbols[] = {
{ "PACK_KEYS", SYM(PACK_KEYS_SYM),0,0}, { "PACK_KEYS", SYM(PACK_KEYS_SYM),0,0},
{ "PARTIAL", SYM(PARTIAL),0,0}, { "PARTIAL", SYM(PARTIAL),0,0},
{ "PASSWORD", SYM(PASSWORD),0,0}, { "PASSWORD", SYM(PASSWORD),0,0},
{ "POINT", SYM(POINT),0,0}, { "POINT", SYM(POINT_SYM),0,0},
{ "POLYGON", SYM(POLYGON),0,0}, { "POLYGON", SYM(POLYGON),0,0},
{ "PURGE", SYM(PURGE),0,0}, { "PURGE", SYM(PURGE),0,0},
{ "PRECISION", SYM(PRECISION),0,0}, { "PRECISION", SYM(PRECISION),0,0},
......
...@@ -192,7 +192,6 @@ static char szPipeName [ 257 ]; ...@@ -192,7 +192,6 @@ static char szPipeName [ 257 ];
static SECURITY_ATTRIBUTES saPipeSecurity; static SECURITY_ATTRIBUTES saPipeSecurity;
static SECURITY_DESCRIPTOR sdPipeDescriptor; static SECURITY_DESCRIPTOR sdPipeDescriptor;
static HANDLE hPipe = INVALID_HANDLE_VALUE; static HANDLE hPipe = INVALID_HANDLE_VALUE;
static bool opt_enable_named_pipe = 0;
#endif #endif
#ifdef __WIN__ #ifdef __WIN__
static pthread_cond_t COND_handler_count; static pthread_cond_t COND_handler_count;
...@@ -502,9 +501,11 @@ static bool read_init_file(char *file_name); ...@@ -502,9 +501,11 @@ static bool read_init_file(char *file_name);
#ifdef __NT__ #ifdef __NT__
extern "C" pthread_handler_decl(handle_connections_namedpipes,arg); extern "C" pthread_handler_decl(handle_connections_namedpipes,arg);
#endif #endif
#if !defined(EMBEDDED_LIBRARY)
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
static pthread_handler_decl(handle_connections_shared_memory,arg); static pthread_handler_decl(handle_connections_shared_memory,arg);
#endif #endif
#endif /* EMBEDDED_LIBRARY */
extern "C" pthread_handler_decl(handle_slave,arg); extern "C" pthread_handler_decl(handle_slave,arg);
#ifdef SET_RLIMIT_NOFILE #ifdef SET_RLIMIT_NOFILE
static uint set_maximum_open_files(uint max_file_limit); static uint set_maximum_open_files(uint max_file_limit);
...@@ -2242,6 +2243,7 @@ static void create_maintenance_thread() ...@@ -2242,6 +2243,7 @@ static void create_maintenance_thread()
static void create_shutdown_thread() static void create_shutdown_thread()
{ {
#if !defined(EMBEDDED_LIBRARY)
#ifdef __WIN__ #ifdef __WIN__
hEventShutdown=CreateEvent(0, FALSE, FALSE, shutdown_event_name); hEventShutdown=CreateEvent(0, FALSE, FALSE, shutdown_event_name);
pthread_t hThread; pthread_t hThread;
...@@ -2257,6 +2259,7 @@ static void create_shutdown_thread() ...@@ -2257,6 +2259,7 @@ static void create_shutdown_thread()
if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0)) if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0))
sql_print_error("Warning: Can't create thread to handle shutdown requests"); sql_print_error("Warning: Can't create thread to handle shutdown requests");
#endif #endif
#endif // EMBEDDED_LIBRARY
} }
...@@ -2300,6 +2303,7 @@ static void handle_connections_methods() ...@@ -2300,6 +2303,7 @@ static void handle_connections_methods()
handler_count--; handler_count--;
} }
} }
#if !defined(EMBEDDED_LIBRARY)
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
if (opt_enable_shared_memory) if (opt_enable_shared_memory)
{ {
...@@ -2312,6 +2316,7 @@ static void handle_connections_methods() ...@@ -2312,6 +2316,7 @@ static void handle_connections_methods()
} }
} }
#endif #endif
#endif // EMBEDDED_LIBRARY
while (handler_count > 0) while (handler_count > 0)
pthread_cond_wait(&COND_handler_count,&LOCK_thread_count); pthread_cond_wait(&COND_handler_count,&LOCK_thread_count);
...@@ -2676,11 +2681,10 @@ int main(int argc, char **argv) ...@@ -2676,11 +2681,10 @@ int main(int argc, char **argv)
static int bootstrap(FILE *file) static int bootstrap(FILE *file)
{ {
THD *thd;
int error= 0; int error= 0;
DBUG_ENTER("bootstrap"); DBUG_ENTER("bootstrap");
#ifndef EMBEDDED_LIBRARY // TODO: Enable this #ifndef EMBEDDED_LIBRARY // TODO: Enable this
thd= new THD; THD *thd= new THD;
thd->bootstrap=1; thd->bootstrap=1;
thd->client_capabilities=0; thd->client_capabilities=0;
my_net_init(&thd->net,(st_vio*) 0); my_net_init(&thd->net,(st_vio*) 0);
......
...@@ -55,8 +55,10 @@ inline bool Protocol::convert_str(const char *from, uint length) ...@@ -55,8 +55,10 @@ inline bool Protocol::convert_str(const char *from, uint length)
void send_error(THD *thd, uint sql_errno, const char *err) void send_error(THD *thd, uint sql_errno, const char *err)
{ {
#ifndef EMBEDDED_LIBRARY
uint length; uint length;
char buff[MYSQL_ERRMSG_SIZE+2]; char buff[MYSQL_ERRMSG_SIZE+2];
#endif
NET *net= &thd->net; NET *net= &thd->net;
DBUG_ENTER("send_error"); DBUG_ENTER("send_error");
DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno, DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno,
......
...@@ -355,10 +355,6 @@ class select_result; ...@@ -355,10 +355,6 @@ class select_result;
#define THD_SENTRY_MAGIC 0xfeedd1ff #define THD_SENTRY_MAGIC 0xfeedd1ff
#define THD_SENTRY_GONE 0xdeadbeef #define THD_SENTRY_GONE 0xdeadbeef
#ifdef EMBEDDED_LIBRARY
typedef struct st_mysql;
#endif
#define THD_CHECK_SENTRY(thd) DBUG_ASSERT(thd->dbug_sentry == THD_SENTRY_MAGIC) #define THD_CHECK_SENTRY(thd) DBUG_ASSERT(thd->dbug_sentry == THD_SENTRY_MAGIC)
struct system_variables struct system_variables
......
...@@ -71,7 +71,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, ...@@ -71,7 +71,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
select_union *derived_result; select_union *derived_result;
TABLE_LIST *tables= (TABLE_LIST *)sl->table_list.first; TABLE_LIST *tables= (TABLE_LIST *)sl->table_list.first;
TMP_TABLE_PARAM tmp_table_param; TMP_TABLE_PARAM tmp_table_param;
bool is_union= sl->next_select(); bool is_union= sl->next_select() ? 1 : 0;
bool is_subsel= sl->first_inner_unit() ? 1: 0; bool is_subsel= sl->first_inner_unit() ? 1: 0;
SELECT_LEX_NODE *save_current_select= lex->current_select; SELECT_LEX_NODE *save_current_select= lex->current_select;
DBUG_ENTER("mysql_derived"); DBUG_ENTER("mysql_derived");
......
...@@ -254,7 +254,7 @@ int get_all_topics_for_category(THD *thd, TABLE *topics, TABLE *relations, ...@@ -254,7 +254,7 @@ int get_all_topics_for_category(THD *thd, TABLE *topics, TABLE *relations,
rcat_id->get_key_image(buff, rcat_id->pack_length(), help_charset, rcat_id->get_key_image(buff, rcat_id->pack_length(), help_charset,
Field::itRAW); Field::itRAW);
int key_res= relations->file->index_read(relations->record[0], int key_res= relations->file->index_read(relations->record[0],
buff, rcat_id->pack_length(), (byte *)buff, rcat_id->pack_length(),
HA_READ_KEY_EXACT); HA_READ_KEY_EXACT);
for ( ; !key_res && cat_id == (int16) rcat_id->val_int() ; for ( ; !key_res && cat_id == (int16) rcat_id->val_int() ;
...@@ -267,7 +267,7 @@ int get_all_topics_for_category(THD *thd, TABLE *topics, TABLE *relations, ...@@ -267,7 +267,7 @@ int get_all_topics_for_category(THD *thd, TABLE *topics, TABLE *relations,
field->get_key_image(topic_id_buff, field->pack_length(), help_charset, field->get_key_image(topic_id_buff, field->pack_length(), help_charset,
Field::itRAW); Field::itRAW);
if (!topics->file->index_read(topics->record[0], topic_id_buff, if (!topics->file->index_read(topics->record[0], (byte *)topic_id_buff,
field->pack_length(), field->pack_length(),
HA_READ_KEY_EXACT)) HA_READ_KEY_EXACT))
res->push_back(get_field(&thd->mem_root, res->push_back(get_field(&thd->mem_root,
......
...@@ -1059,7 +1059,9 @@ bool do_command(THD *thd) ...@@ -1059,7 +1059,9 @@ bool do_command(THD *thd)
bool dispatch_command(enum enum_server_command command, THD *thd, bool dispatch_command(enum enum_server_command command, THD *thd,
char* packet, uint packet_length) char* packet, uint packet_length)
{ {
#ifndef EMBEDDED_LIBRARY
int res; int res;
#endif
NET *net= &thd->net; NET *net= &thd->net;
bool error= 0; bool error= 0;
/* /*
......
...@@ -486,7 +486,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -486,7 +486,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token NOW_SYM %token NOW_SYM
%token PASSWORD %token PASSWORD
%token POINTFROMTEXT %token POINTFROMTEXT
%token POINT %token POINT_SYM
%token POLYFROMTEXT %token POLYFROMTEXT
%token POLYGON %token POLYGON
%token POSITION_SYM %token POSITION_SYM
...@@ -1146,7 +1146,7 @@ type: ...@@ -1146,7 +1146,7 @@ type:
$$=FIELD_TYPE_BLOB; } $$=FIELD_TYPE_BLOB; }
| GEOMETRY_SYM { Lex->charset=&my_charset_bin; | GEOMETRY_SYM { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_GEOMETRY; } $$=FIELD_TYPE_GEOMETRY; }
| POINT { Lex->charset=&my_charset_bin; | POINT_SYM { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_GEOMETRY; } $$=FIELD_TYPE_GEOMETRY; }
| MULTIPOINT { Lex->charset=&my_charset_bin; | MULTIPOINT { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_GEOMETRY; } $$=FIELD_TYPE_GEOMETRY; }
...@@ -2313,7 +2313,7 @@ simple_expr: ...@@ -2313,7 +2313,7 @@ simple_expr:
{ $$= new Item_func_password($3); } { $$= new Item_func_password($3); }
| PASSWORD '(' expr ',' expr ')' | PASSWORD '(' expr ',' expr ')'
{ $$= new Item_func_password($3,$5); } { $$= new Item_func_password($3,$5); }
| POINT '(' expr ',' expr ')' | POINT_SYM '(' expr ',' expr ')'
{ $$= new Item_func_point($3,$5); } { $$= new Item_func_point($3,$5); }
| POINTFROMTEXT '(' expr ')' | POINTFROMTEXT '(' expr ')'
{ $$= new Item_func_geometry_from_text($3); } { $$= new Item_func_geometry_from_text($3); }
...@@ -4038,7 +4038,7 @@ keyword: ...@@ -4038,7 +4038,7 @@ keyword:
| PACK_KEYS_SYM {} | PACK_KEYS_SYM {}
| PARTIAL {} | PARTIAL {}
| PASSWORD {} | PASSWORD {}
| POINT {} | POINT_SYM {}
| POLYGON {} | POLYGON {}
| PREV_SYM {} | PREV_SYM {}
| PROCESS {} | PROCESS {}
......
...@@ -95,7 +95,7 @@ function (const char *nptr,char **endptr,int base) ...@@ -95,7 +95,7 @@ function (const char *nptr,char **endptr,int base)
s = nptr; s = nptr;
/* Skip white space. */ /* Skip white space. */
while (my_isspace (my_charset_latin1, *s)) while (my_isspace (&my_charset_latin1, *s))
++s; ++s;
if (*s == '\0') if (*s == '\0')
{ {
...@@ -115,7 +115,7 @@ function (const char *nptr,char **endptr,int base) ...@@ -115,7 +115,7 @@ function (const char *nptr,char **endptr,int base)
} }
if (base == 16 && s[0] == '0' && my_toupper (my_charset_latin1, s[1]) == 'X') if (base == 16 && s[0] == '0' && my_toupper (&my_charset_latin1, s[1]) == 'X')
s += 2; s += 2;
/* If BASE is zero, figure it out ourselves. */ /* If BASE is zero, figure it out ourselves. */
...@@ -123,7 +123,7 @@ function (const char *nptr,char **endptr,int base) ...@@ -123,7 +123,7 @@ function (const char *nptr,char **endptr,int base)
{ {
if (*s == '0') if (*s == '0')
{ {
if (my_toupper (my_charset_latin1, s[1]) == 'X') if (my_toupper (&my_charset_latin1, s[1]) == 'X')
{ {
s += 2; s += 2;
base = 16; base = 16;
...@@ -145,10 +145,10 @@ function (const char *nptr,char **endptr,int base) ...@@ -145,10 +145,10 @@ function (const char *nptr,char **endptr,int base)
i = 0; i = 0;
for (c = *s; c != '\0'; c = *++s) for (c = *s; c != '\0'; c = *++s)
{ {
if (my_isdigit (my_charset_latin1, c)) if (my_isdigit (&my_charset_latin1, c))
c -= '0'; c -= '0';
else if (my_isalpha (my_charset_latin1, c)) else if (my_isalpha (&my_charset_latin1, c))
c = my_toupper (my_charset_latin1, c) - 'A' + 10; c = my_toupper (&my_charset_latin1, c) - 'A' + 10;
else else
break; break;
if (c >= base) if (c >= base)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment