Skip to content

Commit

Permalink
Reverting linter changes to files outside of the github folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Olga Zinoveva committed Feb 22, 2023
1 parent dcd6991 commit 4f4eac0
Show file tree
Hide file tree
Showing 46 changed files with 844 additions and 980 deletions.
3 changes: 1 addition & 2 deletions Libraries/PushNotificationIOS/RCTPushNotificationPlugins.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

#ifdef RN_DISABLE_OSS_PLUGIN_HEADER

// FB Internal: FBRCTPushNotificationPlugins.h is autogenerated by the build
// system.
// FB Internal: FBRCTPushNotificationPlugins.h is autogenerated by the build system.
#import <React/FBRCTPushNotificationPlugins.h>

#else
Expand Down
2 changes: 1 addition & 1 deletion Libraries/TypeSafety/RCTConvertHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace react {
template <typename T>
using LazyVector = FB::LazyVector<T, id>;
}
} // namespace facebook
}

template <typename ContainerT>
NSArray *RCTConvertVecToArray(const ContainerT &vec, id (^convertor)(typename ContainerT::value_type element))
Expand Down
4 changes: 2 additions & 2 deletions Libraries/TypeSafety/RCTTypedModuleConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ ModuleConstants<T> typedConstants(typename T::Builder::Input &&value)
return [_RCTTypedModuleConstants newWithUnsafeDictionary:builder.buildUnsafeRawValue()];
}

} // namespace react
} // namespace facebook
}
}
4 changes: 2 additions & 2 deletions React/Base/RCTManagedPointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RCTManagedPointer *managedPointer(P initializer)
return [[RCTManagedPointer alloc] initWithPointer:std::move(ptr)];
}

} // namespace react
} // namespace facebook
}
}

#endif
4 changes: 2 additions & 2 deletions React/CxxBridge/NSDataBigString.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ class NSDataBigString : public JSBigString {
size_t m_length;
};

} // namespace react
} // namespace facebook
}
}
2 changes: 1 addition & 1 deletion React/CxxBridge/RCTCxxBridgeDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace react {
class JSExecutorFactory;

}
} // namespace facebook
}

// This is a separate class so non-C++ implementations don't need to
// take a C++ dependency.
Expand Down
4 changes: 2 additions & 2 deletions React/CxxModule/DispatchMessageQueueThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ class DispatchMessageQueueThread : public MessageQueueThread {
RCTModuleData *moduleData_;
};

} // namespace react
} // namespace facebook
}
}
4 changes: 2 additions & 2 deletions React/CxxModule/RCTCxxModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ namespace xplat {
namespace module {
class CxxModule;
}
} // namespace xplat
} // namespace facebook
}
}

/**
* Subclass RCTCxxModule to use cross-platform CxxModule on iOS.
Expand Down
4 changes: 2 additions & 2 deletions React/CxxModule/RCTCxxUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ createNativeModules(NSArray<RCTModuleData *> *modules, RCTBridge *bridge, const
NSError *tryAndReturnError(const std::function<void()> &func);
NSString *deriveSourceURL(NSURL *url);

} // namespace react
} // namespace facebook
}
}
15 changes: 5 additions & 10 deletions React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

#ifdef RN_DISABLE_OSS_PLUGIN_HEADER

// FB Internal: FBRCTFabricComponentsPlugins.h is autogenerated by the build
// system.
// FB Internal: FBRCTFabricComponentsPlugins.h is autogenerated by the build system.
#import <React/FBRCTFabricComponentsPlugins.h>

#else
Expand All @@ -33,17 +32,13 @@ Class<RCTComponentViewProtocol> RCTFabricComponentsProvider(const char *name);
// Lookup functions
Class<RCTComponentViewProtocol> RCTSafeAreaViewCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTScrollViewCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTPullToRefreshViewCls(void)
__attribute__((used));
Class<RCTComponentViewProtocol> RCTActivityIndicatorViewCls(void)
__attribute__((used));
Class<RCTComponentViewProtocol> RCTPullToRefreshViewCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTActivityIndicatorViewCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTSwitchCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTUnimplementedNativeViewCls(void)
__attribute__((used));
Class<RCTComponentViewProtocol> RCTUnimplementedNativeViewCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTParagraphCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTTextInputCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTInputAccessoryCls(void)
__attribute__((used));
Class<RCTComponentViewProtocol> RCTInputAccessoryCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTViewCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTImageCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTModalHostViewCls(void) __attribute__((used));
Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/src/main/jni/first-party/fb/include/fb/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ int __android_log_print(int prio, const char *tag, const char *fmt, ...)
* Stripped out of release builds. Uses the current LOG_TAG.
*/
#define FBLOG_ASSERT(cond, ...) FBLOG_FATAL_IF(!(cond), __VA_ARGS__)
// #define LOG_ASSERT(cond) LOG_FATAL_IF(!(cond), "Assertion failed: " #cond)
//#define LOG_ASSERT(cond) LOG_FATAL_IF(!(cond), "Assertion failed: " #cond)

