From 86717c497dcd07e4ba417a4236ee01bf3fb61594 Mon Sep 17 00:00:00 2001 From: Andriy Grytsenko Date: Mon, 12 Nov 2012 23:14:46 +0200 Subject: [PATCH 04/22] [#3582493]Fix for SIGSEGV in fm_path_new_child() with parent=NULL. --- src/base/fm-path.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/base/fm-path.c b/src/base/fm-path.c index 9cf3088..b90aeab 100644 --- a/src/base/fm-path.c +++ b/src/base/fm-path.c @@ -238,8 +238,8 @@ static inline FmPath* _fm_path_reuse_existing_paths(FmPath* parent, const char* /** * fm_path_new_child_len - * @parent: a parent path - * @basename: basename of a direct child of @parent directory + * @parent: (allow-none): a parent path + * @basename: (allow-none): basename of a direct child of @parent directory * @name_len: length of @basename * * Creates new #FmPath for child of @parent directory which have name @@ -346,8 +346,8 @@ FmPath* fm_path_new_child_len(FmPath* parent, const char* basename, int name_len /** * fm_path_new_child - * @parent: a parent path - * @basename: basename of a direct child of @parent directory + * @parent: (allow-none): a parent path + * @basename: (allow-none): basename of a direct child of @parent directory * * Creates new #FmPath for child of @parent directory which have name * @basename. @basename is in glib filename encoding (can be non-UTF-8) @@ -362,7 +362,7 @@ FmPath* fm_path_new_child(FmPath* parent, const char* basename) { int baselen = strlen(basename); return _fm_path_new_child_len(parent, basename, baselen, - fm_path_is_native(parent)); + parent && fm_path_is_native(parent)); } return G_LIKELY(parent) ? fm_path_ref(parent) : NULL; } @@ -396,8 +396,8 @@ FmPath* fm_path_new_for_gfile(GFile* gf) /** * fm_path_new_relative - * @parent: a parent path - * @rel: a path relative to @parent + * @parent: (allow-none): a parent path + * @rel: (allow-none): a path relative to @parent * * Creates new #FmPath which is relative to @parent directory by the * relative path string @rel. @rel is in glib filename encoding (can be @@ -458,7 +458,7 @@ FmPath* fm_path_new_relative(FmPath* parent, const char* rel) /** * fm_path_new_for_path - * @path_name: a POSIX path. + * @path_name: (allow-none): a POSIX path. * * Returns: a newly created FmPath for the path. You have to call * fm_path_unref() when it's no longer needed. @@ -484,7 +484,7 @@ FmPath* fm_path_new_for_path(const char* path_name) /** * fm_path_new_for_uri - * @uri: a URI with special characters escaped. + * @uri: (allow-none): a URI with special characters escaped. * * Creates new #FmPath by given @uri. You have to call * fm_path_unref() when it's no longer needed. @@ -564,7 +564,7 @@ FmPath* fm_path_new_for_display_name(const char* path_name) /** * fm_path_new_for_str - * @path_str: a string representing the file path in its native + * @path_str: (allow-none): a string representing the file path in its native * encoding (can be non-UTF-8). It can either be a native path or an * unescaped URI (can contain non-ASCII characters and spaces). * The function will try to figure out what to do. -- 1.8.0.1