@@ -182,42 +182,6 @@ vfs_canon (const char *path)
182
182
return result ;
183
183
}
184
184
185
- /* --------------------------------------------------------------------------------------------- */
186
-
187
- #ifdef HAVE_CHARSET
188
- /** get encoding after last #enc: or NULL, if part does not contain #enc:
189
- *
190
- * @param path null-terminated string
191
- * @param len the maximum length of path, where #enc: should be searched
192
- *
193
- * @return newly allocated string.
194
- */
195
-
196
- static char *
197
- vfs_get_encoding (const char * path , ssize_t len )
198
- {
199
- char * semi ;
200
-
201
- /* try found #enc: */
202
- semi = g_strrstr_len (path , len , VFS_ENCODING_PREFIX );
203
- if (semi == NULL )
204
- return NULL ;
205
-
206
- if (semi == path || IS_PATH_SEP (semi [-1 ]))
207
- {
208
- char * slash ;
209
-
210
- semi += strlen (VFS_ENCODING_PREFIX ); /* skip "#enc:" */
211
- slash = strchr (semi , PATH_SEP );
212
- if (slash != NULL )
213
- return g_strndup (semi , slash - semi );
214
- return g_strdup (semi );
215
- }
216
-
217
- return vfs_get_encoding (path , semi - path );
218
- }
219
- #endif
220
-
221
185
/* --------------------------------------------------------------------------------------------- */
222
186
/** Extract the hostname and username from the path
223
187
*
@@ -896,8 +860,8 @@ vfs_path_element_clone (const vfs_path_element_t *element)
896
860
new_element -> vfs_prefix = g_strdup (element -> vfs_prefix );
897
861
#ifdef HAVE_CHARSET
898
862
new_element -> encoding = g_strdup (element -> encoding );
899
- if (vfs_path_element_need_cleanup_converter (element ) && new_element -> encoding != NULL )
900
- new_element -> dir .converter = str_crt_conv_from (new_element -> encoding );
863
+ if (vfs_path_element_need_cleanup_converter (element ) && element -> encoding != NULL )
864
+ new_element -> dir .converter = str_crt_conv_from (element -> encoding );
901
865
else
902
866
new_element -> dir .converter = element -> dir .converter ;
903
867
#endif
@@ -1071,6 +1035,39 @@ vfs_prefix_to_class (const char *prefix)
1071
1035
1072
1036
#ifdef HAVE_CHARSET
1073
1037
1038
+ /** get encoding after last #enc: or NULL, if part does not contain #enc:
1039
+ *
1040
+ * @param path null-terminated string
1041
+ * @param len the maximum length of path, where #enc: should be searched
1042
+ *
1043
+ * @return newly allocated string.
1044
+ */
1045
+
1046
+ char *
1047
+ vfs_get_encoding (const char * path , ssize_t len )
1048
+ {
1049
+ char * semi ;
1050
+
1051
+ /* try found #enc: */
1052
+ semi = g_strrstr_len (path , len , VFS_ENCODING_PREFIX );
1053
+ if (semi == NULL )
1054
+ return NULL ;
1055
+
1056
+ if (semi == path || IS_PATH_SEP (semi [-1 ]))
1057
+ {
1058
+ char * slash ;
1059
+
1060
+ semi += strlen (VFS_ENCODING_PREFIX ); /* skip "#enc:" */
1061
+ slash = strchr (semi , PATH_SEP );
1062
+ if (slash != NULL )
1063
+ return g_strndup (semi , slash - semi );
1064
+ return g_strdup (semi );
1065
+ }
1066
+
1067
+ return vfs_get_encoding (path , semi - path );
1068
+ }
1069
+
1070
+ /* --------------------------------------------------------------------------------------------- */
1074
1071
/**
1075
1072
* Check if need cleanup charset converter for vfs_path_element_t
1076
1073
*
0 commit comments