diff --git a/java/jni/YGJTypesVanilla.h b/java/jni/YGJTypesVanilla.h index 5cf40682..1b4d62df 100644 --- a/java/jni/YGJTypesVanilla.h +++ b/java/jni/YGJTypesVanilla.h @@ -11,9 +11,6 @@ #include #include "common.h" -using namespace facebook::yoga::vanillajni; -using namespace std; - class PtrJNodeMapVanilla { std::map ptrsToIdxs_; jobjectArray javaNodes_; @@ -22,6 +19,7 @@ public: PtrJNodeMapVanilla() : ptrsToIdxs_{}, javaNodes_{} {} PtrJNodeMapVanilla(jlongArray javaNativePointers, jobjectArray javaNodes) : javaNodes_{javaNodes} { + using namespace facebook::yoga::vanillajni; JNIEnv* env = getCurrentEnv(); size_t nativePointersSize = env->GetArrayLength(javaNativePointers); @@ -34,7 +32,9 @@ public: } } - ScopedLocalRef ref(YGNodeRef node) { + facebook::yoga::vanillajni::ScopedLocalRef ref(YGNodeRef node) { + using namespace facebook::yoga::vanillajni; + JNIEnv* env = getCurrentEnv(); auto idx = ptrsToIdxs_.find(node); if (idx == ptrsToIdxs_.end()) { diff --git a/yoga/Utils.cpp b/yoga/Utils.cpp index e448d994..7cc94022 100644 --- a/yoga/Utils.cpp +++ b/yoga/Utils.cpp @@ -74,7 +74,7 @@ YGFloatOptional YGFloatOptionalMax(YGFloatOptional op1, YGFloatOptional op2) { return op1.isUndefined() ? op2 : op1; } -void throwLogicalErrorWithMessage(const char* message) { +void yoga::throwLogicalErrorWithMessage(const char* message) { #if defined(__cpp_exceptions) throw std::logic_error(message); #else // !defined(__cpp_exceptions) diff --git a/yoga/Utils.h b/yoga/Utils.h index 8588ecc5..52a0954b 100644 --- a/yoga/Utils.h +++ b/yoga/Utils.h @@ -117,7 +117,7 @@ inline YGFloatOptional YGResolveValue( } inline YGFloatOptional YGResolveValue( - yoga::detail::CompactValue value, + facebook::yoga::detail::CompactValue value, float ownerSize) { return YGResolveValue((YGValue) value, ownerSize); } @@ -142,11 +142,9 @@ inline YGFlexDirection YGResolveFlexDirection( } inline YGFloatOptional YGResolveValueMargin( - yoga::detail::CompactValue value, + facebook::yoga::detail::CompactValue value, const float ownerSize) { return value.isAuto() ? YGFloatOptional{0} : YGResolveValue(value, ownerSize); } -void throwLogicalErrorWithMessage(const char* message); - #endif diff --git a/yoga/YGLayout.h b/yoga/YGLayout.h index e3a4a194..ce612040 100644 --- a/yoga/YGLayout.h +++ b/yoga/YGLayout.h @@ -13,8 +13,6 @@ #include "YGFloatOptional.h" #include "Yoga-internal.h" -using namespace facebook::yoga; - struct YGLayout { std::array position = {}; std::array dimensions = {{YGUndefined, YGUndefined}}; diff --git a/yoga/Yoga-internal.h b/yoga/Yoga-internal.h index 492543ef..4e0efa60 100644 --- a/yoga/Yoga-internal.h +++ b/yoga/Yoga-internal.h @@ -40,11 +40,11 @@ inline bool isUndefined(double value) { return std::isnan(value); } +void throwLogicalErrorWithMessage(const char* message); + } // namespace yoga } // namespace facebook -using namespace facebook; - extern const std::array trailing; extern const std::array leading; extern const YGValue YGValueUndefined; @@ -69,6 +69,8 @@ struct YGCachedMeasurement { computedHeight(-1) {} bool operator==(YGCachedMeasurement measurement) const { + using namespace facebook; + bool isEqual = widthMeasureMode == measurement.widthMeasureMode && heightMeasureMode == measurement.heightMeasureMode; @@ -141,7 +143,6 @@ public: Values& operator=(const Values& other) = default; }; - } // namespace detail } // namespace yoga } // namespace facebook