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

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