@@ -496,7 +496,7 @@ Napi::Number _keyToggle(const Napi::CallbackInfo &info)
496
496
MMKeyFlags flags = MOD_NONE;
497
497
MMKeyCode key;
498
498
499
- bool down;
499
+ bool down = false ;
500
500
501
501
// Get arguments from JavaScript.
502
502
std::string keyName = info[0 ].As <Napi::String>();
@@ -576,7 +576,7 @@ Napi::Number _typeStringDelayed(const Napi::CallbackInfo &info)
576
576
std::string stringToType = info[0 ].As <Napi::String>();
577
577
size_t cpm = info[1 ].As <Napi::Number>().Int32Value ();
578
578
579
- typeStringDelayed (stringToType.c_str (), cpm);
579
+ typeStringDelayed (stringToType.c_str (), ( unsigned int ) cpm);
580
580
581
581
return Napi::Number::New (env, 1 );
582
582
}
@@ -613,8 +613,8 @@ Napi::Object _getScreenSize(const Napi::CallbackInfo &info)
613
613
614
614
// Create our return object.
615
615
Napi::Object obj = Napi::Object::New (env);
616
- obj.Set (Napi::String::New (env, " width" ), Napi::Number::New (env, displaySize.width ));
617
- obj.Set (Napi::String::New (env, " height" ), Napi::Number::New (env, displaySize.height ));
616
+ obj.Set (Napi::String::New (env, " width" ), Napi::Number::New (env, ( double ) displaySize.width ));
617
+ obj.Set (Napi::String::New (env, " height" ), Napi::Number::New (env, ( double ) displaySize.height ));
618
618
619
619
return obj;
620
620
}
@@ -660,7 +660,7 @@ Napi::Number _highlight(const Napi::CallbackInfo &info)
660
660
y = info[1 ].As <Napi::Number>().Int32Value ();
661
661
width = info[2 ].As <Napi::Number>().Int32Value ();
662
662
height = info[3 ].As <Napi::Number>().Int32Value ();
663
- duration = info[4 ].As <Napi::Number>().Int64Value ();
663
+ duration = ( int ) info[4 ].As <Napi::Number>().Int64Value ();
664
664
opacity = info[5 ].As <Napi::Number>().FloatValue ();
665
665
666
666
highlight (x, y, width, height, duration, opacity);
@@ -673,7 +673,7 @@ Napi::Number _getActiveWindow(const Napi::CallbackInfo &info) {
673
673
Napi::Env env = info.Env ();
674
674
675
675
WindowHandle windowHandle = getActiveWindow ();
676
- return Napi::Number::New (env, windowHandle);
676
+ return Napi::Number::New (env, ( double ) windowHandle);
677
677
}
678
678
679
679
Napi::Array _getWindows (const Napi::CallbackInfo &info) {
@@ -683,7 +683,7 @@ Napi::Array _getWindows(const Napi::CallbackInfo &info) {
683
683
auto arr = Napi::Array::New (env, windowHandles.size ());
684
684
685
685
for (size_t idx = 0 ; idx < windowHandles.size (); ++idx) {
686
- arr[idx] = windowHandles[idx];
686
+ arr[( uint32_t ) idx] = windowHandles[idx];
687
687
}
688
688
689
689
return arr;
@@ -696,10 +696,10 @@ Napi::Object _getWindowRect(const Napi::CallbackInfo &info) {
696
696
MMRect windowRect = getWindowRect (windowHandle);
697
697
698
698
Napi::Object obj = Napi::Object::New (env);
699
- obj.Set (Napi::String::New (env, " x" ), Napi::Number::New (env, windowRect.origin .x ));
700
- obj.Set (Napi::String::New (env, " y" ), Napi::Number::New (env, windowRect.origin .y ));
701
- obj.Set (Napi::String::New (env, " width" ), Napi::Number::New (env, windowRect.size .width ));
702
- obj.Set (Napi::String::New (env, " height" ), Napi::Number::New (env, windowRect.size .height ));
699
+ obj.Set (Napi::String::New (env, " x" ), Napi::Number::New (env, ( double ) windowRect.origin .x ));
700
+ obj.Set (Napi::String::New (env, " y" ), Napi::Number::New (env, ( double ) windowRect.origin .y ));
701
+ obj.Set (Napi::String::New (env, " width" ), Napi::Number::New (env, ( double ) windowRect.size .width ));
702
+ obj.Set (Napi::String::New (env, " height" ), Napi::Number::New (env, ( double ) windowRect.size .height ));
703
703
704
704
return obj;
705
705
}
@@ -763,13 +763,13 @@ Napi::Object _captureScreen(const Napi::CallbackInfo &info)
763
763
throw Napi::Error::New (env, " Error: Failed to capture screen" );
764
764
}
765
765
766
- uint32_t bufferSize = bitmap->bytewidth * bitmap->height ;
766
+ uint32_t bufferSize = ( uint32_t )( bitmap->bytewidth * bitmap->height ) ;
767
767
Napi::Buffer<char > buffer = Napi::Buffer<char >::New (env, (char *)bitmap->imageBuffer , bufferSize, finalizer);
768
768
769
769
Napi::Object obj = Napi::Object::New (env);
770
- obj.Set (Napi::String::New (env, " width" ), Napi::Number::New (env, bitmap->width ));
771
- obj.Set (Napi::String::New (env, " height" ), Napi::Number::New (env, bitmap->height ));
772
- obj.Set (Napi::String::New (env, " byteWidth" ), Napi::Number::New (env, bitmap->bytewidth ));
770
+ obj.Set (Napi::String::New (env, " width" ), Napi::Number::New (env, ( double ) bitmap->width ));
771
+ obj.Set (Napi::String::New (env, " height" ), Napi::Number::New (env, ( double ) bitmap->height ));
772
+ obj.Set (Napi::String::New (env, " byteWidth" ), Napi::Number::New (env, ( double ) bitmap->bytewidth ));
773
773
obj.Set (Napi::String::New (env, " bitsPerPixel" ), Napi::Number::New (env, bitmap->bitsPerPixel ));
774
774
obj.Set (Napi::String::New (env, " bytesPerPixel" ), Napi::Number::New (env, bitmap->bytesPerPixel ));
775
775
obj.Set (Napi::String::New (env, " image" ), buffer);
0 commit comments