// ---------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ScopedGlobalRef {
std::is_same<T, jbooleanArray>(),
"ScopedGlobalRef instantiated for invalid type");

public:
public:
/**
* Constructs a ScopedGlobalRef with a JNI global reference.
*
Expand All @@ -74,19 +74,17 @@ class ScopedGlobalRef {
/**
* Move construction is allowed.
*/
ScopedGlobalRef(ScopedGlobalRef &&s) : mGlobalRef(s.release()) {}
ScopedGlobalRef(ScopedGlobalRef&& s) : mGlobalRef(s.release()) {}

/**
* Move assignment is allowed.
*/
ScopedGlobalRef &operator=(ScopedGlobalRef &&s) {
ScopedGlobalRef& operator=(ScopedGlobalRef&& s) {
reset(s.release());
return *this;
}

~ScopedGlobalRef() {
reset();
}
~ScopedGlobalRef() { reset(); }

/**
* Deletes the currently held reference and reassigns a new one to the
Expand Down Expand Up @@ -115,21 +113,17 @@ class ScopedGlobalRef {
/**
* Returns the underlying JNI global reference.
*/
T get() const {
return mGlobalRef;
}
T get() const { return mGlobalRef; }

/**
* Returns true if the underlying JNI reference is not NULL.
*/
operator bool() const {
return mGlobalRef != NULL;
}
operator bool() const { return mGlobalRef != NULL; }

ScopedGlobalRef(const ScopedGlobalRef &ref) = delete;
ScopedGlobalRef &operator=(const ScopedGlobalRef &other) = delete;
ScopedGlobalRef(const ScopedGlobalRef& ref) = delete;
ScopedGlobalRef& operator=(const ScopedGlobalRef& other) = delete;

private:
private:
T mGlobalRef;
};

Expand Down
32 changes: 13 additions & 19 deletions ReactAndroid/src/main/jni/first-party/yogajni/jni/ScopedLocalRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,36 +56,34 @@ class ScopedLocalRef {
std::is_same<T, jbooleanArray>(),
"ScopedLocalRef instantiated for invalid type");

public:
public:
/**
* Constructs a ScopedLocalRef with a JNI local reference.
*
* @param localRef the local reference to wrap. Can be NULL.
*/
ScopedLocalRef(JNIEnv *env, T localRef) : mEnv(env), mLocalRef(localRef) {}
ScopedLocalRef(JNIEnv* env, T localRef) : mEnv(env), mLocalRef(localRef) {}

/**
* Equivalent to ScopedLocalRef(env, NULL)
*/
explicit ScopedLocalRef(JNIEnv *env) : mEnv(env), mLocalRef(NULL) {}
explicit ScopedLocalRef(JNIEnv* env) : mEnv(env), mLocalRef(NULL) {}

/**
* Move construction is allowed.
*/
ScopedLocalRef(ScopedLocalRef &&s) : mEnv(s.mEnv), mLocalRef(s.release()) {}
ScopedLocalRef(ScopedLocalRef&& s) : mEnv(s.mEnv), mLocalRef(s.release()) {}

/**
* Move assignment is allowed.
*/
ScopedLocalRef &operator=(ScopedLocalRef &&s) {
ScopedLocalRef& operator=(ScopedLocalRef&& s) {
reset(s.release());
mEnv = s.mEnv;
return *this;
}

~ScopedLocalRef() {
reset();
}
~ScopedLocalRef() { reset(); }

/**
* Deletes the currently held reference and reassigns a new one to the
Expand Down Expand Up @@ -114,27 +112,23 @@ class ScopedLocalRef {
/**
* Returns the underlying JNI local reference.
*/
T get() const {
return mLocalRef;
}
T get() const { return mLocalRef; }

/**
* Returns true if the underlying JNI reference is not NULL.
*/
operator bool() const {
return mLocalRef != NULL;
}
operator bool() const { return mLocalRef != NULL; }

ScopedLocalRef(const ScopedLocalRef &ref) = delete;
ScopedLocalRef &operator=(const ScopedLocalRef &other) = delete;
ScopedLocalRef(const ScopedLocalRef& ref) = delete;
ScopedLocalRef& operator=(const ScopedLocalRef& other) = delete;

private:
JNIEnv *mEnv;
private:
JNIEnv* mEnv;
T mLocalRef;
};

