forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that Skia persistent cache filenames do not exceed the maximum…
… allowed length (flutter#28315)
- Loading branch information
1 parent
a166c32
commit f8b4e8a
Showing
11 changed files
with
203 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "flutter/fml/base32.h" | ||
|
||
#include <string> | ||
|
||
namespace fml { | ||
|
||
static constexpr char kEncoding[] = "0123456789abcdef"; | ||
|
||
std::string HexEncode(std::string_view input) { | ||
std::string result; | ||
result.reserve(input.size() * 2); | ||
for (char c : input) { | ||
uint8_t b = static_cast<uint8_t>(c); | ||
result.push_back(kEncoding[b >> 4]); | ||
result.push_back(kEncoding[b & 0xF]); | ||
} | ||
return result; | ||
} | ||
|
||
} // namespace fml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef FLUTTER_FML_HEX_CODEC_H_ | ||
#define FLUTTER_FML_HEX_CODEC_H_ | ||
|
||
#include <string_view> | ||
|
||
namespace fml { | ||
|
||
std::string HexEncode(std::string_view input); | ||
|
||
} // namespace fml | ||
|
||
#endif // FLUTTER_FML_HEX_CODEC_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "flutter/fml/hex_codec.h" | ||
|
||
#include <iostream> | ||
|
||
#include "gtest/gtest.h" | ||
|
||
TEST(HexCodecTest, CanEncode) { | ||
{ | ||
auto result = fml::HexEncode("hello"); | ||
ASSERT_EQ(result, "68656c6c6f"); | ||
} | ||
|
||
{ | ||
auto result = fml::HexEncode(""); | ||
ASSERT_EQ(result, ""); | ||
} | ||
|
||
{ | ||
auto result = fml::HexEncode("1"); | ||
ASSERT_EQ(result, "31"); | ||
} | ||
|
||
{ | ||
auto result = fml::HexEncode(std::string_view("\xFF\xFE\x00\x01", 4)); | ||
ASSERT_EQ(result, "fffe0001"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.