Skip to content

Commit

Permalink
[android] Make operator==(SbDrmKeyId, ...) static (#4689)
Browse files Browse the repository at this point in the history
It wasn't defined in the anonymous namespace to be picked up by
`std::vector<SbDrmKeyId>::operator==()` via argument dependent lookup.
Now it's explicitly defined as static to avoid polluting the global
namespace.

b/327287075
  • Loading branch information
xiaomings authored Jan 13, 2025
1 parent 208fd28 commit a7c27be
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions starboard/android/shared/drm_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ SbDrmSessionRequestType SbDrmSessionRequestTypeFromMediaDrmKeyRequestType(

} // namespace

// This has to be defined outside the above anonymous namespace to be picked up
// by the comparison of std::vector<SbDrmKeyId>.
bool operator==(const SbDrmKeyId& left, const SbDrmKeyId& right) {
// Declare the function as static instead of putting it in the above anonymous
// namespace so it can be picked up by `std::vector<SbDrmKeyId>::operator==()`
// as functions in anonymous namespace doesn't participate in argument dependent
// lookup.
static bool operator==(const SbDrmKeyId& left, const SbDrmKeyId& right) {
if (left.identifier_size != right.identifier_size) {
return false;
}
Expand Down

0 comments on commit a7c27be

Please sign in to comment.