template <typename T>
ScopedLocalRef<T> make_local_ref(JNIEnv *env, T localRef) {
ScopedLocalRef<T> make_local_ref(JNIEnv* env, T localRef) {
return ScopedLocalRef<T>(env, localRef);
}

Expand Down
20 changes: 8 additions & 12 deletions ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ const int HAS_NEW_LAYOUT = 16;

union YGNodeContext {
uintptr_t edgesSet = 0;
void *asVoidPtr;
void* asVoidPtr;
};

class YGNodeEdges {
uintptr_t edges_;

public:
public:
enum Edge {
MARGIN = 1,
PADDING = 2,
Expand All @@ -46,30 +46,26 @@ class YGNodeEdges {
node->setContext(context.asVoidPtr);
}

bool has(Edge edge) {
return (edges_ & edge) == edge;
}
bool has(Edge edge) { return (edges_ & edge) == edge; }

YGNodeEdges &add(Edge edge) {
YGNodeEdges& add(Edge edge) {
edges_ |= edge;
return *this;
}

int get() {
return edges_;
}
int get() { return edges_; }
};

struct YogaValue {
static constexpr jint NAN_BYTES = 0x7fc00000;

static jlong asJavaLong(const YGValue &value) {
static jlong asJavaLong(const YGValue& value) {
uint32_t valueBytes = 0;
memcpy(&valueBytes, &value.value, sizeof valueBytes);
return ((jlong)value.unit) << 32 | valueBytes;
return ((jlong) value.unit) << 32 | valueBytes;
}
constexpr static jlong undefinedAsJavaLong() {
return ((jlong)YGUnitUndefined) << 32 | NAN_BYTES;
return ((jlong) YGUnitUndefined) << 32 | NAN_BYTES;
}
};
} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
#include "jni.h"

namespace YGJNIVanilla {
void registerNatives(JNIEnv *env);
void registerNatives(JNIEnv* env);
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@
* LICENSE file in the root directory of this source tree.
*/

#include "jni.h"
#include <yoga/YGValue.h>
#include <yoga/Yoga.h>
#include <map>
#include "common.h"
#include "jni.h"

class PtrJNodeMapVanilla {
std::map<YGNodeRef, size_t> ptrsToIdxs_;
jobjectArray javaNodes_;

public:
public:
PtrJNodeMapVanilla() : ptrsToIdxs_{}, javaNodes_{} {}
PtrJNodeMapVanilla(jlongArray javaNativePointers, jobjectArray javaNodes)
: javaNodes_{javaNodes} {
using namespace facebook::yoga::vanillajni;

JNIEnv *env = getCurrentEnv();
JNIEnv* env = getCurrentEnv();
size_t nativePointersSize = env->GetArrayLength(javaNativePointers);
std::vector<jlong> nativePointers(nativePointersSize);
env->GetLongArrayRegion(
javaNativePointers, 0, nativePointersSize, nativePointers.data());

for (size_t i = 0; i < nativePointersSize; ++i) {
ptrsToIdxs_[(YGNodeRef)nativePointers[i]] = i;
ptrsToIdxs_[(YGNodeRef) nativePointers[i]] = i;
}
}

facebook::yoga::vanillajni::ScopedLocalRef<jobject> ref(YGNodeRef node) {
using namespace facebook::yoga::vanillajni;

JNIEnv *env = getCurrentEnv();
JNIEnv* env = getCurrentEnv();
auto idx = ptrsToIdxs_.find(node);
if (idx == ptrsToIdxs_.end()) {
return ScopedLocalRef<jobject>(env);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ namespace vanillajni {
* does not gets cleared before jni call completion
*/
class YogaJniException : public std::exception {
public:
public:
YogaJniException();
~YogaJniException() override;

explicit YogaJniException(jthrowable throwable);

YogaJniException(YogaJniException &&rhs);
YogaJniException(YogaJniException&& rhs);

YogaJniException(const YogaJniException &other);
YogaJniException(const YogaJniException& other);

ScopedLocalRef<jthrowable> getThrowable() const noexcept;

private:
private:
ScopedGlobalRef<jthrowable> throwable_;
};
} // namespace vanillajni
Expand Down
Loading

0 comments on commit 4f4eac0

Please sign in to comment.