WebKit Bugzilla
Attachment 349596 Details for
Bug 189565
: Add support for HEVC codec types in Media Capabilities
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189565-20180912163650.patch (text/plain), 8.52 KB, created by
Jer Noble
on 2018-09-12 16:36:51 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2018-09-12 16:36:51 PDT
Size:
8.52 KB
patch
obsolete
>Subversion Revision: 235955 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index d98bacdffc64ac75947a390cd95541baf497a891..06cb74ee9233eef4740ceac5154a811313ad3ab9 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,18 @@ >+2018-09-12 Jer Noble <jer.noble@apple.com> >+ >+ Add support for HEVC codec types in Media Capabilities >+ https://bugs.webkit.org/show_bug.cgi?id=189565 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Extract the toIntegralType template into its own header. >+ >+ * wtf/CMakeLists.txt: >+ * wtf/text/StringConversion.h: Added. >+ (isCharacterAllowedInBase): >+ (toIntegralType): >+ * wtf/text/WTFString.cpp: >+ > 2018-08-29 Jer Noble <jer.noble@apple.com> > > Enable USE_MEDIAREMOTE on iOS >diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt >index fb348abc3f82d05398581718d64ac0f523dcfca6..83f9a4cc57a9f21b609b8a65e26664ba162361c2 100644 >--- a/Source/WTF/wtf/CMakeLists.txt >+++ b/Source/WTF/wtf/CMakeLists.txt >@@ -297,6 +297,7 @@ set(WTF_PUBLIC_HEADERS > text/StringCommon.h > text/StringConcatenate.h > text/StringConcatenateNumbers.h >+ text/StringConversion.h > text/StringHash.h > text/StringHasher.h > text/StringImpl.h >diff --git a/Source/WTF/wtf/text/StringConversion.h b/Source/WTF/wtf/text/StringConversion.h >new file mode 100644 >index 0000000000000000000000000000000000000000..26312e93890099f1a65b430e6caa47cf4c77849d >--- /dev/null >+++ b/Source/WTF/wtf/text/StringConversion.h >@@ -0,0 +1,125 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY 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. >+ */ >+ >+#pragma once >+ >+inline bool isCharacterAllowedInBase(UChar c, int base) >+{ >+ if (c > 0x7F) >+ return false; >+ if (isASCIIDigit(c)) >+ return c - '0' < base; >+ if (isASCIIAlpha(c)) { >+ if (base > 36) >+ base = 36; >+ return (c >= 'a' && c < 'a' + base - 10) >+ || (c >= 'A' && c < 'A' + base - 10); >+ } >+ return false; >+} >+ >+template<typename IntegralType, typename CharacterType> >+inline IntegralType toIntegralType(const CharacterType* data, size_t length, bool* ok = nullptr, int base = 10) >+{ >+ static const IntegralType integralMax = std::numeric_limits<IntegralType>::max(); >+ static const bool isSigned = std::numeric_limits<IntegralType>::is_signed; >+ const IntegralType maxMultiplier = integralMax / base; >+ >+ IntegralType value = 0; >+ bool isOk = false; >+ bool isNegative = false; >+ >+ if (!data) >+ goto bye; >+ >+ // skip leading whitespace >+ while (length && isSpaceOrNewline(*data)) { >+ --length; >+ ++data; >+ } >+ >+ if (isSigned && length && *data == '-') { >+ --length; >+ ++data; >+ isNegative = true; >+ } else if (length && *data == '+') { >+ --length; >+ ++data; >+ } >+ >+ if (!length || !isCharacterAllowedInBase(*data, base)) >+ goto bye; >+ >+ while (length && isCharacterAllowedInBase(*data, base)) { >+ --length; >+ IntegralType digitValue; >+ auto c = *data; >+ if (isASCIIDigit(c)) >+ digitValue = c - '0'; >+ else if (c >= 'a') >+ digitValue = c - 'a' + 10; >+ else >+ digitValue = c - 'A' + 10; >+ >+ if (value > maxMultiplier || (value == maxMultiplier && digitValue > (integralMax % base) + isNegative)) >+ goto bye; >+ >+ value = base * value + digitValue; >+ ++data; >+ } >+ >+#if COMPILER(MSVC) >+#pragma warning(push, 0) >+#pragma warning(disable:4146) >+#endif >+ >+ if (isNegative) >+ value = -value; >+ >+#if COMPILER(MSVC) >+#pragma warning(pop) >+#endif >+ >+ // skip trailing space >+ while (length && isSpaceOrNewline(*data)) { >+ --length; >+ ++data; >+ } >+ >+ if (!length) >+ isOk = true; >+bye: >+ if (ok) >+ *ok = isOk; >+ return isOk ? value : 0; >+} >+ >+template<typename IntegralType, typename StringOrStringView> >+inline IntegralType toIntegralType(const StringOrStringView& stringView, bool* ok = nullptr, int base = 10) >+{ >+ if (stringView.is8Bit()) >+ return toIntegralType<IntegralType, LChar>(stringView.characters8(), stringView.length(), ok, base); >+ return toIntegralType<IntegralType, UChar>(stringView.characters16(), stringView.length(), ok, base); >+} >diff --git a/Source/WTF/wtf/text/WTFString.cpp b/Source/WTF/wtf/text/WTFString.cpp >index a87529fc6b3b82f238ae750ff9c293d648b2c3e7..6bb2f1bc670961ba69e816d1c77af65dbf2be482 100644 >--- a/Source/WTF/wtf/text/WTFString.cpp >+++ b/Source/WTF/wtf/text/WTFString.cpp >@@ -29,9 +29,10 @@ > #include <wtf/HexNumber.h> > #include <wtf/MathExtras.h> > #include <wtf/NeverDestroyed.h> >-#include <wtf/text/CString.h> > #include <wtf/Vector.h> > #include <wtf/dtoa.h> >+#include <wtf/text/CString.h> >+#include <wtf/text/StringConversion.h> > #include <wtf/unicode/CharacterNames.h> > #include <wtf/unicode/UTF8.h> > >@@ -930,98 +931,6 @@ String String::fromUTF8WithLatin1Fallback(const LChar* string, size_t size) > } > > // String Operations >- >-static bool isCharacterAllowedInBase(UChar c, int base) >-{ >- if (c > 0x7F) >- return false; >- if (isASCIIDigit(c)) >- return c - '0' < base; >- if (isASCIIAlpha(c)) { >- if (base > 36) >- base = 36; >- return (c >= 'a' && c < 'a' + base - 10) >- || (c >= 'A' && c < 'A' + base - 10); >- } >- return false; >-} >- >-template<typename IntegralType, typename CharacterType> >-static inline IntegralType toIntegralType(const CharacterType* data, size_t length, bool* ok, int base) >-{ >- static const IntegralType integralMax = std::numeric_limits<IntegralType>::max(); >- static const bool isSigned = std::numeric_limits<IntegralType>::is_signed; >- const IntegralType maxMultiplier = integralMax / base; >- >- IntegralType value = 0; >- bool isOk = false; >- bool isNegative = false; >- >- if (!data) >- goto bye; >- >- // skip leading whitespace >- while (length && isSpaceOrNewline(*data)) { >- --length; >- ++data; >- } >- >- if (isSigned && length && *data == '-') { >- --length; >- ++data; >- isNegative = true; >- } else if (length && *data == '+') { >- --length; >- ++data; >- } >- >- if (!length || !isCharacterAllowedInBase(*data, base)) >- goto bye; >- >- while (length && isCharacterAllowedInBase(*data, base)) { >- --length; >- IntegralType digitValue; >- auto c = *data; >- if (isASCIIDigit(c)) >- digitValue = c - '0'; >- else if (c >= 'a') >- digitValue = c - 'a' + 10; >- else >- digitValue = c - 'A' + 10; >- >- if (value > maxMultiplier || (value == maxMultiplier && digitValue > (integralMax % base) + isNegative)) >- goto bye; >- >- value = base * value + digitValue; >- ++data; >- } >- >-#if COMPILER(MSVC) >-#pragma warning(push, 0) >-#pragma warning(disable:4146) >-#endif >- >- if (isNegative) >- value = -value; >- >-#if COMPILER(MSVC) >-#pragma warning(pop) >-#endif >- >- // skip trailing space >- while (length && isSpaceOrNewline(*data)) { >- --length; >- ++data; >- } >- >- if (!length) >- isOk = true; >-bye: >- if (ok) >- *ok = isOk; >- return isOk ? value : 0; >-} >- > template<typename CharacterType> > static unsigned lengthOfCharactersAsInteger(const CharacterType* data, size_t length) > {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189565
:
349595
|
349596
|
349610
|
349616
|
349908
|
349910
|
349912
|
349921
|
349922