Skip to content

Commit

Permalink
Clang-tidy and common typo fixes (#1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
berile authored Feb 15, 2023
1 parent 03b8d7e commit 7b3757d
Show file tree
Hide file tree
Showing 47 changed files with 444 additions and 546 deletions.
2 changes: 1 addition & 1 deletion app/src/util_ios.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ class ClassMethodImplementationCache {
// indexed by selector name with each element that referencing a dictionary
// of potential names for the selector that contains the original method
// implementation on the class.
// i.e
// i.e.
// selector_implementation_names_dict = dict[original_selector_name];
NSMutableDictionary *selector_implementation_names_per_selector_;

Expand Down
2 changes: 1 addition & 1 deletion gma/integration_test/src/integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ TEST_F(FirebaseGmaUITest, TestRewardedAdLoadAndShow) {
LogDebug("Waiting for a moment to ensure all callbacks are recorded.");
app_framework::ProcessEvents(2000);

// If not running the UI test in CI (running mannually), keep this check.
// If not running the UI test in CI (running manually), keep this check.
// Else running the UI test in CI, skip this check.
if (!ShouldRunUITests()) {
EXPECT_EQ(content_listener.num_ad_clicked(), 1);
Expand Down
1 change: 0 additions & 1 deletion gma/src/android/ad_request_converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

#include "app/src/log.h"
#include "app/src/util_android.h"
#include "gma/gma_resources.h"
#include "gma/src/android/gma_android.h"
#include "gma/src/common/gma_common.h"
#include "gma/src/include/firebase/gma.h"
Expand Down
2 changes: 1 addition & 1 deletion gma/src/android/ad_request_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace gma {
/// AdRequest.
/// @param[out] error kAdErrorCodeNone on success, or another error if
/// problems occurred.
/// @return On succes, a local reference to an Android object representing the
/// @return On success, a local reference to an Android object representing the
/// AdRequest, or nullptr on error.
jobject GetJavaAdRequestFromCPPAdRequest(const AdRequest& request,
gma::AdErrorCode* error);
Expand Down
5 changes: 2 additions & 3 deletions gma/src/android/ad_view_internal_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#include "app/src/assert.h"
#include "app/src/util_android.h"
#include "gma/gma_resources.h"
#include "gma/src/android/ad_request_converter.h"
#include "gma/src/android/gma_android.h"
#include "gma/src/common/gma_common.h"
Expand Down Expand Up @@ -108,9 +107,9 @@ struct NulleryInvocationOnMainThreadData {

AdViewInternalAndroid::AdViewInternalAndroid(AdView* base)
: AdViewInternal(base),
destroyed_(false),
helper_(nullptr),
initialized_(false),
destroyed_(false) {
initialized_(false) {
firebase::MutexLock lock(mutex_);

JNIEnv* env = ::firebase::gma::GetJNI();
Expand Down
16 changes: 8 additions & 8 deletions gma/src/android/gma_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static AdapterInitializationStatus PopulateAdapterInitializationStatus(
}

// Initializes the Google Mobile Ads SDK using the MobileAds.initialize()
// method. The GMA app ID is retreived from the App's android manifest.
// method. The GMA app ID is retrieved from the App's android manifest.
Future<AdapterInitializationStatus> InitializeGoogleMobileAds(JNIEnv* env) {
Future<AdapterInitializationStatus> future_to_return;
{
Expand Down Expand Up @@ -622,7 +622,6 @@ void CallOpenAdInspector(void* data) {
OpenAdInspectorCallData* call_data =
reinterpret_cast<OpenAdInspectorCallData*>(data);
JNIEnv* env = firebase::util::GetThreadsafeJNIEnv(call_data->vm);
bool jni_env_exists = (env != nullptr);
jlong jlistener = (jlong)call_data->listener;

jobject ad_inspector_helper_ref = env->NewObject(
Expand Down Expand Up @@ -653,7 +652,7 @@ void OpenAdInspector(AdParent parent, AdInspectorClosedListener* listener) {
call_data->ad_parent = env->NewGlobalRef(parent);
call_data->listener = listener;
jobject activity = ::firebase::gma::GetActivity();
util::RunOnMainThread(env, g_activity, CallOpenAdInspector, call_data);
util::RunOnMainThread(env, activity, CallOpenAdInspector, call_data);
}

void SetIsSameAppKeyEnabled(bool is_enabled) {}
Expand Down Expand Up @@ -816,8 +815,9 @@ AdValue::PrecisionType ConvertAndroidPrecisionTypeToCPPPrecisionType(
default:
LogWarning("Could not convert AdValue precisionType: %l",
j_precision_type);
return AdValue::kAdValuePrecisionUnknown;
case 0:
return AdValue::kdValuePrecisionUnknown;
return AdValue::kAdValuePrecisionUnknown;
case 1: // ESTIMATED
return AdValue::kAdValuePrecisionEstimated;
case 2: // PUBLISHER_PROVIDED
Expand Down Expand Up @@ -1216,10 +1216,10 @@ jobject CreateJavaAdSize(JNIEnv* env, jobject j_activity,
ad_size::GetMethodId(
ad_size::kGetCurrentOrientationAnchoredAdaptiveBannerAdSize),
j_activity, adsize.width());

break;
default:
FIREBASE_ASSERT_MESSAGE(true,
"Uknown Anchor Adaptive AdSize Orientation");
"Unknown Anchor Adaptive AdSize Orientation");
}
break;
case AdSize::kTypeInlineAdaptive:
Expand Down Expand Up @@ -1253,7 +1253,7 @@ jobject CreateJavaAdSize(JNIEnv* env, jobject j_activity,
break;
default:
FIREBASE_ASSERT_MESSAGE(
true, "Uknown Inline Adaptive AdSize Orientation");
true, "Unknown Inline Adaptive AdSize Orientation");
}
}
break;
Expand All @@ -1263,7 +1263,7 @@ jobject CreateJavaAdSize(JNIEnv* env, jobject j_activity,
adsize.width(), adsize.height());
break;
default:
FIREBASE_ASSERT_MESSAGE(true, "Uknown AdSize Type");
FIREBASE_ASSERT_MESSAGE(true, "Unknown AdSize Type");
}
bool jni_exception = util::CheckAndClearJniExceptions(env);
FIREBASE_ASSERT(!jni_exception);
Expand Down
2 changes: 1 addition & 1 deletion gma/src/android/gma_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ METHOD_LOOKUP_DECLARATION(gma_initialization_helper,
// Needed when GMA is initialized without Firebase.
JNIEnv* GetJNI();

// Retrieves the activity used to initalize GMA.
// Retrieves the activity used to initialize GMA.
jobject GetActivity();

// Register the native callbacks needed by the Futures.
Expand Down
1 change: 0 additions & 1 deletion gma/src/android/interstitial_ad_internal_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include "app/src/assert.h"
#include "app/src/util_android.h"
#include "gma/gma_resources.h"
#include "gma/src/android/ad_request_converter.h"
#include "gma/src/android/gma_android.h"
#include "gma/src/common/gma_common.h"
Expand Down
2 changes: 1 addition & 1 deletion gma/src/android/response_info_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ResponseInfo::ResponseInfo(const ResponseInfoInternal& response_info_internal) {
const int list_size = (int)env->CallIntMethod(
j_adapter_response_info_list, util::list::GetMethodId(util::list::kSize));
for (int i = 0; i < list_size; ++i) {
// AdatperResponseInfo for this adapter.
// AdapterResponseInfo for this adapter.
jobject j_adapter_response_info =
env->CallObjectMethod(j_adapter_response_info_list,
util::list::GetMethodId(util::list::kGet), i);
Expand Down
1 change: 0 additions & 1 deletion gma/src/android/rewarded_ad_internal_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include "app/src/assert.h"
#include "app/src/util_android.h"
#include "gma/gma_resources.h"
#include "gma/src/android/ad_request_converter.h"
#include "gma/src/android/gma_android.h"
#include "gma/src/common/gma_common.h"
Expand Down
3 changes: 0 additions & 3 deletions gma/src/common/ad_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
namespace firebase {
namespace gma {

const char kUninitializedError[] =
"Initialize() must be called before this method.";

AdView::AdView() {
FIREBASE_ASSERT(gma::IsInitialized());
internal_ = internal::AdViewInternal::CreateInstance(this);
Expand Down
2 changes: 1 addition & 1 deletion gma/src/common/ad_view_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class AdViewInternal {
// Future data used to synchronize asynchronous calls.
FutureData future_data_;

// Listener for AdView Lifecyle event callbacks.
// Listener for AdView Lifecycle event callbacks.
AdListener* ad_listener_;

// Tracks the size of the AdView.
Expand Down
6 changes: 3 additions & 3 deletions gma/src/common/gma_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ const AdSize AdSize::kLeaderboard(728, 90);
const AdSize AdSize::kMediumRectangle(300, 250);

AdSize::AdSize(uint32_t width, uint32_t height)
: width_(width),
: orientation_(AdSize::kOrientationCurrent),
width_(width),
height_(height),
type_(AdSize::kTypeStandard),
orientation_(AdSize::kOrientationCurrent) {}
type_(AdSize::kTypeStandard) {}

AdSize AdSize::GetAnchoredAdaptiveBannerAdSize(uint32_t width,
Orientation orientation) {
Expand Down
2 changes: 1 addition & 1 deletion gma/src/common/gma_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class GmaInternal {

// Update the AdViewInternal's AdSize width and height after it has been
// loaded as AdViews with adaptive AdSizes may have varying dimensions.
// This is done through the GmaInternal since its a friend of AdViewInternal.
// This is done through the GmaInternal since it's a friend of AdViewInternal.
static void UpdateAdViewInternalAdSizeDimensions(
internal::AdViewInternal* ad_view_internal, int width, int height);
};
Expand Down
3 changes: 0 additions & 3 deletions gma/src/common/interstitial_ad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
namespace firebase {
namespace gma {

const char kUninitializedError[] =
"Initialize() must be called before this method.";

InterstitialAd::InterstitialAd() {
FIREBASE_ASSERT(gma::IsInitialized());
internal_ = internal::InterstitialAdInternal::CreateInstance(this);
Expand Down
3 changes: 0 additions & 3 deletions gma/src/common/rewarded_ad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
namespace firebase {
namespace gma {

const char kUninitializedError[] =
"Initialize() must be called before this method.";

RewardedAd::RewardedAd() {
FIREBASE_ASSERT(gma::IsInitialized());
internal_ = internal::RewardedAdInternal::CreateInstance(this);
Expand Down
2 changes: 1 addition & 1 deletion gma/src/include/firebase/gma/ad_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class AdView {
/// (x, y). Coordinates are in pixels from the top-left corner of the screen.
///
/// When built for Android, the library will not display an ad on top of or
/// beneath an <code>Activity</code>'s status bar. If a call to SetPostion
/// beneath an <code>Activity</code>'s status bar. If a call to SetPosition
/// would result in an overlap, the @ref AdView is placed just below the
/// status bar, so no overlap occurs.
/// @param[in] x The desired horizontal coordinate.
Expand Down
8 changes: 4 additions & 4 deletions gma/src/include/firebase/gma/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ class AdSize {

/// Comparison operator.
///
/// @returns true if `rhs` refers to a different AdSize as `this`.
/// @return true if `rhs` refers to a different AdSize as `this`.
bool operator!=(const AdSize& rhs) const;

/// The width of the region represented by this AdSize. Value is in
Expand All @@ -596,7 +596,7 @@ class AdSize {
private:
friend class firebase::gma::internal::AdViewInternal;

/// Returns an Anchor Adpative AdSize Object given a width and orientation.
/// Returns an Anchor Adaptive AdSize Object given a width and orientation.
static AdSize GetAnchoredAdaptiveBannerAdSize(uint32_t width,
Orientation orientation);

Expand Down Expand Up @@ -709,7 +709,7 @@ class AdReward {
public:
/// Creates an @ref AdReward.
AdReward(const std::string& type, int64_t amount)
: type_(type), amount_(amount) {}
: amount_(amount), type_(type) {}

/// Returns the reward amount.
int64_t amount() const { return amount_; }
Expand All @@ -728,7 +728,7 @@ class AdValue {
/// Allowed constants for @ref precision_type().
enum PrecisionType {
/// An ad value with unknown precision.
kdValuePrecisionUnknown = 0,
kAdValuePrecisionUnknown = 0,
/// An ad value estimated from aggregated data.
kAdValuePrecisionEstimated,
/// A publisher-provided ad value, such as manual CPMs in a mediation group.
Expand Down
2 changes: 1 addition & 1 deletion gma/src/ios/FADAdSize.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
namespace firebase {
namespace gma {

/// Returns a GADAdSize from an gma::AdSize.
/// Returns a GADAdSize from a gma::AdSize.
GADAdSize GADSizeFromCppAdSize(const AdSize& ad_size);

} // namespace gma
Expand Down
13 changes: 7 additions & 6 deletions gma/src/ios/FADAdSize.mm
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ GADAdSize GADSizeFromCppAdSize(const AdSize& ad_size) {
case AdSize::kOrientationCurrent:
return GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(ad_size.width());
default:
FIREBASE_ASSERT_MESSAGE(true, "Uknown AdSize Orientation");
FIREBASE_ASSERT_MESSAGE(true, "Unknown AdSize Orientation");
}
break;
case AdSize::kTypeInlineAdaptive:
if(ad_size.height() != 0) {
return GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(ad_size.width(), ad_size.height());
if (ad_size.height() != 0) {
return GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(ad_size.width(),
ad_size.height());
}
switch (ad_size.orientation()) {
case AdSize::kOrientationLandscape:
Expand All @@ -47,14 +48,14 @@ GADAdSize GADSizeFromCppAdSize(const AdSize& ad_size) {
case AdSize::kOrientationCurrent:
return GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth(ad_size.width());
default:
FIREBASE_ASSERT_MESSAGE(true, "Uknown AdSize Orientation");
FIREBASE_ASSERT_MESSAGE(true, "Unknown AdSize Orientation");
}
break;
break;
case AdSize::kTypeStandard:
return GADAdSizeFromCGSize(CGSizeMake(ad_size.width(), ad_size.height()));
break;
default:
FIREBASE_ASSERT_MESSAGE(true, "Uknown AdSize Type");
FIREBASE_ASSERT_MESSAGE(true, "Unknown AdSize Type");
}
}

Expand Down
5 changes: 2 additions & 3 deletions gma/src/ios/FADAdView.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithView:(UIView *)view
adUnitID:(NSString *)adUnitID
adSize:(firebase::gma::AdSize)adSize
internalAdView:(firebase::gma::internal::AdViewInternalIOS *)cppAdView // NOLINT
internalAdView:(firebase::gma::internal::AdViewInternalIOS *)cppAdView // NOLINT
NS_DESIGNATED_INITIALIZER;

/// Requests a banner ad.
Expand All @@ -59,8 +59,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)moveAdViewToXCoordinate:(int)x yCoordinate:(int)y;

/// Moves the banner view to a AdView::Position.
- (void)moveAdViewToPosition:(firebase::gma::AdView::Position)position; // NOLINT

- (void)moveAdViewToPosition:(firebase::gma::AdView::Position)position; // NOLINT

@end

Expand Down
Loading

0 comments on commit 7b3757d

Please sign in to comment.