Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e6f3e65a
Commit
e6f3e65a
authored
Jul 18, 2008
by
Timothy Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge in changes from 5.0.66a (via mysql-5.0)
parents
7077d5aa
6eacf838
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
27 deletions
+58
-27
include/my_sys.h
include/my_sys.h
+1
-0
mysys/default.c
mysys/default.c
+2
-3
mysys/mf_pack.c
mysys/mf_pack.c
+55
-24
No files found.
include/my_sys.h
View file @
e6f3e65a
...
...
@@ -693,6 +693,7 @@ extern char * fn_format(char * to,const char *name,const char *dir,
const
char
*
form
,
uint
flag
);
extern
size_t
strlength
(
const
char
*
str
);
extern
void
pack_dirname
(
char
*
to
,
const
char
*
from
);
extern
size_t
normalize_dirname
(
char
*
to
,
const
char
*
from
);
extern
size_t
unpack_dirname
(
char
*
to
,
const
char
*
from
);
extern
size_t
cleanup_dirname
(
char
*
to
,
const
char
*
from
);
extern
size_t
system_filename
(
char
*
to
,
const
char
*
from
);
...
...
mysys/default.c
View file @
e6f3e65a
...
...
@@ -974,8 +974,7 @@ static int add_directory(MEM_ROOT *alloc, const char *dir, const char **dirs)
char
*
p
;
my_bool
err
__attribute__
((
unused
));
/* Normalize directory name */
len
=
unpack_dirname
(
buf
,
dir
);
len
=
normalize_dirname
(
buf
,
dir
);
if
(
!
(
p
=
strmake_root
(
alloc
,
buf
,
len
)))
return
1
;
/* Failure */
/* Should never fail if DEFAULT_DIRS_SIZE is correct size */
...
...
@@ -1026,7 +1025,7 @@ static const char *my_get_module_parent(char *buf, size_t size)
{
char
*
last
=
NULL
;
char
*
end
;
if
(
!
GetModuleFileName
(
NULL
,
buf
,
size
))
if
(
!
GetModuleFileName
(
NULL
,
buf
,
(
DWORD
)
size
))
return
NULL
;
end
=
strend
(
buf
);
...
...
mysys/mf_pack.c
View file @
e6f3e65a
...
...
@@ -277,22 +277,64 @@ void symdirget(char *dir)
#endif
/* USE_SYMDIR */
/*
Fixes a directroy name so that can be used by open()
/*
*
Convert a directory name to a format which can be compared as strings
SYNOPSIS
unpack_dirname()
to result-buffer, FN_REFLEN characters. may be == from
from 'Packed' directory name (may contain ~)
@param to result buffer, FN_REFLEN chars in length; may be == from
@param from 'packed' directory name, in whatever format
@returns size of the normalized name
IMPLEMENTATION
Make that last char of to is '/' if from not empty and
from doesn't end in FN_DEVCHAR
Uses cleanup_dirname and changes ~/.. to home_dir/..
@details
- Ensures that last char is FN_LIBCHAR, unless it is FN_DEVCHAR
- Uses cleanup_dirname
Changes a UNIX filename to system filename (replaces / with \ on windows)
It does *not* expand ~/ (although, see cleanup_dirname). Nor does it do
any case folding. All case-insensitive normalization should be done by
the caller.
*/
RETURN
size_t
normalize_dirname
(
char
*
to
,
const
char
*
from
)
{
size_t
length
;
char
buff
[
FN_REFLEN
];
DBUG_ENTER
(
"normalize_dirname"
);
/*
Despite the name, this actually converts the name to the system's
format (TODO: rip out the non-working VMS stuff and name this
properly).
*/
(
void
)
intern_filename
(
buff
,
from
);
length
=
strlen
(
buff
);
/* Fix that '/' is last */
if
(
length
&&
#ifdef FN_DEVCHAR
buff
[
length
-
1
]
!=
FN_DEVCHAR
&&
#endif
buff
[
length
-
1
]
!=
FN_LIBCHAR
&&
buff
[
length
-
1
]
!=
'/'
)
{
buff
[
length
]
=
FN_LIBCHAR
;
buff
[
length
+
1
]
=
'\0'
;
}
length
=
cleanup_dirname
(
to
,
buff
);
DBUG_RETURN
(
length
);
}
/**
Fixes a directory name so that can be used by open()
@param to Result buffer, FN_REFLEN characters. May be == from
@param from 'Packed' directory name (may contain ~)
@details
- Uses normalize_dirname()
- Expands ~/... to home_dir/...
- Resolves MySQL's fake "foo.sym" symbolic directory names (if USE_SYMDIR)
- Changes a UNIX filename to system filename (replaces / with \ on windows)
@returns
Length of new directory name (= length of to)
*/
...
...
@@ -302,19 +344,8 @@ size_t unpack_dirname(char * to, const char *from)
char
buff
[
FN_REFLEN
+
1
+
4
],
*
suffix
,
*
tilde_expansion
;
DBUG_ENTER
(
"unpack_dirname"
);
(
void
)
intern_filename
(
buff
,
from
);
/* Change to intern name */
length
=
strlen
(
buff
);
/* Fix that '/' is last */
if
(
length
&&
#ifdef FN_DEVCHAR
buff
[
length
-
1
]
!=
FN_DEVCHAR
&&
#endif
buff
[
length
-
1
]
!=
FN_LIBCHAR
&&
buff
[
length
-
1
]
!=
'/'
)
{
buff
[
length
]
=
FN_LIBCHAR
;
buff
[
length
+
1
]
=
'\0'
;
}
length
=
normalize_dirname
(
buff
,
from
);
length
=
cleanup_dirname
(
buff
,
buff
);
if
(
buff
[
0
]
==
FN_HOMELIB
)
{
suffix
=
buff
+
1
;
tilde_expansion
=
expand_tilde
(
&
suffix
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment