-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from google/cpp-sync
internal changes (some fixes might be in older sync) Fixes #88 Fixes #83 Fixes #82 Fixes #66 Fixes #57 Fixes #21 Fixes #15
- Loading branch information
Showing
62 changed files
with
1,779 additions
and
660 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "base/unilib.h" | ||
|
||
#include "flatbuffers/util.h" | ||
|
||
namespace UniLib { | ||
|
||
// Detects whether a string is valid UTF-8. | ||
bool IsStructurallyValid(absl::string_view str) { | ||
const char *s = &str[0]; | ||
const char *const sEnd = s + str.length(); | ||
while (s < sEnd) { | ||
if (flatbuffers::FromUTF8(&s) < 0) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
} // namespace UniLib |
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,29 @@ | ||
/* | ||
* Copyright 2021 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef THIRD_PARTY_CEL_CPP_BASE_UNILIB_H_ | ||
#define THIRD_PARTY_CEL_CPP_BASE_UNILIB_H_ | ||
|
||
#include "absl/strings/string_view.h" | ||
|
||
namespace UniLib { | ||
|
||
// Detects whether a string is valid UTF-8. | ||
bool IsStructurallyValid(absl::string_view str); | ||
|
||
} // namespace UniLib | ||
|
||
#endif // THIRD_PARTY_CEL_CPP_BASE_UNILIB_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
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
Oops, something went wrong.