Remove stray win32 library that was causing segfaults

Explicit int cast to prevent 'loss of precision' warnings

Remove unnecessary semver checking from I/O tests
This commit is contained in:
Lovell Fuller 2015-11-21 22:18:39 +00:00
parent 05dd191e17
commit 0ae619dfc5
4 changed files with 134 additions and 133 deletions

View File

@ -165,7 +165,6 @@
'<(module_root_dir)/lib/libgmodule-2.0-0.dll', '<(module_root_dir)/lib/libgmodule-2.0-0.dll',
'<(module_root_dir)/lib/libgobject-2.0-0.dll', '<(module_root_dir)/lib/libgobject-2.0-0.dll',
'<(module_root_dir)/lib/libgsf-1-114.dll', '<(module_root_dir)/lib/libgsf-1-114.dll',
'<(module_root_dir)/lib/libgsf-win32-1-114.dll',
'<(module_root_dir)/lib/libgthread-2.0-0.dll', '<(module_root_dir)/lib/libgthread-2.0-0.dll',
'<(module_root_dir)/lib/libintl-8.dll', '<(module_root_dir)/lib/libintl-8.dll',
'<(module_root_dir)/lib/libjpeg-62.dll', '<(module_root_dir)/lib/libjpeg-62.dll',

View File

