@@ -455,12 +455,10 @@ class PipelineWorker : public Napi::AsyncWorker {
455455 std::tie (image, background) = sharp::ApplyAlpha (image, baton->resizeBackground , shouldPremultiplyAlpha);
456456
457457 // Embed
458- int left;
459- int top;
460- std::tie (left, top) = sharp::CalculateEmbedPosition (
458+ const auto & [left, top] = sharp::CalculateEmbedPosition (
461459 inputWidth, inputHeight, baton->width , baton->height , baton->position );
462- int width = std::max (inputWidth, baton->width );
463- int height = std::max (inputHeight, baton->height );
460+ const int width = std::max (inputWidth, baton->width );
461+ const int height = std::max (inputHeight, baton->height );
464462
465463 image = nPages > 1
466464 ? sharp::EmbedMultiPage (image,
@@ -479,13 +477,10 @@ class PipelineWorker : public Napi::AsyncWorker {
479477 // Crop
480478 if (baton->position < 9 ) {
481479 // Gravity-based crop
482- int left;
483- int top;
484-
485- std::tie (left, top) = sharp::CalculateCrop (
480+ const auto & [left, top] = sharp::CalculateCrop (
486481 inputWidth, inputHeight, baton->width , baton->height , baton->position );
487- int width = std::min (inputWidth, baton->width );
488- int height = std::min (inputHeight, baton->height );
482+ const int width = std::min (inputWidth, baton->width );
483+ const int height = std::min (inputHeight, baton->height );
489484
490485 image = nPages > 1
491486 ? sharp::CropMultiPage (image,
@@ -803,7 +798,7 @@ class PipelineWorker : public Napi::AsyncWorker {
803798 }
804799 if (image.interpretation () != baton->colourspace ) {
805800 image = image.colourspace (baton->colourspace , VImage::option ()->set (" source_space" , image.interpretation ()));
806- if (inputProfile.first && baton->withIccProfile .empty ()) {
801+ if (inputProfile.first != nullptr && baton->withIccProfile .empty ()) {
807802 image = sharp::SetProfile (image, inputProfile);
808803 }
809804 }
@@ -860,8 +855,8 @@ class PipelineWorker : public Napi::AsyncWorker {
860855 if (!baton->withExifMerge ) {
861856 image = sharp::RemoveExif (image);
862857 }
863- for (const auto & s : baton->withExif ) {
864- image.set (s. first . data (), s. second . data ());
858+ for (const auto & [key, value] : baton->withExif ) {
859+ image.set (key. c_str (), value. c_str ());
865860 }
866861 }
867862 // XMP buffer
@@ -1440,11 +1435,11 @@ class PipelineWorker : public Napi::AsyncWorker {
14401435 std::string
14411436 AssembleSuffixString (std::string extname, std::vector<std::pair<std::string, std::string>> options) {
14421437 std::string argument;
1443- for (auto const &option : options) {
1438+ for (const auto & [key, value] : options) {
14441439 if (!argument.empty ()) {
14451440 argument += " ," ;
14461441 }
1447- argument += option. first + " =" + option. second ;
1442+ argument += key + " =" + value ;
14481443 }
14491444 return extname + " [" + argument + " ]" ;
14501445 }
0 commit comments