aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2006-09-22 21:14:54 +0000
committerGerald Combs <gerald@wireshark.org>2006-09-22 21:14:54 +0000
commit9e23f31e5f116054682b9f8460f56fb7e73eedd1 (patch)
treef003e5ec1c257836dda6c2c807fdb0ecccb60e73 /dumpcap.c
parentb4b9ced31a8ab30e521309304689e80e82b13530 (diff)
Add support for reading from stdin under Windows. Based on a patch sent
in last year by Gianluca Varenni. Add partial support for reading from named pipes (currently disabled). Move utf_8to16() and utf_16to8() to a separate module (unicode-utils.[ch]) so that we don't have to cut and paste code in dumpcap.c. Fix up whitespace. svn path=/trunk/; revision=19291
Diffstat (limited to 'dumpcap.c')
-rw-r--r--dumpcap.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/dumpcap.c b/dumpcap.c
index a34816a66f..a19db204b1 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -626,49 +626,3 @@ signal_pipe_check_running(void)
const char *netsnmp_get_version(void) { return ""; }
-
-#ifdef _WIN32
-
-/* Convert from UTF-16 to UTF-8. */
-/* XXX - copied from epan/strutil.c */
-#define INITIAL_FMTBUF_SIZE 128
-
-gchar * utf_16to8(const wchar_t *utf16str) {
- static gchar *utf8buf[3];
- static int utf8buf_len[3];
- static int idx;
-
- if (utf16str == NULL)
- return NULL;
-
- idx = (idx + 1) % 3;
-
- /*
- * Allocate the buffer if it's not already allocated.
- */
- if (utf8buf[idx] == NULL) {
- utf8buf_len[idx] = INITIAL_FMTBUF_SIZE;
- utf8buf[idx] = g_malloc(utf8buf_len[idx]);
- }
-
- while (WideCharToMultiByte(CP_UTF8, 0, utf16str, -1,
- NULL, 0, NULL, NULL) >= utf8buf_len[idx]) {
- /*
- * Double the buffer's size if it's not big enough.
- * The size of the buffer starts at 128, so doubling its size
- * adds at least another 128 bytes, which is more than enough
- * for one more character plus a terminating '\0'.
- */
- utf8buf_len[idx] *= 2;
- utf8buf[idx] = g_realloc(utf8buf[idx], utf8buf_len[idx]);
- }
-
- if (WideCharToMultiByte(CP_UTF8, 0, utf16str, -1,
- utf8buf[idx], utf8buf_len[idx], NULL, NULL) == 0)
- return NULL;
-
- return utf8buf[idx];
-}
-
-#endif /* _WIN32 */
-