@ -11,6 +11,6 @@ RUN unzip vips-dev-w64-8.1.1-2.zip
# Clean and zip # Clean and zip
WORKDIR /vips/vips-dev-8.1.1 WORKDIR /vips/vips-dev-8.1.1
RUN rm bin/libvipsCC-42.dll bin/libvips-cpp-42.dll RUN rm bin/libvipsCC-42.dll bin/libvips-cpp-42.dll bin/libgsf-win32-1-114.dll
RUN cp bin/*.dll lib/ RUN cp bin/*.dll lib/
RUN GZIP=-9 tar czf /libvips-8.1.1-win.tar.gz include lib/glib-2.0 lib/libvips.lib lib/libglib-2.0.lib lib/libgobject-2.0.lib lib/*.dll RUN GZIP=-9 tar czf /libvips-8.1.1-win.tar.gz include lib/glib-2.0 lib/libvips.lib lib/libglib-2.0.lib lib/libgobject-2.0.lib lib/*.dll

View File

@ -7,11 +7,12 @@
#include "operations.h" #include "operations.h"
#include "utilities.h" #include "utilities.h"
using v8::Local;
using v8::Object;
using v8::Number;
using v8::String;
using v8::Boolean; using v8::Boolean;
using v8::Integer;
using v8::Local;
using v8::Number;
using v8::Object;
using v8::String;
using Nan::HandleScope; using Nan::HandleScope;
using Nan::New; using Nan::New;
@ -38,10 +39,16 @@ NAN_METHOD(cache) {
// Get cache statistics // Get cache statistics
Local<Object> cache = New<Object>(); Local<Object> cache = New<Object>();
Set(cache, New("current").ToLocalChecked(), New<Number>(vips_tracked_get_mem() / 1048576)); Set(cache, New("current").ToLocalChecked(),
Set(cache, New("high").ToLocalChecked(), New<Number>(vips_tracked_get_mem_highwater() / 1048576)); New<Integer>(static_cast<int>(round(vips_tracked_get_mem() / 1048576)))
Set(cache, New("memory").ToLocalChecked(), New<Number>(vips_cache_get_max_mem() / 1048576)); );
Set(cache, New("items").ToLocalChecked(), New<Number>(vips_cache_get_max())); Set(cache, New("high").ToLocalChecked(),
New<Integer>(static_cast<int>(round(vips_tracked_get_mem_highwater() / 1048576)))
);
Set(cache, New("memory").ToLocalChecked(),
New<Integer>(static_cast<int>(round(vips_cache_get_max_mem() / 1048576)))
);
Set(cache, New("items").ToLocalChecked(), New<Integer>(vips_cache_get_max()));
info.GetReturnValue().Set(cache); info.GetReturnValue().Set(cache);
} }
@ -56,7 +63,7 @@ NAN_METHOD(concurrency) {
vips_concurrency_set(To<int32_t>(info[0]).FromJust()); vips_concurrency_set(To<int32_t>(info[0]).FromJust());
} }
// Get concurrency // Get concurrency
info.GetReturnValue().Set(New<Number>(vips_concurrency_get())); info.GetReturnValue().Set(New<Integer>(vips_concurrency_get()));
} }
/* /*
@ -68,8 +75,8 @@ NAN_METHOD(counters) {
HandleScope(); HandleScope();
Local<Object> counters = New<Object>(); Local<Object> counters = New<Object>();
Set(counters, New("queue").ToLocalChecked(), New<Number>(counterQueue)); Set(counters, New("queue").ToLocalChecked(), New<Integer>(counterQueue));
Set(counters, New("process").ToLocalChecked(), New<Number>(counterProcess)); Set(counters, New("process").ToLocalChecked(), New<Integer>(counterProcess));
info.GetReturnValue().Set(counters); info.GetReturnValue().Set(counters);
} }

View File

@ -3,8 +3,6 @@
var fs = require('fs'); var fs = require('fs');
var assert = require('assert'); var assert = require('assert');
var semver = require('semver');
var sharp = require('../../index'); var sharp = require('../../index');
var fixtures = require('../fixtures'); var fixtures = require('../fixtures');
@ -483,37 +481,34 @@ describe('Input/output', function() {
done(); done();
}); });
if (semver.gte(sharp.libvipsVersion(), '7.42.0')) { it('withoutAdaptiveFiltering generates smaller file', function(done) {
it('withoutAdaptiveFiltering generates smaller file [libvips ' + sharp.libvipsVersion() + '>=7.42.0]', function(done) { // First generate with adaptive filtering
// First generate with adaptive filtering sharp(fixtures.inputPng)
sharp(fixtures.inputPng) .resize(320, 240)
.resize(320, 240) .withoutAdaptiveFiltering(false)
.withoutAdaptiveFiltering(false) .toBuffer(function(err, adaptiveData, adaptiveInfo) {
.toBuffer(function(err, adaptiveData, adaptiveInfo) { if (err) throw err;
if (err) throw err; assert.strictEqual(true, adaptiveData.length > 0);
assert.strictEqual(true, adaptiveData.length > 0); assert.strictEqual(adaptiveData.length, adaptiveInfo.size);
assert.strictEqual(adaptiveData.length, adaptiveInfo.size); assert.strictEqual('png', adaptiveInfo.format);
assert.strictEqual('png', adaptiveInfo.format); assert.strictEqual(320, adaptiveInfo.width);
assert.strictEqual(320, adaptiveInfo.width); assert.strictEqual(240, adaptiveInfo.height);
assert.strictEqual(240, adaptiveInfo.height); // Then generate without
// Then generate without sharp(fixtures.inputPng)
sharp(fixtures.inputPng) .resize(320, 240)
.resize(320, 240) .withoutAdaptiveFiltering()
.withoutAdaptiveFiltering() .toBuffer(function(err, withoutAdaptiveData, withoutAdaptiveInfo) {
.toBuffer(function(err, withoutAdaptiveData, withoutAdaptiveInfo) { if (err) throw err;
if (err) throw err; assert.strictEqual(true, withoutAdaptiveData.length > 0);
assert.strictEqual(true, withoutAdaptiveData.length > 0); assert.strictEqual(withoutAdaptiveData.length, withoutAdaptiveInfo.size);
assert.strictEqual(withoutAdaptiveData.length, withoutAdaptiveInfo.size); assert.strictEqual('png', withoutAdaptiveInfo.format);
assert.strictEqual('png', withoutAdaptiveInfo.format); assert.strictEqual(320, withoutAdaptiveInfo.width);
assert.strictEqual(320, withoutAdaptiveInfo.width); assert.strictEqual(240, withoutAdaptiveInfo.height);
assert.strictEqual(240, withoutAdaptiveInfo.height); assert.strictEqual(true, withoutAdaptiveData.length < adaptiveData.length);
assert.strictEqual(true, withoutAdaptiveData.length < adaptiveData.length); done();
done(); });
}); });
}); });
});
}
}); });
it('Without chroma subsampling generates larger file', function(done) { it('Without chroma subsampling generates larger file', function(done) {
@ -545,93 +540,93 @@ describe('Input/output', function() {
}); });
}); });
if (semver.gte(sharp.libvipsVersion(), '8.0.0')) { it('Trellis quantisation', function(done) {
it('Trellis quantisation [libvips ' + sharp.libvipsVersion() + '>=8.0.0]', function(done) { // First generate without
// First generate without sharp(fixtures.inputJpg)
sharp(fixtures.inputJpg) .resize(320, 240)
.resize(320, 240) .trellisQuantisation(false)
.trellisQuantisation(false) .toBuffer(function(err, withoutData, withoutInfo) {
.toBuffer(function(err, withoutData, withoutInfo) { if (err) throw err;
if (err) throw err; assert.strictEqual(true, withoutData.length > 0);
assert.strictEqual(true, withoutData.length > 0); assert.strictEqual(withoutData.length, withoutInfo.size);
assert.strictEqual(withoutData.length, withoutInfo.size); assert.strictEqual('jpeg', withoutInfo.format);
assert.strictEqual('jpeg', withoutInfo.format); assert.strictEqual(320, withoutInfo.width);
assert.strictEqual(320, withoutInfo.width); assert.strictEqual(240, withoutInfo.height);
assert.strictEqual(240, withoutInfo.height); // Then generate with
// Then generate with sharp(fixtures.inputJpg)
sharp(fixtures.inputJpg) .resize(320, 240)
.resize(320, 240) .trellisQuantization()
.trellisQuantization() .toBuffer(function(err, withData, withInfo) {
.toBuffer(function(err, withData, withInfo) { if (err) throw err;
if (err) throw err; assert.strictEqual(true, withData.length > 0);
assert.strictEqual(true, withData.length > 0); assert.strictEqual(withData.length, withInfo.size);
assert.strictEqual(withData.length, withInfo.size); assert.strictEqual('jpeg', withInfo.format);
assert.strictEqual('jpeg', withInfo.format); assert.strictEqual(320, withInfo.width);
assert.strictEqual(320, withInfo.width); assert.strictEqual(240, withInfo.height);
assert.strictEqual(240, withInfo.height); // Verify image is same (as mozjpeg may not be present) size or less
// Verify image is same (as mozjpeg may not be present) size or less assert.strictEqual(true, withData.length <= withoutData.length);
assert.strictEqual(true, withData.length <= withoutData.length); done();
done(); });
}); });
}); });
});
it('Overshoot deringing [libvips ' + sharp.libvipsVersion() + '>=8.0.0]', function(done) { it('Overshoot deringing', function(done) {
// First generate without // First generate without
sharp(fixtures.inputJpg) sharp(fixtures.inputJpg)
.resize(320, 240) .resize(320, 240)
.overshootDeringing(false) .overshootDeringing(false)
.toBuffer(function(err, withoutData, withoutInfo) { .toBuffer(function(err, withoutData, withoutInfo) {
if (err) throw err; if (err) throw err;
assert.strictEqual(true, withoutData.length > 0); assert.strictEqual(true, withoutData.length > 0);
assert.strictEqual(withoutData.length, withoutInfo.size); assert.strictEqual(withoutData.length, withoutInfo.size);
assert.strictEqual('jpeg', withoutInfo.format); assert.strictEqual('jpeg', withoutInfo.format);
assert.strictEqual(320, withoutInfo.width); assert.strictEqual(320, withoutInfo.width);
assert.strictEqual(240, withoutInfo.height); assert.strictEqual(240, withoutInfo.height);
// Then generate with // Then generate with
sharp(fixtures.inputJpg) sharp(fixtures.inputJpg)
.resize(320, 240) .resize(320, 240)
.overshootDeringing() .overshootDeringing()
.toBuffer(function(err, withData, withInfo) { .toBuffer(function(err, withData, withInfo) {
if (err) throw err; if (err) throw err;
assert.strictEqual(true, withData.length > 0); assert.strictEqual(true, withData.length > 0);
assert.strictEqual(withData.length, withInfo.size); assert.strictEqual(withData.length, withInfo.size);
assert.strictEqual('jpeg', withInfo.format); assert.strictEqual('jpeg', withInfo.format);
assert.strictEqual(320, withInfo.width); assert.strictEqual(320, withInfo.width);
assert.strictEqual(240, withInfo.height); assert.strictEqual(240, withInfo.height);
done(); done();
}); });
}); });
}); });
it('Optimise scans [libvips ' + sharp.libvipsVersion() + '>=8.0.0]', function(done) {
// First generate without it('Optimise scans', function(done) {
sharp(fixtures.inputJpg) // First generate without
.resize(320, 240) sharp(fixtures.inputJpg)
.optimiseScans(false) .resize(320, 240)
.toBuffer(function(err, withoutData, withoutInfo) { .optimiseScans(false)
if (err) throw err; .toBuffer(function(err, withoutData, withoutInfo) {
assert.strictEqual(true, withoutData.length > 0); if (err) throw err;
assert.strictEqual(withoutData.length, withoutInfo.size); assert.strictEqual(true, withoutData.length > 0);
assert.strictEqual('jpeg', withoutInfo.format); assert.strictEqual(withoutData.length, withoutInfo.size);
assert.strictEqual(320, withoutInfo.width); assert.strictEqual('jpeg', withoutInfo.format);
assert.strictEqual(240, withoutInfo.height); assert.strictEqual(320, withoutInfo.width);
// Then generate with assert.strictEqual(240, withoutInfo.height);
sharp(fixtures.inputJpg) // Then generate with
.resize(320, 240) sharp(fixtures.inputJpg)
.optimizeScans() .resize(320, 240)
.toBuffer(function(err, withData, withInfo) { .optimizeScans()
if (err) throw err; .toBuffer(function(err, withData, withInfo) {
assert.strictEqual(true, withData.length > 0); if (err) throw err;
assert.strictEqual(withData.length, withInfo.size); assert.strictEqual(true, withData.length > 0);
assert.strictEqual('jpeg', withInfo.format); assert.strictEqual(withData.length, withInfo.size);
assert.strictEqual(320, withInfo.width); assert.strictEqual('jpeg', withInfo.format);
assert.strictEqual(240, withInfo.height); assert.strictEqual(320, withInfo.width);
// Verify image is of a different size (progressive output even without mozjpeg) assert.strictEqual(240, withInfo.height);
assert.strictEqual(true, withData.length != withoutData.length); // Verify image is of a different size (progressive output even without mozjpeg)
done(); assert.strictEqual(true, withData.length != withoutData.length);
}); done();
}); });
}); });
} });
if (sharp.format.magick.input.file) { if (sharp.format.magick.input.file) {
it('Convert SVG, if supported, to PNG', function(done) { it('Convert SVG, if supported, to PNG', function(done) {