From 7233c83874e6444a96045bffe511c87bf866361f Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Sun, 13 Mar 2016 20:18:03 -0700 Subject: [PATCH] Linting --- atom/common/api/atom_api_native_image.cc | 19 +++++++++++-------- atom/common/api/atom_api_native_image.h | 4 +++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/atom/common/api/atom_api_native_image.cc b/atom/common/api/atom_api_native_image.cc index aac11fdfaa..7a84f99994 100644 --- a/atom/common/api/atom_api_native_image.cc +++ b/atom/common/api/atom_api_native_image.cc @@ -198,7 +198,8 @@ mate::ObjectTemplateBuilder NativeImage::GetObjectTemplateBuilder( template_.Reset(isolate, mate::ObjectTemplateBuilder(isolate) .SetMethod("toPng", &NativeImage::ToPNG) .SetMethod("toJpeg", &NativeImage::ToJPEG) - .SetMethod("asNativeRepresentation", &NativeImage::AsNativeRepresentation) + .SetMethod("asNativeRepresentation", + &NativeImage::AsNativeRepresentation) .SetMethod("toDataURL", &NativeImage::ToDataURL) .SetMethod("toDataUrl", &NativeImage::ToDataURL) // deprecated. .SetMethod("isEmpty", &NativeImage::IsEmpty) @@ -236,28 +237,30 @@ std::string NativeImage::ToDataURL() { return data_url; } -v8::Local NativeImage::AsNativeRepresentation(v8::Isolate* isolate, mate::Arguments* args) { +v8::Local NativeImage::AsNativeRepresentation( + v8::Isolate* isolate, + mate::Arguments* args) { NativeRepresentation desiredRep = NativeRepresentation::INVALID; void* ptr = nullptr; std::string type; - + if (!args->GetNext(&type)) { args->ThrowError(); goto out; } - + for (const NativeRepresentationPair& item : kNativeRepresentations) { if (type.compare(item.name) == 0) { desiredRep = item.rep; break; } } - + if (desiredRep == NativeRepresentation::INVALID) { args->ThrowError(); goto out; } - + switch (desiredRep) { #if defined(OS_MACOSX) case NativeRepresentation::AS_NSIMAGE: @@ -268,9 +271,9 @@ v8::Local NativeImage::AsNativeRepresentation(v8::Isolate* isolate, m args->ThrowError(); break; } - + out: - + return node::Buffer::Copy( isolate, reinterpret_cast(ptr), diff --git a/atom/common/api/atom_api_native_image.h b/atom/common/api/atom_api_native_image.h index 8bc2130404..8b1329d284 100644 --- a/atom/common/api/atom_api_native_image.h +++ b/atom/common/api/atom_api_native_image.h @@ -61,7 +61,9 @@ class NativeImage : public mate::Wrappable { private: v8::Local ToPNG(v8::Isolate* isolate); v8::Local ToJPEG(v8::Isolate* isolate, int quality); - v8::Local AsNativeRepresentation(v8::Isolate* isolate, mate::Arguments* args); + v8::Local AsNativeRepresentation( + v8::Isolate* isolate, + mate::Arguments* args); std::string ToDataURL(); bool IsEmpty(); gfx::Size GetSize();