aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nnoble@google.com>2015-02-09 16:30:35 -0800
committerGravatar Nicolas Noble <nnoble@google.com>2015-02-09 16:30:35 -0800
commitd72ba6a4ffe695a38600719cee96d39c1a307623 (patch)
tree91dc0590bfc9341bd74f1f3c50d599eac1f96cf6
parent811b07876c53de41c0e9b5dbe423a4a4340fad38 (diff)
Merge cleanup.
-rw-r--r--src/core/iomgr/tcp_server_windows.c10
-rw-r--r--src/core/support/log_win32.c30
2 files changed, 13 insertions, 27 deletions
diff --git a/src/core/iomgr/tcp_server_windows.c b/src/core/iomgr/tcp_server_windows.c
index 97f8fe41ea..e6161eb1e8 100644
--- a/src/core/iomgr/tcp_server_windows.c
+++ b/src/core/iomgr/tcp_server_windows.c
@@ -38,16 +38,18 @@
#define _GNU_SOURCE
#include "src/core/iomgr/sockaddr_utils.h"
-#include "src/core/iomgr/pollset_windows.h"
-#include "src/core/iomgr/socket_windows.h"
-#include "src/core/iomgr/tcp_server.h"
-#include "src/core/iomgr/tcp_windows.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/log_win32.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
+#include "src/core/iomgr/iocp_windows.h"
+#include "src/core/iomgr/pollset_windows.h"
+#include "src/core/iomgr/socket_windows.h"
+#include "src/core/iomgr/tcp_server.h"
+#include "src/core/iomgr/tcp_windows.h"
+
#define INIT_PORT_CAP 2
#define MIN_SAFE_ACCEPT_QUEUE_SIZE 100
diff --git a/src/core/support/log_win32.c b/src/core/support/log_win32.c
index 4c0a866048..840f24f68a 100644
--- a/src/core/support/log_win32.c
+++ b/src/core/support/log_win32.c
@@ -35,12 +35,15 @@
#ifdef GPR_WIN32
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <grpc/support/alloc.h>
#include <grpc/support/log_win32.h>
#include <grpc/support/log.h>
-#include <grpc/support/alloc.h>
#include <grpc/support/time.h>
-#include <stdio.h>
-#include <stdarg.h>
+
+#include "src/core/support/string_win32.h"
void gpr_log(const char *file, int line, gpr_log_severity severity,
const char *format, ...) {
@@ -93,25 +96,6 @@ void gpr_default_log(gpr_log_func_args *args) {
args->file, args->line, args->message);
}
-/* Arguable, this could become a public function. But hardly
- * anything beside the Windows implementation should use
- * it, so, never mind...*/
-#if defined UNICODE || defined _UNICODE
-static char *tchar_to_char(LPWSTR input) {
- char *ret;
- int needed = WideCharToMultiByte(CP_UTF8, 0, input, -1, NULL, 0, NULL, NULL);
- if (needed == 0) return NULL;
- ret = gpr_malloc(needed + 1);
- WideCharToMultiByte(CP_UTF8, 0, input, -1, ret, needed, NULL, NULL);
- ret[needed] = 0;
- return ret;
-}
-#else
-static char *tchar_to_char(LPSTR input) {
- return gpr_strdup(input);
-}
-#endif
-
char *gpr_format_message(DWORD messageid) {
LPTSTR tmessage;
char *message;
@@ -121,7 +105,7 @@ char *gpr_format_message(DWORD messageid) {
NULL, messageid,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)(&tmessage), 0, NULL);
- message = tchar_to_char(tmessage);
+ message = gpr_tchar_to_char(tmessage);
LocalFree(tmessage);
return message;
}