From 2c2c1745ede31f0a53e8bde3de399443f38ce876 Mon Sep 17 00:00:00 2001 From: Xue Haonan Date: Tue, 8 Oct 2024 11:00:06 +0800 Subject: [PATCH 1/2] Fixed pointer implicit conversion error. --- screen/screengrab_c.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/screen/screengrab_c.h b/screen/screengrab_c.h index 579c3802..f1eb2217 100644 --- a/screen/screengrab_c.h +++ b/screen/screengrab_c.h @@ -90,7 +90,7 @@ MMBitmapRef copyMMBitmapFromDisplayInRect(MMRectInt32 rect, int32_t display_id, if (!imageData) { return NULL; } bufferSize = CFDataGetLength(imageData); - buffer = malloc(bufferSize); + buffer = (uint8_t *)malloc(bufferSize); CFDataGetBytes(imageData, CFRangeMake(0, bufferSize), buffer); bitmap = createMMBitmap_c(buffer, From 563c99cdcaea4829828655cf41e567211f60f64c Mon Sep 17 00:00:00 2001 From: Xue Haonan Date: Thu, 10 Oct 2024 20:06:20 +0800 Subject: [PATCH 2/2] Fixed: fix macro definition. Inside `mouse/mouse_c.h`: line 101 The expansion of MOUSE_COORD_TO_ABS will result in undesired calculation. --- mouse/mouse_c.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mouse/mouse_c.h b/mouse/mouse_c.h index 0f4ee863..08ad87c9 100644 --- a/mouse/mouse_c.h +++ b/mouse/mouse_c.h @@ -99,7 +99,7 @@ void moveMouse(MMPointInt32 point){ // Mouse motion is now done using SendInput with MOUSEINPUT. // We use Absolute mouse positioning #define MOUSE_COORD_TO_ABS(coord, width_or_height) ( \ - ((65536 * coord) / width_or_height) + (coord < 0 ? -1 : 1)) + ((65536 * (coord)) / (width_or_height)) + ((coord) < 0 ? (-1) : 1)) MMRectInt32 rect = getScreenRect(1); int32_t x = MOUSE_COORD_TO_ABS(point.x - rect.origin.x, rect.size.w);