Commit b0f2c7e5 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 e9b3a312
......@@ -468,7 +468,6 @@ uint STDCALL mysql_warning_count(MYSQL *mysql)
void Protocol_simple::prepare_for_resend()
{
MYSQL_ROWS *cur;
ulong len;
MYSQL_DATA *result= thd->mysql->result->data;
DBUG_ENTER("send_data");
......
......@@ -66,7 +66,7 @@ TYPELIB sql_protocol_typelib = {array_elements(sql_protocol_names_lib)-1,"",
#define closesocket(A) close(A)
#endif
static void mysql_once_init(void);
void mysql_once_init(void);
static void end_server(MYSQL *mysql);
static void append_wild(char *to,char *end,const char *wild);
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)
static inline void unreg_request(BLOCK_LINK *block, int at_end)
{
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,
if (block->wqueue[COND_FOR_SAVED].last_thread)
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->length=0;
block->offset=key_cache_block_size;
......@@ -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 */
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) &&
block->length < read_length + offset)
......@@ -1270,7 +1270,7 @@ int key_cache_write(File file, my_off_t filepos, byte *buff, uint length,
read_block(block,
offset + read_length >= 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)
{ /* 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,
int error;
ulong memavl;
uint maxbuffer;
uint i;
BUFFPEK *buffpek;
ha_rows records;
uchar **sort_keys;
......
......@@ -290,7 +290,7 @@ static SYMBOL symbols[] = {
{ "PACK_KEYS", SYM(PACK_KEYS_SYM),0,0},
{ "PARTIAL", SYM(PARTIAL),0,0},
{ "PASSWORD", SYM(PASSWORD),0,0},
{ "POINT", SYM(POINT),0,0},
{ "POINT", SYM(POINT_SYM),0,0},
{ "POLYGON", SYM(POLYGON),0,0},
{ "PURGE", SYM(PURGE),0,0},
{ "PRECISION", SYM(PRECISION),0,0},
......
......@@ -192,7 +192,6 @@ static char szPipeName [ 257 ];
static SECURITY_ATTRIBUTES saPipeSecurity;
static SECURITY_DESCRIPTOR sdPipeDescriptor;
static HANDLE hPipe = INVALID_HANDLE_VALUE;
static bool opt_enable_named_pipe = 0;
#endif
#ifdef __WIN__
static pthread_cond_t COND_handler_count;
......@@ -502,9 +501,11 @@ static bool read_init_file(char *file_name);
#ifdef __NT__
extern "C" pthread_handler_decl(handle_connections_namedpipes,arg);
#endif
#if !defined(EMBEDDED_LIBRARY)
#ifdef HAVE_SMEM
static pthread_handler_decl(handle_connections_shared_memory,arg);
#endif
#endif /* EMBEDDED_LIBRARY */
extern "C" pthread_handler_decl(handle_slave,arg);
#ifdef SET_RLIMIT_NOFILE
static uint set_maximum_open_files(uint max_file_limit);
......@@ -2242,6 +2243,7 @@ static void create_maintenance_thread()
static void create_shutdown_thread()
{
#if !defined(EMBEDDED_LIBRARY)
#ifdef __WIN__
hEventShutdown=CreateEvent(0, FALSE, FALSE, shutdown_event_name);
pthread_t hThread;
......@@ -2257,6 +2259,7 @@ static void create_shutdown_thread()
if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0))
sql_print_error("Warning: Can't create thread to handle shutdown requests");
#endif
#endif // EMBEDDED_LIBRARY
}
......@@ -2300,6 +2303,7 @@ static void handle_connections_methods()
handler_count--;
}
}
#if !defined(EMBEDDED_LIBRARY)
#ifdef HAVE_SMEM
if (opt_enable_shared_memory)
{
......@@ -2311,7 +2315,8 @@ static void handle_connections_methods()
handler_count--;
}
}
#endif
#endif
#endif // EMBEDDED_LIBRARY
while (handler_count > 0)
pthread_cond_wait(&COND_handler_count,&LOCK_thread_count);
......@@ -2676,11 +2681,10 @@ int main(int argc, char **argv)
static int bootstrap(FILE *file)
{
THD *thd;
int error= 0;
DBUG_ENTER("bootstrap");
#ifndef EMBEDDED_LIBRARY // TODO: Enable this
thd= new THD;
THD *thd= new THD;
thd->bootstrap=1;
thd->client_capabilities=0;
my_net_init(&thd->net,(st_vio*) 0);
......
......@@ -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)
{
#ifndef EMBEDDED_LIBRARY
uint length;
char buff[MYSQL_ERRMSG_SIZE+2];
#endif
NET *net= &thd->net;
DBUG_ENTER("send_error");
DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno,
......
......@@ -355,10 +355,6 @@ class select_result;
#define THD_SENTRY_MAGIC 0xfeedd1ff
#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)
struct system_variables
......
......@@ -71,7 +71,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
select_union *derived_result;
TABLE_LIST *tables= (TABLE_LIST *)sl->table_list.first;
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;
SELECT_LEX_NODE *save_current_select= lex->current_select;
DBUG_ENTER("mysql_derived");
......
......@@ -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,
Field::itRAW);
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);
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,
field->get_key_image(topic_id_buff, field->pack_length(), help_charset,
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(),
HA_READ_KEY_EXACT))
res->push_back(get_field(&thd->mem_root,
......
......@@ -1059,7 +1059,9 @@ bool do_command(THD *thd)
bool dispatch_command(enum enum_server_command command, THD *thd,
char* packet, uint packet_length)
{
#ifndef EMBEDDED_LIBRARY
int res;
#endif
NET *net= &thd->net;
bool error= 0;
/*
......
......@@ -486,7 +486,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token NOW_SYM
%token PASSWORD
%token POINTFROMTEXT
%token POINT
%token POINT_SYM
%token POLYFROMTEXT
%token POLYGON
%token POSITION_SYM
......@@ -1146,7 +1146,7 @@ type:
$$=FIELD_TYPE_BLOB; }
| GEOMETRY_SYM { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_GEOMETRY; }
| POINT { Lex->charset=&my_charset_bin;
| POINT_SYM { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_GEOMETRY; }
| MULTIPOINT { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_GEOMETRY; }
......@@ -2313,7 +2313,7 @@ simple_expr:
{ $$= new Item_func_password($3); }
| PASSWORD '(' expr ',' expr ')'
{ $$= new Item_func_password($3,$5); }
| POINT '(' expr ',' expr ')'
| POINT_SYM '(' expr ',' expr ')'
{ $$= new Item_func_point($3,$5); }
| POINTFROMTEXT '(' expr ')'
{ $$= new Item_func_geometry_from_text($3); }
......@@ -4038,7 +4038,7 @@ keyword:
| PACK_KEYS_SYM {}
| PARTIAL {}
| PASSWORD {}
| POINT {}
| POINT_SYM {}
| POLYGON {}
| PREV_SYM {}
| PROCESS {}
......
......@@ -95,7 +95,7 @@ function (const char *nptr,char **endptr,int base)
s = nptr;
/* Skip white space. */
while (my_isspace (my_charset_latin1, *s))
while (my_isspace (&my_charset_latin1, *s))
++s;
if (*s == '\0')
{
......@@ -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;
/* If BASE is zero, figure it out ourselves. */
......@@ -123,7 +123,7 @@ function (const char *nptr,char **endptr,int base)
{
if (*s == '0')
{
if (my_toupper (my_charset_latin1, s[1]) == 'X')
if (my_toupper (&my_charset_latin1, s[1]) == 'X')
{
s += 2;
base = 16;
......@@ -145,10 +145,10 @@ function (const char *nptr,char **endptr,int base)
i = 0;
for (c = *s; c != '\0'; c = *++s)
{
if (my_isdigit (my_charset_latin1, c))
if (my_isdigit (&my_charset_latin1, c))
c -= '0';
else if (my_isalpha (my_charset_latin1, c))
c = my_toupper (my_charset_latin1, c) - 'A' + 10;
else if (my_isalpha (&my_charset_latin1, c))
c = my_toupper (&my_charset_latin1, c) - 'A' + 10;
else
break;
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