diff options
Diffstat (limited to 'extra')
36 files changed, 211 insertions, 131 deletions
diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index a569641a198..f8f71b00743 100644 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -31,24 +31,28 @@ IF(NOT CMAKE_CROSSCOMPILING) TARGET_LINK_LIBRARIES(comp_err mysys) ENDIF() -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/include/mysqld_error.h - ${PROJECT_BINARY_DIR}/sql/share/english/errmsg.sys - COMMAND comp_err - --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets - --out-dir=${PROJECT_BINARY_DIR}/sql/share/ - --header_file=${PROJECT_BINARY_DIR}/include/mysqld_error.h - --name_file=${PROJECT_BINARY_DIR}/include/mysqld_ername.h - --state_file=${PROJECT_BINARY_DIR}/include/sql_state.h - --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt - DEPENDS ${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt - ${CMAKE_CURRENT_SOURCE_DIR}/comp_err.c) +# Generate mysqld_error.h +# Try not to change its timestamp if not necessary(as touching +# mysqld_error.h results in rebuild of the almost whole server) +# To preserve timestamp, first generate a temp header file, then copy it +# to mysqld_error.h using cmake -E copy_if_different +ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp + COMMAND comp_err + --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets + --out-dir=${CMAKE_BINARY_DIR}/sql/share/ + --header_file=${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp + --name_file=${CMAKE_BINARY_DIR}/include/mysqld_ername.h.tmp + --state_file=${CMAKE_BINARY_DIR}/include/sql_state.h.tmp + --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp ${CMAKE_BINARY_DIR}/include/mysqld_error.h + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/mysqld_ername.h.tmp ${CMAKE_BINARY_DIR}/include/mysqld_ername.h + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/sql_state.h.tmp ${CMAKE_BINARY_DIR}/include/sql_state.h + DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt) ADD_CUSTOM_TARGET(GenError ALL DEPENDS - ${PROJECT_BINARY_DIR}/include/mysqld_error.h - ${PROJECT_BINARY_DIR}/sql/share/english/errmsg.sys - ${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt) + ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp) MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) TARGET_LINK_LIBRARIES(my_print_defaults mysys) @@ -57,6 +61,7 @@ MYSQL_ADD_EXECUTABLE(perror perror.c) ADD_DEPENDENCIES(perror GenError) TARGET_LINK_LIBRARIES(perror mysys) +IF(UNIX) MYSQL_ADD_EXECUTABLE(resolveip resolveip.c) TARGET_LINK_LIBRARIES(resolveip mysys) IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") @@ -65,9 +70,9 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") MY_SEARCH_LIBS(inet_aton "nsl;socket;resolv" SOLARIS_NSL) TARGET_LINK_LIBRARIES(resolveip ${SOLARIS_NSL}) ENDIF() +ENDIF() - -MYSQL_ADD_EXECUTABLE(replace replace.c) +MYSQL_ADD_EXECUTABLE(replace replace.c COMPONENT Server) TARGET_LINK_LIBRARIES(replace mysys) IF(UNIX) MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.c) @@ -75,7 +80,6 @@ IF(UNIX) MYSQL_ADD_EXECUTABLE(resolve_stack_dump resolve_stack_dump.c) TARGET_LINK_LIBRARIES(resolve_stack_dump mysys) - MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c) + MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c COMPONENT Client) TARGET_LINK_LIBRARIES(mysql_waitpid mysys) ENDIF() - diff --git a/extra/comp_err.c b/extra/comp_err.c index b6ed2bee118..f0396bc5878 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -1,5 +1,6 @@ /* - Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2013, Oracle and/or its affiliates + Copyright (c) 2008, 2011, Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,12 +32,12 @@ #include <my_getopt.h> #include <assert.h> #include <my_dir.h> -#include <mysql_version.h> #define MAX_ROWS 1000 #define HEADER_LENGTH 32 /* Length of header in errmsg.sys */ #define DEFAULT_CHARSET_DIR "../sql/share/charsets" #define ER_PREFIX "ER_" +#define ER_PREFIX2 "MARIA_ER_" #define WARN_PREFIX "WARN_" static char *OUTFILE= (char*) "errmsg.sys"; static char *HEADERFILE= (char*) "mysqld_error.h"; @@ -60,7 +61,7 @@ const char *empty_string= ""; /* For empty states */ */ const char *default_language= "eng"; -int er_offset= 1000; +uint er_offset= 1000; my_bool info_flag= 0; /* Storage of one error message row (for one language) */ @@ -88,7 +89,7 @@ struct languages struct errors { const char *er_name; /* Name of the error (ER_HASHCK) */ - int d_code; /* Error code number */ + uint d_code; /* Error code number */ const char *sql_code1; /* sql state */ const char *sql_code2; /* ODBC state */ struct errors *next_error; /* Pointer to next error */ @@ -111,7 +112,8 @@ static struct my_option my_long_options[]= NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Prints version", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"charset", 'C', "Charset dir", &charsets_dir, &charsets_dir, + {"charset", 'C', "Charset dir", + (char**) &charsets_dir, (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"in_file", 'F', "Input file", &TXTFILE, &TXTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -129,6 +131,7 @@ static struct my_option my_long_options[]= }; +static struct errors *generate_empty_message(uint dcode); static struct languages *parse_charset_string(char *str); static struct errors *parse_error_string(char *ptr, int er_count); static struct message *parse_message_string(struct message *new_message, @@ -176,23 +179,6 @@ int main(int argc, char *argv[]) fprintf(stderr, "Failed to parse input file %s\n", TXTFILE); DBUG_RETURN(1); } -#if MYSQL_VERSION_ID >= 50100 && MYSQL_VERSION_ID < 50500 -/* Number of error messages in 5.1 - do not change this number! */ -#define MYSQL_OLD_GA_ERROR_MESSAGE_COUNT 641 -#elif MYSQL_VERSION_ID >= 50500 && MYSQL_VERSION_ID < 50600 -/* Number of error messages in 5.5 - do not change this number! */ -#define MYSQL_OLD_GA_ERROR_MESSAGE_COUNT 728 -#endif -#if MYSQL_OLD_GA_ERROR_MESSAGE_COUNT - if (row_count != MYSQL_OLD_GA_ERROR_MESSAGE_COUNT) - { - fprintf(stderr, "Can only add new error messages to latest GA. "); - fprintf(stderr, "Use ER_UNKNOWN_ERROR instead.\n"); - fprintf(stderr, "Expected %u messages, found %u.\n", - MYSQL_OLD_GA_ERROR_MESSAGE_COUNT, row_count); - DBUG_RETURN(1); - } -#endif if (lang_head == NULL || error_head == NULL) { fprintf(stderr, "Failed to parse input file %s\n", TXTFILE); @@ -244,7 +230,7 @@ static int create_header_files(struct errors *error_head) struct errors *tmp_error; struct message *er_msg; const char *er_text; - + uint current_d_code; DBUG_ENTER("create_header_files"); if (!(er_definef= my_fopen(HEADERFILE, O_WRONLY, MYF(MY_WME)))) @@ -269,13 +255,22 @@ static int create_header_files(struct errors *error_head) fprintf(er_definef, "#define ER_ERROR_FIRST %d\n", error_head->d_code); + current_d_code= error_head->d_code -1; for (tmp_error= error_head; tmp_error; tmp_error= tmp_error->next_error) { /* generating mysqld_error.h fprintf() will automatically add \r on windows */ - fprintf(er_definef, "#define %s %d\n", tmp_error->er_name, + + if (!tmp_error->er_name) + continue; /* Placeholder for gap */ + + if (tmp_error->d_code > current_d_code + 1) + fprintf(er_definef, "\n/* New section */\n\n"); + current_d_code= tmp_error->d_code; + + fprintf(er_definef, "#define %s %u\n", tmp_error->er_name, tmp_error->d_code); er_last= tmp_error->d_code; @@ -447,7 +442,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error, char *str, buff[1000]; struct errors *current_error= 0, **tail_error= top_error; struct message current_message; - int rcount= 0; + uint rcount= 0; + my_bool er_offset_found= 0; DBUG_ENTER("parse_input_file"); *top_error= 0; @@ -468,11 +464,32 @@ static int parse_input_file(const char *file_name, struct errors **top_error, } if (is_prefix(str, "start-error-number")) { - if (!(er_offset= parse_error_offset(str))) + uint tmp_er_offset; + if (!(tmp_er_offset= parse_error_offset(str))) { fprintf(stderr, "Failed to parse the error offset string!\n"); DBUG_RETURN(0); } + if (!er_offset_found) + { + er_offset_found= 1; + er_offset= tmp_er_offset; + } + else + { + /* Create empty error messages between er_offset and tmp_err_offset */ + if (tmp_er_offset < er_offset + rcount) + { + fprintf(stderr, "new start-error-number %u is smaller than current error message: %u\n", tmp_er_offset, er_offset + rcount); + DBUG_RETURN(0); + } + for ( ; er_offset + rcount < tmp_er_offset ; rcount++) + { + current_error= generate_empty_message(er_offset + rcount); + *tail_error= current_error; + tail_error= ¤t_error->next_error; + } + } continue; } if (is_prefix(str, "default-language")) @@ -519,7 +536,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error, DBUG_RETURN(0); continue; } - if (is_prefix(str, ER_PREFIX) || is_prefix(str, WARN_PREFIX)) + if (is_prefix(str, ER_PREFIX) || is_prefix(str, WARN_PREFIX) || + is_prefix(str, ER_PREFIX2)) { if (!(current_error= parse_error_string(str, rcount))) { @@ -534,12 +552,12 @@ static int parse_input_file(const char *file_name, struct errors **top_error, continue; } if (*str == '#' || *str == '\n') - continue; /* skip comment or empty lines */ + continue; /* skip comment or empty lines */ fprintf(stderr, "Wrong input file format. Stop!\nLine: %s\n", str); DBUG_RETURN(0); } - *tail_error= 0; /* Mark end of list */ + *tail_error= 0; /* Mark end of list */ my_fclose(file, MYF(0)); DBUG_RETURN(rcount); @@ -648,7 +666,6 @@ static struct message *find_message(struct errors *err, const char *lang, DBUG_RETURN(tmp); if (!strcmp(tmp->lang_short_name, default_language)) { - DBUG_ASSERT(tmp->text[0] != 0); return_val= tmp; } } @@ -868,6 +885,33 @@ static struct message *parse_message_string(struct message *new_message, } +static struct errors *generate_empty_message(uint d_code) +{ + struct errors *new_error; + struct message message; + + /* create a new element */ + if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error), + MYF(MY_WME)))) + return(0); + if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 1)) + return(0); /* OOM: Fatal error */ + + new_error->er_name= NULL; + new_error->d_code= d_code; + new_error->sql_code1= empty_string; + new_error->sql_code2= empty_string; + + if (!(message.lang_short_name= my_strdup(default_language, MYF(MY_WME))) || + !(message.text= my_strdup("", MYF(MY_WME)))) + return(0); + + /* Can't fail as msg is preallocated */ + (void) insert_dynamic(&new_error->msg, (uchar*) &message); + return(new_error); +} + + /* Parsing the string with error name and codes; returns the pointer to the errors struct @@ -880,7 +924,9 @@ static struct errors *parse_error_string(char *str, int er_count) DBUG_PRINT("enter", ("str: %s", str)); /* create a new element */ - new_error= (struct errors *) my_malloc(sizeof(*new_error), MYF(MY_WME)); + if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error), + MYF(MY_WME)))) + DBUG_RETURN(0); if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 0)) DBUG_RETURN(0); /* OOM: Fatal error */ @@ -1010,7 +1056,7 @@ static struct languages *parse_charset_string(char *str) static void print_version(void) { DBUG_ENTER("print_version"); - printf("%s (Compile errormessage) Ver %s\n", my_progname, "2.0"); + printf("%s (Compile errormessage) Ver %s\n", my_progname, "3.0"); DBUG_VOID_RETURN; } diff --git a/extra/innochecksum.c b/extra/innochecksum.c index b55b510b888..ed4dfc48789 100644 --- a/extra/innochecksum.c +++ b/extra/innochecksum.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2011, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 55d3d1f8597..7558d6d00ae 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -1,6 +1,5 @@ - /* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2011, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,8 +26,13 @@ #include <my_sys.h> #include <m_string.h> #include <my_getopt.h> +#include <mysql_version.h> +#define load_default_groups mysqld_groups +#include <mysqld_default_groups.h> +#undef load_default_groups +my_bool opt_mysqld; const char *config_file="my"; /* Default config file */ uint verbose= 0, opt_defaults_file_used= 0; const char *default_dbug_option="d:t:o,/tmp/my_print_defaults.trace"; @@ -51,34 +55,36 @@ static struct my_option my_long_options[] = {"config-file", 'c', "Deprecated, please use --defaults-file instead. " "Name of config file to read; if no extension is given, default " "extension (e.g., .ini or .cnf) will be added", - &config_file, &config_file, 0, GET_STR, REQUIRED_ARG, + (char**) &config_file, (char**) &config_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef DBUG_OFF {"debug", '#', "This is a non-debug version. Catch this and exit", 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, #else - {"debug", '#', "Output debug log", &default_dbug_option, - &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"debug", '#', "Output debug log", (char**) &default_dbug_option, + (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif {"defaults-file", 'c', "Like --config-file, except: if first option, " "then read this file only, do not read global or per-user config " "files; should be the first option", - &config_file, &config_file, 0, GET_STR, REQUIRED_ARG, + (char**) &config_file, (char*) &config_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"defaults-extra-file", 'e', "Read this file after the global config file and before the config " "file in the users home directory; should be the first option", - &my_defaults_extra_file, &my_defaults_extra_file, 0, + (void *)&my_defaults_extra_file, (void *)&my_defaults_extra_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"defaults-group-suffix", 'g', "In addition to the given groups, read also groups with this suffix", - &my_defaults_group_suffix, &my_defaults_group_suffix, + (char**) &my_defaults_group_suffix, (char**) &my_defaults_group_suffix, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"extra-file", 'e', "Deprecated. Synonym for --defaults-extra-file.", - &my_defaults_extra_file, - &my_defaults_extra_file, 0, GET_STR, + (void *)&my_defaults_extra_file, + (void *)&my_defaults_extra_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"mysqld", 0, "Read the same set of groups that the mysqld binary does.", + &opt_mysqld, &opt_mysqld, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"no-defaults", 'n', "Return an empty string (useful for scripts).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help message and exit.", @@ -99,11 +105,12 @@ static void usage(my_bool version) return; puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("Prints all arguments that is give to some program using the default files"); - printf("Usage: %s [OPTIONS] groups\n", my_progname); + printf("Usage: %s [OPTIONS] [groups]\n", my_progname); my_print_help(my_long_options); my_print_default_files(config_file); my_print_variables(my_long_options); - printf("\nExample usage:\n%s --defaults-file=example.cnf client mysql\n", my_progname); + printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname); + exit(0); } @@ -116,17 +123,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_defaults_file_used= 1; break; case 'n': - exit(0); + exit(0); case 'I': case '?': - usage(0); - exit(0); + usage(0); case 'v': verbose++; break; case 'V': - usage(1); - exit(0); + usage(1); case '#': DBUG_PUSH(argument ? argument : default_dbug_option); break; @@ -142,11 +147,6 @@ static int get_options(int *argc,char ***argv) if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); - if (*argc < 1) - { - usage(0); - return 1; - } return 0; } @@ -154,9 +154,10 @@ static int get_options(int *argc,char ***argv) int main(int argc, char **argv) { int count, error, args_used; - char **load_default_groups, *tmp_arguments[6]; + char **load_default_groups= 0, *tmp_arguments[6]; char **argument, **arguments, **org_argv; char *defaults, *extra_defaults, *group_suffix; + int nargs, i= 0; MY_INIT(argv[0]); org_argv= argv; @@ -170,13 +171,25 @@ int main(int argc, char **argv) arguments[count]= 0; /* Check out the args */ - if (!(load_default_groups=(char**) my_malloc((argc+1)*sizeof(char*), - MYF(MY_WME)))) - exit(1); if (get_options(&argc,&argv)) exit(1); - memcpy((char*) load_default_groups, (char*) argv, (argc + 1) * sizeof(*argv)); + nargs= argc + 1; + if (opt_mysqld) + nargs+= array_elements(mysqld_groups); + + if (nargs < 2) + usage(0); + + load_default_groups=(char**) my_malloc(nargs*sizeof(char*), MYF(MY_WME)); + if (!load_default_groups) + exit(1); + if (opt_mysqld) + { + for (; mysqld_groups[i]; i++) + load_default_groups[i]= (char*) mysqld_groups[i]; + } + memcpy(load_default_groups + i, argv, (argc + 1) * sizeof(*argv)); if ((error= load_defaults(config_file, (const char **) load_default_groups, &count, &arguments))) { @@ -199,6 +212,6 @@ int main(int argc, char **argv) puts(*argument); my_free(load_default_groups); free_defaults(arguments); - + my_end(0); exit(0); } diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c index 23177eb51cb..5cdf1dedc27 100644 --- a/extra/mysql_waitpid.c +++ b/extra/mysql_waitpid.c @@ -1,4 +1,5 @@ -/* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. +/* + Copyright (c) 2003, 2010, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,10 +50,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), switch(optid) { case 'V': printf("%s version %s by Jani Tolonen\n", progname, VER); - exit(-1); + exit(0); case 'I': case '?': usage(); + exit(0); } return 0; } @@ -68,7 +70,10 @@ int main(int argc, char *argv[]) exit(-1); if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 || (t= atoi(argv[1])) <= 0) + { usage(); + exit(-1); + } for (; t > 0; t--) { if (kill((pid_t) pid, sig)) @@ -99,5 +104,4 @@ void usage(void) printf("integer arguments.\n\n"); printf("Options:\n"); my_print_help(my_long_options); - exit(-1); } diff --git a/extra/perror.c b/extra/perror.c index 89a33393aea..c4ee6087d50 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2012, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,7 +34,6 @@ static my_bool verbose, print_all_codes; #include "../include/my_base.h" #include "../mysys/my_handler_errors.h" -// #include "../include/my_compare.h" #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE static my_bool ndb_code; @@ -420,6 +419,8 @@ int main(int argc,char *argv[]) if (unknown_error) free(unknown_error); + my_handler_error_unregister(); + my_end(0); exit(error); return error; } diff --git a/extra/replace.c b/extra/replace.c index 53d9830ad40..56cf02f2002 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -138,6 +138,7 @@ int main(int argc, char *argv[]) } } free_buffer(); + my_free(replace); my_end(verbose ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR); exit(error ? 2 : 0); return 0; /* No compiler warning */ @@ -264,7 +265,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD), MYF(MY_WME)))) { - my_free(pa->typelib.type_names); + my_free((void*) pa->typelib.type_names); DBUG_RETURN (-1); } pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+ @@ -326,7 +327,7 @@ static void free_pointer_array(reg1 POINTER_ARRAY *pa) if (pa->typelib.count) { pa->typelib.count=0; - my_free(pa->typelib.type_names); + my_free((void*) pa->typelib.type_names); pa->typelib.type_names=0; my_free(pa->str); } @@ -1086,7 +1087,7 @@ static int convert_file(REPLACE *rep, char * name) my_fclose(in,MYF(0)); my_fclose(out,MYF(0)); if (updated && ! error) - my_redel(org_name,tempname,MYF(MY_WME | MY_LINK_WARNING)); + my_redel(org_name, tempname, 0, MYF(MY_WME | MY_LINK_WARNING)); else my_delete(tempname,MYF(MY_WME)); if (!silent && ! error) diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index 3422b7ef4de..dd77e1785d0 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -1,4 +1,5 @@ -/* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. +/* + Copyright (c) 2001, 2010, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/resolveip.c b/extra/resolveip.c index f69aa7fec5f..b6840d9d463 100644 --- a/extra/resolveip.c +++ b/extra/resolveip.c @@ -1,4 +1,5 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* + Copyright (c) 2000, 2010, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,9 +25,7 @@ #ifndef WIN32 # include <sys/types.h> # include <sys/socket.h> -# ifndef HAVE_BROKEN_NETINET_INCLUDES -# include <netinet/in.h> -# endif +# include <netinet/in.h> # include <arpa/inet.h> # include <netdb.h> #endif diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp index 642afb25368..d046d4f0743 100644 --- a/extra/yassl/include/yassl_int.hpp +++ b/extra/yassl/include/yassl_int.hpp @@ -465,7 +465,7 @@ public: const Ciphers& GetCiphers() const; const DH_Parms& GetDH_Parms() const; const Stats& GetStats() const; - const VerifyCallback getVerifyCallback() const; + VerifyCallback getVerifyCallback() const; pem_password_cb GetPasswordCb() const; void* GetUserData() const; bool GetSessionCacheOff() const; diff --git a/extra/yassl/src/buffer.cpp b/extra/yassl/src/buffer.cpp index ce00a474e49..532da3875a7 100644 --- a/extra/yassl/src/buffer.cpp +++ b/extra/yassl/src/buffer.cpp @@ -21,6 +21,9 @@ * with SSL types and sockets */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> // memcpy #include "runtime.hpp" diff --git a/extra/yassl/src/crypto_wrapper.cpp b/extra/yassl/src/crypto_wrapper.cpp index 95065932c5f..c40599880b2 100644 --- a/extra/yassl/src/crypto_wrapper.cpp +++ b/extra/yassl/src/crypto_wrapper.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/src/log.cpp b/extra/yassl/src/log.cpp index 2f112ac35f9..c4be306a7b8 100644 --- a/extra/yassl/src/log.cpp +++ b/extra/yassl/src/log.cpp @@ -60,7 +60,6 @@ namespace yaSSL { time_t clicks = time(0); char timeStr[32]; - memset(timeStr, 0, sizeof(timeStr)); // get rid of newline strncpy(timeStr, ctime(&clicks), sizeof(timeStr)); unsigned int len = strlen(timeStr); diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp index cde32df4f43..778c6a8630b 100644 --- a/extra/yassl/src/ssl.cpp +++ b/extra/yassl/src/ssl.cpp @@ -1469,10 +1469,6 @@ int SSL_peek(SSL* ssl, void* buffer, int sz) int SSL_pending(SSL* ssl) { - // Just in case there's pending data that hasn't been processed yet... - char c; - SSL_peek(ssl, &c, 1); - return ssl->bufferedData(); } @@ -1654,10 +1650,10 @@ unsigned long ERR_get_error() } - int SSL_CTX_use_certificate_chain_file(SSL_CTX*, const char*) + int SSL_CTX_use_certificate_chain_file(SSL_CTX* ctx, const char* file) { - // TDOD: - return SSL_SUCCESS; + // For the moment, treat like use_certificate_file + return read_file(ctx, file, SSL_FILETYPE_PEM, Cert); } diff --git a/extra/yassl/src/timer.cpp b/extra/yassl/src/timer.cpp index 7081d049aba..0c3f044c75f 100644 --- a/extra/yassl/src/timer.cpp +++ b/extra/yassl/src/timer.cpp @@ -25,7 +25,7 @@ #include "timer.hpp" #ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 #include <windows.h> #else #include <sys/time.h> diff --git a/extra/yassl/src/yassl_error.cpp b/extra/yassl/src/yassl_error.cpp index 5169b7dd5d0..fec6a3394ca 100644 --- a/extra/yassl/src/yassl_error.cpp +++ b/extra/yassl/src/yassl_error.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2013, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp index f190761604d..5158bd2d004 100644 --- a/extra/yassl/src/yassl_imp.cpp +++ b/extra/yassl/src/yassl_imp.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index f041850f85f..215628c93cc 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1945,7 +1945,7 @@ SSL_CTX::GetCA_List() const } -const VerifyCallback SSL_CTX::getVerifyCallback() const +VerifyCallback SSL_CTX::getVerifyCallback() const { return verifyCallback_; } diff --git a/extra/yassl/taocrypt/benchmark/benchmark.cpp b/extra/yassl/taocrypt/benchmark/benchmark.cpp index 1051b2a4a20..834f340b651 100644 --- a/extra/yassl/taocrypt/benchmark/benchmark.cpp +++ b/extra/yassl/taocrypt/benchmark/benchmark.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2006, 2012, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,6 +19,10 @@ // benchmark.cpp // TaoCrypt benchmark +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <string.h> #include <stdio.h> diff --git a/extra/yassl/taocrypt/include/block.hpp b/extra/yassl/taocrypt/include/block.hpp index 4f58c82ffcc..1e4bd454b06 100644 --- a/extra/yassl/taocrypt/include/block.hpp +++ b/extra/yassl/taocrypt/include/block.hpp @@ -163,7 +163,8 @@ public: void CleanNew(word32 newSize) { New(newSize); - memset(buffer_, 0, sz_ * sizeof(T)); + if (sz_ > 0) + memset(buffer_, 0, sz_ * sizeof(T)); } void New(word32 newSize) diff --git a/extra/yassl/taocrypt/include/blowfish.hpp b/extra/yassl/taocrypt/include/blowfish.hpp index 1f8d0589234..347cf05de4b 100644 --- a/extra/yassl/taocrypt/include/blowfish.hpp +++ b/extra/yassl/taocrypt/include/blowfish.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2006, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/taocrypt/include/file.hpp b/extra/yassl/taocrypt/include/file.hpp index 820fd8ff431..c340c4fa3ea 100644 --- a/extra/yassl/taocrypt/include/file.hpp +++ b/extra/yassl/taocrypt/include/file.hpp @@ -117,7 +117,7 @@ public: word32 size(bool use_current = false); private: - void put(Source&); + size_t put(Source&); FileSink(const FileSink&); // hide FileSink& operator=(const FileSink&); // hide diff --git a/extra/yassl/taocrypt/include/misc.hpp b/extra/yassl/taocrypt/include/misc.hpp index f68abbda8da..69c326d7561 100644 --- a/extra/yassl/taocrypt/include/misc.hpp +++ b/extra/yassl/taocrypt/include/misc.hpp @@ -143,9 +143,13 @@ void CleanUp(); // Turn on ia32 ASM for Big Integer // CodeWarrior defines _MSC_VER +// +// Do not use assembler with GCC, as the implementation for it is broken; +// it does not use proper GCC asm contraints and makes assumptions about +// frame pointers and so on, which breaks depending on GCC version and +// optimization level. #if !defined(TAOCRYPT_DISABLE_X86ASM) && ((defined(_MSC_VER) && \ - !defined(__MWERKS__) && defined(_M_IX86)) || \ - (defined(__GNUC__) && defined(__i386__))) + !defined(__MWERKS__) && defined(_M_IX86))) #define TAOCRYPT_X86ASM_AVAILABLE #endif diff --git a/extra/yassl/taocrypt/include/pwdbased.hpp b/extra/yassl/taocrypt/include/pwdbased.hpp index cf4dff5cee6..32da429f747 100644 --- a/extra/yassl/taocrypt/include/pwdbased.hpp +++ b/extra/yassl/taocrypt/include/pwdbased.hpp @@ -49,7 +49,7 @@ word32 PBKDF2_HMAC<T>::DeriveKey(byte* derived, word32 dLen, const byte* pwd, word32 pLen, const byte* salt, word32 sLen, word32 iterations) const { - if (dLen > MaxDerivedKeyLength()) + if (dLen > MaxDerivedKeyLength()) return 0; ByteBlock buffer(T::DIGEST_SIZE); diff --git a/extra/yassl/taocrypt/include/runtime.hpp b/extra/yassl/taocrypt/include/runtime.hpp index 4c7436251fd..ef2facf32b0 100644 --- a/extra/yassl/taocrypt/include/runtime.hpp +++ b/extra/yassl/taocrypt/include/runtime.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/taocrypt/src/aes.cpp b/extra/yassl/taocrypt/src/aes.cpp index ee4c7a6e8a1..e47765b87d0 100644 --- a/extra/yassl/taocrypt/src/aes.cpp +++ b/extra/yassl/taocrypt/src/aes.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp index ef59bfbbc56..8b4ab9c87cd 100644 --- a/extra/yassl/taocrypt/src/algebra.cpp +++ b/extra/yassl/taocrypt/src/algebra.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,6 @@ /* based on Wei Dai's algebra.cpp from CryptoPP */ #undef NDEBUG -#define DEBUG // GCC 4.0 bug if NDEBUG and Optimize > 1 #include "runtime.hpp" #include "algebra.hpp" diff --git a/extra/yassl/taocrypt/src/blowfish.cpp b/extra/yassl/taocrypt/src/blowfish.cpp index 9491c93040e..87b0556755e 100644 --- a/extra/yassl/taocrypt/src/blowfish.cpp +++ b/extra/yassl/taocrypt/src/blowfish.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2006, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/taocrypt/src/coding.cpp b/extra/yassl/taocrypt/src/coding.cpp index bc4727cc5e3..8f317a484d8 100644 --- a/extra/yassl/taocrypt/src/coding.cpp +++ b/extra/yassl/taocrypt/src/coding.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/taocrypt/src/dsa.cpp b/extra/yassl/taocrypt/src/dsa.cpp index bf116d3e48d..72221441b2b 100644 --- a/extra/yassl/taocrypt/src/dsa.cpp +++ b/extra/yassl/taocrypt/src/dsa.cpp @@ -184,7 +184,7 @@ word32 DSA_Signer::Sign(const byte* sha_digest, byte* sig, s_ = (kInv * (H + x*r_)) % q; if (!(!!r_ && !!s_)) - return -1; + return (word32) -1; int rSz = r_.ByteCount(); diff --git a/extra/yassl/taocrypt/src/file.cpp b/extra/yassl/taocrypt/src/file.cpp index 212f151e3a3..ab7a5c2b61b 100644 --- a/extra/yassl/taocrypt/src/file.cpp +++ b/extra/yassl/taocrypt/src/file.cpp @@ -99,9 +99,9 @@ FileSink::~FileSink() // fill source from file sink -void FileSink::put(Source& source) +size_t FileSink::put(Source& source) { - fwrite(source.get_buffer(), 1, source.size(), file_); + return fwrite(source.get_buffer(), 1, source.size(), file_); } diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index 884992e488f..d8510066d04 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,7 +193,7 @@ DWord() {} "a" (a), "rm" (b) : "cc"); #elif defined(__mips64) - __asm__("dmultu %2,%3" : "=h" (r.halfs_.high), "=l" (r.halfs_.low) + __asm__("dmultu %2,%3" : "=d" (r.halfs_.high), "=l" (r.halfs_.low) : "r" (a), "r" (b)); #elif defined(_M_IX86) diff --git a/extra/yassl/taocrypt/src/misc.cpp b/extra/yassl/taocrypt/src/misc.cpp index fd9e8b92c1d..198f1ba17be 100644 --- a/extra/yassl/taocrypt/src/misc.cpp +++ b/extra/yassl/taocrypt/src/misc.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -165,6 +165,7 @@ word Crop(word value, unsigned int size) #ifdef TAOCRYPT_X86ASM_AVAILABLE +#ifdef NOT_USED #ifndef _MSC_VER static jmp_buf s_env; static void SigIllHandler(int) @@ -172,7 +173,7 @@ word Crop(word value, unsigned int size) longjmp(s_env, 1); } #endif - +#endif bool HaveCpuId() { diff --git a/extra/yassl/taocrypt/src/twofish.cpp b/extra/yassl/taocrypt/src/twofish.cpp index 3051af21513..8eb82210b0f 100644 --- a/extra/yassl/taocrypt/src/twofish.cpp +++ b/extra/yassl/taocrypt/src/twofish.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2006, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/taocrypt/test/test.cpp b/extra/yassl/taocrypt/test/test.cpp index a7d5cb3e8af..c23d981924d 100644 --- a/extra/yassl/taocrypt/test/test.cpp +++ b/extra/yassl/taocrypt/test/test.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2006, 2014, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,6 +19,10 @@ // test.cpp // test taocrypt functionality +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <string.h> #include <stdio.h> diff --git a/extra/yassl/testsuite/test.hpp b/extra/yassl/testsuite/test.hpp index 5c9dc7ce117..5374edd0e2a 100644 --- a/extra/yassl/testsuite/test.hpp +++ b/extra/yassl/testsuite/test.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2006, 2012, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by |