diff options
author | unknown <monty@mysql.com> | 2005-07-28 16:10:14 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-07-28 16:10:14 +0300 |
commit | 79f75d8fad96e7b1da588eb850a25f9e9697ac2e (patch) | |
tree | af22629d2c36ae4196e6f23584c4cecc393b874e /mysys | |
parent | 520ebda4f22a4471ddedddf1a63561787f31c409 (diff) | |
download | mariadb-git-79f75d8fad96e7b1da588eb850a25f9e9697ac2e.tar.gz |
Cleanups during review of new code
Ensure mysql_close() is called if mysql_set_character_set() fails
libmysql/libmysql.c:
Indentation cleanup
mysql-test/r/select.result:
Fix bad merge & align code with 4.1
mysql-test/r/type_newdecimal.result:
Added test of extreme case
mysql-test/t/select.test:
Fix bad merge & align code with 4.1
mysql-test/t/type_newdecimal.test:
Added test of extreme case
mysys/charset.c:
Removed not used variable
mysys/default.c:
Simplify code
sql-common/client.c:
Ensure mysql_close() is called if mysql_set_character_set() fails
sql/log.cc:
strmov(strmov()) -> strxmov()
sql/sp.cc:
Indentation fixes
sql/sql_acl.cc:
Indentation fixes
sql/sql_base.cc:
Added commments
Moved variable to inner block
sql/sql_show.cc:
Simple optimization (removed loop variable)
sql/sql_trigger.cc:
strmov(strmov()) -> strxmov()
strings/decimal.c:
Indentation fixes
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/charset.c | 3 | ||||
-rw-r--r-- | mysys/default.c | 52 |
2 files changed, 28 insertions, 27 deletions
diff --git a/mysys/charset.c b/mysys/charset.c index fbdfa12c7a1..701170b747b 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -588,6 +588,7 @@ CHARSET_INFO *get_charset_by_csname(const char *cs_name, ~0 The escaped string did not fit in the to buffer >=0 The length of the escaped string */ + ulong escape_string_for_mysql(CHARSET_INFO *charset_info, char *to, ulong to_length, const char *from, ulong length) @@ -702,6 +703,7 @@ ulong escape_string_for_mysql(CHARSET_INFO *charset_info, ~0 The escaped string did not fit in the to buffer >=0 The length of the escaped string */ + ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info, char *to, ulong to_length, const char *from, ulong length) @@ -714,7 +716,6 @@ ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info, #endif for (end= from + length; from < end; from++) { - char escape= 0; #ifdef USE_MB int tmp_length; if (use_mb_flag && (tmp_length= my_ismbchar(charset_info, from, end))) diff --git a/mysys/default.c b/mysys/default.c index 6b78d031291..d649df48332 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -917,6 +917,7 @@ typedef UINT (WINAPI *GET_SYSTEM_WINDOWS_DIRECTORY)(LPSTR, UINT); static uint my_get_system_windows_directory(char *buffer, uint size) { + uint count; GET_SYSTEM_WINDOWS_DIRECTORY func_ptr= (GET_SYSTEM_WINDOWS_DIRECTORY) GetProcAddress(GetModuleHandle("kernel32.dll"), @@ -924,22 +925,19 @@ static uint my_get_system_windows_directory(char *buffer, uint size) if (func_ptr) return func_ptr(buffer, size); - else - { - /* - Windows NT 4.0 Terminal Server Edition: - To retrieve the shared Windows directory, call GetSystemDirectory and - trim the "System32" element from the end of the returned path. - */ - UINT count= GetSystemDirectory(buffer, size); - if (count > 8 && stricmp(buffer+(count-8), "\\System32") == 0) - { - count-= 8; - buffer[count] = '\0'; - } - return count; + /* + Windows NT 4.0 Terminal Server Edition: + To retrieve the shared Windows directory, call GetSystemDirectory and + trim the "System32" element from the end of the returned path. + */ + count= GetSystemDirectory(buffer, size); + if (count > 8 && stricmp(buffer+(count-8), "\\System32") == 0) + { + count-= 8; + buffer[count] = '\0'; } + return count; } #endif @@ -952,7 +950,7 @@ static uint my_get_system_windows_directory(char *buffer, uint size) 2. GetWindowsDirectory() 3. GetSystemWindowsDirectory() 4. getenv(DEFAULT_HOME_ENV) - 5. Direcotry above where the executable is located + 5. Directory above where the executable is located 6. "" On Novell NetWare, this is: @@ -1011,26 +1009,28 @@ static void init_default_directories() Look for the second-to-last \ in the filename, but hang on to a pointer after the last \ in case we're in the root of a drive. - */ + */ for ( ; end > config_dir; end--) { if (*end == FN_LIBCHAR) { if (last) + { + if (end != config_dir) + { + /* Keep the last '\' as this works both with D:\ and a directory */ + end[1]= 0; + } + else + { + /' No parent directory (strange). Use current dir + '\' '*/ + last[1]= 0; + } break; + } last= end; } } - - if (last) - { - if (end != config_dir && end[-1] == FN_DEVCHAR) /* Ended up with D:\ */ - end[1]= 0; /* Keep one \ */ - else if (end != config_dir) - end[0]= 0; - else - last[1]= 0; - } *ptr++= (char *)&config_dir; } #endif |