#define PF_DIR ".wireshark"
#endif
-#ifdef _WIN32
-/* utf8 version of getenv, needed to get win32 filename paths */
-char *getenv_utf8(const char *varname)
-{
- char *envvar;
- wchar_t *envvarw;
- wchar_t *varnamew;
-
- envvar = getenv(varname);
-
- /* since GLib 2.6 we need an utf8 version of the filename */
-#if GLIB_CHECK_VERSION(2,6,0)
- /* using the wide char version of getenv should work under all circumstances */
-
- /* convert given varname to utf16, needed by _wgetenv */
- varnamew = g_utf8_to_utf16(varname, -1, NULL, NULL, NULL);
- if (varnamew == NULL) {
- return envvar;
- }
-
- /* use wide char version of getenv */
- envvarw = _wgetenv(varnamew);
- g_free(varnamew);
- if (envvarw == NULL) {
- return envvar;
- }
-
- /* convert value to utf8 */
- envvar = g_utf16_to_utf8(envvarw, -1, NULL, NULL, NULL);
- /* XXX - memleak */
-#endif
-
- return envvar;
-}
-#endif
-
void
set_profile_name(const gchar *profilename)
{
*/
extern char *get_datafile_path(const char *filename);
-/*
+/*
* Get the personal plugin dir.
*/
extern char *get_plugins_pers_dir(void);
extern const char *get_systemfile_dir(void);
/*
- * Set the configuration profile name to be used for storing
+ * Set the configuration profile name to be used for storing
* personal configuration files.
*/
extern void set_profile_name(const gchar *profilename);
*/
extern gboolean profile_exists(const gchar *profilename);
-/*
+/*
* Create a directory for the given configuration profile.
* If we attempted to create it, and failed, return -1 and
* set "*pf_dir_path_return" to the pathname of the directory we failed
* to create (it's g_mallocated, so our caller should free it); otherwise,
* return 0.
*/
-extern int create_persconffile_profile(const char *profilename,
+extern int create_persconffile_profile(const char *profilename,
char **pf_dir_path_return);
-/*
+/*
* Delete the directory for the given configuration profile.
* If we attempted to delete it, and failed, return -1 and
* set "*pf_dir_path_return" to the pathname of the directory we failed
* to delete (it's g_mallocated, so our caller should free it); otherwise,
* return 0.
*/
-extern int delete_persconffile_profile(const char *profilename,
+extern int delete_persconffile_profile(const char *profilename,
char **pf_dir_path_return);
-/*
+/*
* Rename the directory for the given confinguration profile.
*/
extern int rename_persconffile_profile(const char *fromname, const char *toname,
- char **pf_from_dir_path_return,
+ char **pf_from_dir_path_return,
char **pf_to_dir_path_return);
-/*
+/*
* Copy files in one profile to the other.
*/
extern int copy_persconffile_profile(const char *toname, const char *fromname,
*/
extern char *get_tempfile_path(const char *filename);
-/*
+/*
* process command line option belonging to the filesystem settings
*/
extern int filesystem_opt(int opt, const char *optstr);
extern gboolean copy_file_binary_mode(const char *from_filename,
const char *to_filename);
-#ifdef _WIN32
-/*
- * utf8 version of getenv, needed to get win32 filename paths
- */
-extern char *getenv_utf8(const char *varname);
-#endif
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
get_tempfile_path
get_udp_port
get_wspython_dir
-getenv_utf8
golay_decode
golay_encode
golay_errors
/* DLL loading */
static gboolean
-init_dll_load_paths() {
+init_dll_load_paths()
+{
TCHAR path_w[MAX_PATH];
if (program_path && system_path)
}
gboolean
-ws_init_dll_search_path() {
+ws_init_dll_search_path()
+{
gboolean dll_dir_set = FALSE;
wchar_t *program_path_w;
*/
void *
-ws_load_library(gchar *library_name) {
+ws_load_library(gchar *library_name)
+{
gchar *full_path;
wchar_t *full_path_w;
HMODULE dll_h;
}
GModule *
-ws_module_open(gchar *module_name, GModuleFlags flags) {
+ws_module_open(gchar *module_name, GModuleFlags flags)
+{
gchar *full_path;
GModule *mod;
return NULL;
}
+
+/* utf8 version of getenv, needed to get win32 filename paths */
+char *
+getenv_utf8(const char *varname)
+{
+ char *envvar;
+ wchar_t *envvarw;
+ wchar_t *varnamew;
+
+ envvar = getenv(varname);
+
+ /* since GLib 2.6 we need an utf8 version of the filename */
+#if GLIB_CHECK_VERSION(2,6,0)
+ /* using the wide char version of getenv should work under all circumstances */
+
+ /* convert given varname to utf16, needed by _wgetenv */
+ varnamew = g_utf8_to_utf16(varname, -1, NULL, NULL, NULL);
+ if (varnamew == NULL) {
+ return envvar;
+ }
+
+ /* use wide char version of getenv */
+ envvarw = _wgetenv(varnamew);
+ g_free(varnamew);
+ if (envvarw == NULL) {
+ return envvar;
+ }
+
+ /* convert value to utf8 */
+ envvar = g_utf16_to_utf8(envvarw, -1, NULL, NULL, NULL);
+ /* XXX - memleak */
+#endif
+
+ return envvar;
+}
+
* @return A handle to the DLL if found, NULL on failure.
*/
GModule *ws_module_open(gchar *module_name, GModuleFlags flags);
+
+/*
+ * utf8 version of getenv, needed to get win32 filename paths
+ */
+extern char *getenv_utf8(const char *varname);
+
#else /* _WIN32 */
#define ws_read read
#define ws_write write
EXPORTS
; file_util.c
+getenv_utf8
ws_stdio_fopen
ws_stdio_freopen
ws_stdio_mkdir
*/
/* Convert from UTF-8 to UTF-16. */
-wchar_t * utf_8to16(const char *utf8str) {
+wchar_t *
+utf_8to16(const char *utf8str)
+{
static wchar_t *utf16buf[3];
static int utf16buf_len[3];
static int idx;
return utf16buf[idx];
}
-void utf_8to16_snprintf(TCHAR *utf16buf, gint utf16buf_len, const gchar* fmt, ...) {
+void
+utf_8to16_snprintf(TCHAR *utf16buf, gint utf16buf_len, const gchar* fmt, ...)
+{
va_list ap;
gchar* dst;
}
/* Convert from UTF-16 to UTF-8. */
-gchar * utf_16to8(const wchar_t *utf16str) {
+gchar *
+utf_16to8(const wchar_t *utf16str)
+{
static gchar *utf8buf[3];
static int utf8buf_len[3];
static int idx;