Blame SOURCES/0001-Add-missing-windows-specific-headers.patch

14ed36
From bf25c45e540d7e961704c245e7be439b580c93c2 Mon Sep 17 00:00:00 2001
14ed36
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
14ed36
Date: Thu, 30 Jun 2016 15:08:17 -0400
14ed36
Subject: [PATCH 01/16] Add missing windows specific headers
14ed36
14ed36
https://bugs.freedesktop.org/show_bug.cgi?id=96754
14ed36
---
14ed36
 webrtc/base/win32.h | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++
14ed36
 1 file changed, 103 insertions(+)
14ed36
 create mode 100644 webrtc/base/win32.h
14ed36
14ed36
diff --git a/webrtc/base/win32.h b/webrtc/base/win32.h
14ed36
new file mode 100644
14ed36
index 0000000..6969c10
14ed36
--- /dev/null
14ed36
+++ b/webrtc/base/win32.h
14ed36
@@ -0,0 +1,103 @@
14ed36
+/*
14ed36
+ *  Copyright 2004 The WebRTC Project Authors. All rights reserved.
14ed36
+ *
14ed36
+ *  Use of this source code is governed by a BSD-style license
14ed36
+ *  that can be found in the LICENSE file in the root of the source
14ed36
+ *  tree. An additional intellectual property rights grant can be found
14ed36
+ *  in the file PATENTS.  All contributing project authors may
14ed36
+ *  be found in the AUTHORS file in the root of the source tree.
14ed36
+ */
14ed36
+#ifndef WEBRTC_BASE_WIN32_H_
14ed36
+#define WEBRTC_BASE_WIN32_H_
14ed36
+#if defined(WEBRTC_WIN)
14ed36
+#ifndef WIN32_LEAN_AND_MEAN
14ed36
+#define WIN32_LEAN_AND_MEAN
14ed36
+#endif
14ed36
+// Make sure we don't get min/max macros
14ed36
+#ifndef NOMINMAX
14ed36
+#define NOMINMAX
14ed36
+#endif
14ed36
+#include <winsock2.h>
14ed36
+#include <windows.h>
14ed36
+#ifndef SECURITY_MANDATORY_LABEL_AUTHORITY
14ed36
+// Add defines that we use if we are compiling against older sdks
14ed36
+#define SECURITY_MANDATORY_MEDIUM_RID               (0x00002000L)
14ed36
+#define TokenIntegrityLevel static_cast<TOKEN_INFORMATION_CLASS>(0x19)
14ed36
+typedef struct _TOKEN_MANDATORY_LABEL {
14ed36
+    SID_AND_ATTRIBUTES Label;
14ed36
+} TOKEN_MANDATORY_LABEL, *PTOKEN_MANDATORY_LABEL;
14ed36
+#endif  // SECURITY_MANDATORY_LABEL_AUTHORITY
14ed36
+#undef SetPort
14ed36
+#include <string>
14ed36
+#include "webrtc/base/stringutils.h"
14ed36
+#include "webrtc/base/basictypes.h"
14ed36
+namespace rtc {
14ed36
+const char* win32_inet_ntop(int af, const void *src, char* dst, socklen_t size);
14ed36
+int win32_inet_pton(int af, const char* src, void *dst);
14ed36
+inline std::wstring ToUtf16(const char* utf8, size_t len) {
14ed36
+  int len16 = ::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast<int>(len),
14ed36
+                                    NULL, 0);
14ed36
+  wchar_t* ws = STACK_ARRAY(wchar_t, len16);
14ed36
+  ::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast<int>(len), ws, len16);
14ed36
+  return std::wstring(ws, len16);
14ed36
+}
14ed36
+inline std::wstring ToUtf16(const std::string& str) {
14ed36
+  return ToUtf16(str.data(), str.length());
14ed36
+}
14ed36
+inline std::string ToUtf8(const wchar_t* wide, size_t len) {
14ed36
+  int len8 = ::WideCharToMultiByte(CP_UTF8, 0, wide, static_cast<int>(len),
14ed36
+                                   NULL, 0, NULL, NULL);
14ed36
+  char* ns = STACK_ARRAY(char, len8);
14ed36
+  ::WideCharToMultiByte(CP_UTF8, 0, wide, static_cast<int>(len), ns, len8,
14ed36
+                        NULL, NULL);
14ed36
+  return std::string(ns, len8);
14ed36
+}
14ed36
+inline std::string ToUtf8(const wchar_t* wide) {
14ed36
+  return ToUtf8(wide, wcslen(wide));
14ed36
+}
14ed36
+inline std::string ToUtf8(const std::wstring& wstr) {
14ed36
+  return ToUtf8(wstr.data(), wstr.length());
14ed36
+}
14ed36
+// Convert FILETIME to time_t
14ed36
+void FileTimeToUnixTime(const FILETIME& ft, time_t* ut);
14ed36
+// Convert time_t to FILETIME
14ed36
+void UnixTimeToFileTime(const time_t& ut, FILETIME * ft);
14ed36
+// Convert a Utf8 path representation to a non-length-limited Unicode pathname.
14ed36
+bool Utf8ToWindowsFilename(const std::string& utf8, std::wstring* filename);
14ed36
+// Convert a FILETIME to a UInt64
14ed36
+inline uint64_t ToUInt64(const FILETIME& ft) {
14ed36
+  ULARGE_INTEGER r = {{ft.dwLowDateTime, ft.dwHighDateTime}};
14ed36
+  return r.QuadPart;
14ed36
+}
14ed36
+enum WindowsMajorVersions {
14ed36
+  kWindows2000 = 5,
14ed36
+  kWindowsVista = 6,
14ed36
+};
14ed36
+bool GetOsVersion(int* major, int* minor, int* build);
14ed36
+inline bool IsWindowsVistaOrLater() {
14ed36
+  int major;
14ed36
+  return (GetOsVersion(&major, NULL, NULL) && major >= kWindowsVista);
14ed36
+}
14ed36
+inline bool IsWindowsXpOrLater() {
14ed36
+  int major, minor;
14ed36
+  return (GetOsVersion(&major, &minor, NULL) &&
14ed36
+          (major >= kWindowsVista ||
14ed36
+          (major == kWindows2000 && minor >= 1)));
14ed36
+}
14ed36
+inline bool IsWindows8OrLater() {
14ed36
+  int major, minor;
14ed36
+  return (GetOsVersion(&major, &minor, NULL) &&
14ed36
+          (major > kWindowsVista ||
14ed36
+          (major == kWindowsVista && minor >= 2)));
14ed36
+}
14ed36
+// Determine the current integrity level of the process.
14ed36
+bool GetCurrentProcessIntegrityLevel(int* level);
14ed36
+inline bool IsCurrentProcessLowIntegrity() {
14ed36
+  int level;
14ed36
+  return (GetCurrentProcessIntegrityLevel(&level) &&
14ed36
+      level < SECURITY_MANDATORY_MEDIUM_RID);
14ed36
+}
14ed36
+bool AdjustCurrentProcessPrivilege(const TCHAR* privilege, bool to_enable);
14ed36
+}  // namespace rtc
14ed36
+#endif  // WEBRTC_WIN
14ed36
+#endif  // WEBRTC_BASE_WIN32_H_
14ed36
-- 
14ed36
2.14.3
14ed36