Skip to content

Commit

Permalink
Fixed linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
giovannicalo committed Aug 2, 2021
1 parent c055c5d commit fc3f985
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions source/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface Image {
* Decodes a WebP image.
*
* @param {Buffer} data - A WebP-encoded buffer.
* @param {Format} format - The desired output format, either RGBA or YUV I420, defaults to RGBA.
* @param {Format} [format=Format.rgba] - The desired output format, either RGBA or YUV I420, defaults to RGBA.
* @returns {Promise<Image>} A promise resolving to the decoded image.
*/
export function decode(data: Buffer, format = Format.rgba): Promise<Image>
Expand All @@ -20,7 +20,7 @@ export function decode(data: Buffer, format = Format.rgba): Promise<Image>
* Encodes a raw image as WebP.
*
* @param {Image} image - An image.
* @param {Number} quality - The desired output quality, between 0 and 100, defaults to 90.
* @param {Number} [quality=90] - The desired output quality, between 0 and 100, defaults to 90.
* @returns {Promise<Buffer>} A promise resolving to the encoded buffer.
*/
export function encode(image: Image, quality = 90): Promise<Buffer>
2 changes: 1 addition & 1 deletion source/native/decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace nodeWebp {
).ThrowAsJavaScriptException();
return info.Env().Null();
}
Decoder* decoder = new Decoder(
auto decoder = new Decoder(
info.Env(),
info[0].As<Napi::Uint8Array>(),
info.Length() >= 2 ? static_cast<Format>(
Expand Down
4 changes: 1 addition & 3 deletions source/native/decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace nodeWebp {
source(source)
{}

Decoder::~Decoder() {}

void Decoder::Execute() {
int32_t height = 0;
int32_t width = 0;
Expand Down Expand Up @@ -85,7 +83,7 @@ namespace nodeWebp {
Env(),
image->data,
image->size,
[](Napi::Env environment, void* data, void* image) {
[](Napi::Env, void*, void* image) {
delete static_cast<Image*>(image);
},
image
Expand Down
8 changes: 4 additions & 4 deletions source/native/decoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ namespace nodeWebp {
Format format
);

~Decoder();
~Decoder() override = default;

void Execute();
void Execute() override;

void OnError(const Napi::Error& error);
void OnError(const Napi::Error& error) override;

void OnOK();
void OnOK() override;

Napi::Promise getPromise();

Expand Down
2 changes: 1 addition & 1 deletion source/native/encode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace nodeWebp {
).ThrowAsJavaScriptException();
return info.Env().Null();
}
Encoder* encoder = new Encoder(
auto encoder = new Encoder(
info.Env(),
info[0].As<Napi::Object>(),
info.Length() >= 2 ? info[1].As<Napi::Number>().FloatValue() : 90
Expand Down
4 changes: 2 additions & 2 deletions source/native/encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace nodeWebp {
promise(Napi::Promise::Deferred::New(environment)),
quality(quality)
{
Napi::Uint8Array data = source.Get("data").As<Napi::Uint8Array>();
auto data = source.Get("data").As<Napi::Uint8Array>();
image = new Image(
static_cast<Format>(source.Get("format").As<Napi::Number>().Int32Value()),
source.Get("width").As<Napi::Number>().Uint32Value(),
Expand Down Expand Up @@ -55,7 +55,7 @@ namespace nodeWebp {
Env(),
buffer,
size,
[](Napi::Env environment, void* data) {
[](Napi::Env, void* data) {
WebPFree(data);
}
));
Expand Down
8 changes: 4 additions & 4 deletions source/native/encoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ namespace nodeWebp {
float_t quality
);

~Encoder();
~Encoder() override;

void Execute();
void Execute() override;

void OnError(const Napi::Error& error);
void OnError(const Napi::Error& error) override;

void OnOK();
void OnOK() override;

Napi::Promise getPromise();

Expand Down
2 changes: 1 addition & 1 deletion source/native/image.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <stdint.h>
#include <cstdint>

#include "format.hpp"

Expand Down
1 change: 1 addition & 0 deletions source/native/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "./decode.hpp"
#include "./encode.hpp"
#include "./format.hpp"

Napi::Object initialize(Napi::Env environment, Napi::Object exports) {
exports.Set(
Expand Down

0 comments on commit fc3f985

Please sign in to comment.