| Index: third_party/grpc/src/core/support/tmpfile_win32.c
|
| diff --git a/third_party/WebKit/Source/build/win/Precompile.h b/third_party/grpc/src/core/support/tmpfile_win32.c
|
| similarity index 54%
|
| copy from third_party/WebKit/Source/build/win/Precompile.h
|
| copy to third_party/grpc/src/core/support/tmpfile_win32.c
|
| index 8a0ff29c353fc1d30c92d27f369d7c422a579bc8..3000f0029fe7e55d2617572031977638bbcd0760 100644
|
| --- a/third_party/WebKit/Source/build/win/Precompile.h
|
| +++ b/third_party/grpc/src/core/support/tmpfile_win32.c
|
| @@ -1,5 +1,7 @@
|
| /*
|
| - * Copyright (C) 2012 Google Inc. All rights reserved.
|
| + *
|
| + * Copyright 2015-2016, Google Inc.
|
| + * All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -26,43 +28,57 @@
|
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| - */
|
| -
|
| -/*
|
| - * Precompiled header for WebKit when built on Windows using
|
| - * GYP-generated project files. Not used by other build
|
| - * configurations.
|
| *
|
| - * Using precompiled headers speeds the build up significantly. On a
|
| - * fast machine (HP Z600, 12 GB of RAM), an ~18% decrease in full
|
| - * build time was measured.
|
| */
|
|
|
| -#if defined(WinPrecompile_h_)
|
| -#error You shouldn't include the precompiled header file more than once.
|
| -#endif
|
| +#include <grpc/support/port_platform.h>
|
|
|
| -#define WinPrecompile_h_
|
| +#ifdef GPR_WIN32
|
|
|
| -#define _USE_MATH_DEFINES // Make math.h behave like other platforms.
|
| -
|
| -#include <Windows.h>
|
| -
|
| -#include <errno.h>
|
| -#include <fcntl.h>
|
| -#include <limits.h>
|
| -#include <math.h>
|
| -#include <stdarg.h>
|
| -#include <stddef.h>
|
| +#include <io.h>
|
| #include <stdio.h>
|
| -#include <stdlib.h>
|
| #include <string.h>
|
| -#include <time.h>
|
| +#include <tchar.h>
|
| +
|
| +#include <grpc/support/alloc.h>
|
| +#include <grpc/support/log.h>
|
| +#include <grpc/support/string_util.h>
|
| +
|
| +#include "src/core/support/string_win32.h"
|
| +#include "src/core/support/tmpfile.h"
|
| +
|
| +FILE *gpr_tmpfile(const char *prefix, char **tmp_filename_out) {
|
| + FILE *result = NULL;
|
| + LPTSTR template_string = NULL;
|
| + TCHAR tmp_path[MAX_PATH];
|
| + TCHAR tmp_filename[MAX_PATH];
|
| + DWORD status;
|
| + UINT success;
|
| +
|
| + if (tmp_filename_out != NULL) *tmp_filename_out = NULL;
|
| +
|
| + /* Convert our prefix to TCHAR. */
|
| + template_string = gpr_char_to_tchar(prefix);
|
| + GPR_ASSERT(template_string);
|
| +
|
| + /* Get the path to the best temporary folder available. */
|
| + status = GetTempPath(MAX_PATH, tmp_path);
|
| + if (status == 0 || status > MAX_PATH) goto end;
|
| +
|
| + /* Generate a unique filename with our template + temporary path. */
|
| + success = GetTempFileName(tmp_path, template_string, 0, tmp_filename);
|
| + if (!success) goto end;
|
| +
|
| + /* Open a file there. */
|
| + if (_tfopen_s(&result, tmp_filename, TEXT("wb+")) != 0) goto end;
|
| +
|
| +end:
|
| + if (result && tmp_filename_out) {
|
| + *tmp_filename_out = gpr_tchar_to_char(tmp_filename);
|
| + }
|
| +
|
| + gpr_free(template_string);
|
| + return result;
|
| +}
|
|
|
| -#include <algorithm>
|
| -#include <ciso646>
|
| -#include <cmath>
|
| -#include <cstddef>
|
| -#include <limits>
|
| -#include <string>
|
| -#include <utility>
|
| +#endif /* GPR_WIN32 */
|
|
|