sharp 0.31.3 → 0.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/utilities.cc CHANGED
@@ -1,16 +1,5 @@
1
- // Copyright 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Lovell Fuller and contributors.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
1
+ // Copyright 2013 Lovell Fuller and others.
2
+ // SPDX-License-Identifier: Apache-2.0
14
3
 
15
4
  #include <cmath>
16
5
  #include <string>
@@ -30,16 +19,16 @@ Napi::Value cache(const Napi::CallbackInfo& info) {
30
19
  Napi::Env env = info.Env();
31
20
 
32
21
  // Set memory limit
33
- if (info[0].IsNumber()) {
34
- vips_cache_set_max_mem(info[0].As<Napi::Number>().Int32Value() * 1048576);
22
+ if (info[size_t(0)].IsNumber()) {
23
+ vips_cache_set_max_mem(info[size_t(0)].As<Napi::Number>().Int32Value() * 1048576);
35
24
  }
36
25
  // Set file limit
37
- if (info[1].IsNumber()) {
38
- vips_cache_set_max_files(info[1].As<Napi::Number>().Int32Value());
26
+ if (info[size_t(1)].IsNumber()) {
27
+ vips_cache_set_max_files(info[size_t(1)].As<Napi::Number>().Int32Value());
39
28
  }
40
29
  // Set items limit
41
- if (info[2].IsNumber()) {
42
- vips_cache_set_max(info[2].As<Napi::Number>().Int32Value());
30
+ if (info[size_t(2)].IsNumber()) {
31
+ vips_cache_set_max(info[size_t(2)].As<Napi::Number>().Int32Value());
43
32
  }
44
33
 
45
34
  // Get memory stats
@@ -69,8 +58,8 @@ Napi::Value cache(const Napi::CallbackInfo& info) {
69
58
  */
70
59
  Napi::Value concurrency(const Napi::CallbackInfo& info) {
71
60
  // Set concurrency
72
- if (info[0].IsNumber()) {
73
- vips_concurrency_set(info[0].As<Napi::Number>().Int32Value());
61
+ if (info[size_t(0)].IsNumber()) {
62
+ vips_concurrency_set(info[size_t(0)].As<Napi::Number>().Int32Value());
74
63
  }
75
64
  // Get concurrency
76
65
  return Napi::Number::New(info.Env(), vips_concurrency_get());
@@ -91,8 +80,8 @@ Napi::Value counters(const Napi::CallbackInfo& info) {
91
80
  */
92
81
  Napi::Value simd(const Napi::CallbackInfo& info) {
93
82
  // Set state
94
- if (info[0].IsBoolean()) {
95
- vips_vector_set_enabled(info[0].As<Napi::Boolean>().Value());
83
+ if (info[size_t(0)].IsBoolean()) {
84
+ vips_vector_set_enabled(info[size_t(0)].As<Napi::Boolean>().Value());
96
85
  }
97
86
  // Get state
98
87
  return Napi::Boolean::New(info.Env(), vips_vector_isenabled());
@@ -185,10 +174,10 @@ Napi::Value _maxColourDistance(const Napi::CallbackInfo& info) {
185
174
 
186
175
  // Open input files
187
176
  VImage image1;
188
- sharp::ImageType imageType1 = sharp::DetermineImageType(info[0].As<Napi::String>().Utf8Value().data());
177
+ sharp::ImageType imageType1 = sharp::DetermineImageType(info[size_t(0)].As<Napi::String>().Utf8Value().data());
189
178
  if (imageType1 != sharp::ImageType::UNKNOWN) {
190
179
  try {
191
- image1 = VImage::new_from_file(info[0].As<Napi::String>().Utf8Value().c_str());
180
+ image1 = VImage::new_from_file(info[size_t(0)].As<Napi::String>().Utf8Value().c_str());
192
181
  } catch (...) {
193
182
  throw Napi::Error::New(env, "Input file 1 has corrupt header");
194
183
  }
@@ -196,10 +185,10 @@ Napi::Value _maxColourDistance(const Napi::CallbackInfo& info) {
196
185
  throw Napi::Error::New(env, "Input file 1 is of an unsupported image format");
197
186
  }
198
187
  VImage image2;
199
- sharp::ImageType imageType2 = sharp::DetermineImageType(info[1].As<Napi::String>().Utf8Value().data());
188
+ sharp::ImageType imageType2 = sharp::DetermineImageType(info[size_t(1)].As<Napi::String>().Utf8Value().data());
200
189
  if (imageType2 != sharp::ImageType::UNKNOWN) {
201
190
  try {
202
- image2 = VImage::new_from_file(info[1].As<Napi::String>().Utf8Value().c_str());
191
+ image2 = VImage::new_from_file(info[size_t(1)].As<Napi::String>().Utf8Value().c_str());
203
192
  } catch (...) {
204
193
  throw Napi::Error::New(env, "Input file 2 has corrupt header");
205
194
  }
package/src/utilities.h CHANGED
@@ -1,16 +1,5 @@
1
- // Copyright 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Lovell Fuller and contributors.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
1
+ // Copyright 2013 Lovell Fuller and others.
2
+ // SPDX-License-Identifier: Apache-2.0
14
3
 
15
4
  #ifndef SRC_UTILITIES_H_
16
5
  #define SRC_UTILITIES_H_