We even have another C++ find_type function, with slightly different
argument list!!
Not surprising that programmers make mistakes when calling find_type() ...
>> === modified file 'client/mysqldump.c'
>> --- client/mysqldump.c 2011-01-16 03:59:05 +0000
>> +++ client/mysqldump.c 2011-02-10 06:56:15 +0000
Please update Copyright notice
>> @@ -4644,7 +4644,7 @@
>> for (; pos != end && *pos != ','; pos++) ;
>> var_len= (uint) (pos - start);
>> strmake(buff, start, min(sizeof(buff) - 1, var_len));
>> - find= find_type(buff, lib, var_len);
>> + find= find_type(buff, lib, 2);
Please comment on the magic constant 2,
or maybe even give it a name.
>> if (!find)
>> {
>> *err_pos= (char*) start;
>>
>>
>> === modified file 'mysys/typelib.c'
>> --- mysys/typelib.c 2010-03-13 21:17:47 +0000
>> +++ mysys/typelib.c 2011-02-10 06:47:20 +0000
Please update copyright notice.
@param x String to find
@param lib TYPELIB (struct of pointer to values + count)
@param full_name bitmap of what to do
The second @param has wrong name.
>> @@ -276,7 +276,7 @@
>> static uint parse_name(const TYPELIB *lib, const char **strpos, const
char *end)
>> {
>> const char *pos= *strpos;
>> - uint find= find_type((char*)pos, lib, 8);
>> + uint find= find_type((char*)pos, lib, 2|8);
Please comment on magic constant 2|8
And btw: I do like your "radical" suggestion.
Casting away the const is dangerous here.
>> for (; pos != end && *pos != '=' && *pos !=',' ; pos++);
>> *strpos= pos;
>> return find;
>>
>> === modified file 'sql-common/client.c'
>> --- sql-common/client.c 2011-01-31 15:32:57 +0000
>> +++ sql-common/client.c 2011-02-10 06:47:20 +0000
Please update copyright notice.
>> @@ -1145,10 +1145,10 @@
>> OPT_ssl_key, OPT_ssl_cert, OPT_ssl_ca, OPT_ssl_capath,
>> OPT_character_sets_dir, OPT_default_character_set,
OPT_interactive_timeout,
>> OPT_connect_timeout, OPT_local_infile, OPT_disable_local_infile,
>> - OPT_replication_probe, OPT_enable_reads_from_master,
OPT_repl_parse_query,
>> OPT_ssl_cipher, OPT_max_allowed_packet, OPT_protocol,
OPT_shared_memory_base_name,
>> OPT_multi_results, OPT_multi_statements, OPT_multi_queries,
OPT_secure_auth,
>> OPT_report_data_truncation, OPT_plugin_dir, OPT_default_auth,
>> + OPT_keep_this_one_last
>> };
>>
>> static TYPELIB option_types={array_elements(default_options)-1,
>> @@ -1198,6 +1198,9 @@
>> DBUG_ENTER("mysql_read_default_options");
>> DBUG_PRINT("enter",("file: %s group: %s",filename,group ? group
:"NULL"));
>>
>> + compile_time_assert(OPT_keep_this_one_last ==
>> + array_elements(default_options));
>> +
>> argc=1; argv=argv_buff; argv_buff[0]= (char*) "client";
>> groups[0]= (char*) "client"; groups[1]= (char*) group; groups[2]=0;
>>
>> @@ -1339,7 +1342,7 @@
>> break;
>> case OPT_protocol:
>> if ((options->protocol= find_type(opt_arg,
>> - &sql_protocol_typelib,0)) <= 0)
>> + &sql_protocol_typelib,2)) <= 0)
>> {
>> fprintf(stderr, "Unknown option to protocol: %s\n",
opt_arg);
>> exit(1);
>>
>
> --
> MySQL Code Commits Mailing List
> For list archives: http://lists.mysql.com/commits
> To unsubscribe:
> http://lists.mysql.com/commits?unsub=1
>