Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions meshcore/KVM/MacOS/mac_events.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/*

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 Include guard macro name mismatches actual file (LINUX_EVENTS_H_ in mac_events.h)

Changed the include guard from LINUX_EVENTS_H_ to MAC_EVENTS_H_ (both the #ifndef/#define at the top and the trailing #endif comment), and corrected the header comment from "linux_events.h" to "mac_events.h", exactly as suggested, eliminating the guard collision risk with the Linux counterpart header.

πŸ€– Prompt for AI agents
In meshcore/KVM/MacOS/mac_events.h around line 1, review and complete this code-review fix: Include guard macro name mismatches actual file (LINUX_EVENTS_H_ in mac_events.h).
What the draft fix changed: Changed the include guard from `LINUX_EVENTS_H_` to `MAC_EVENTS_H_` (both the `#ifndef`/`#define` at the top and the trailing `#endif` comment), and corrected the header comment from "linux_events.h" to "mac_events.h", exactly as suggested, eliminating the guard collision risk with the Linux counterpart header.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 90 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

* linux_events.h
* mac_events.h
*
* Created on: Jul 8, 2011
* Author: Intel
*/

#ifndef LINUX_EVENTS_H_
#define LINUX_EVENTS_H_
#ifndef MAC_EVENTS_H_
#define MAC_EVENTS_H_

#ifdef __APPLE__
#include <Carbon/Carbon.h>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 πŸ”΄ Unconditional Carbon.h include breaks non-macOS builds

Wrapped the macOS-only body of meshcore/KVM/MacOS/mac_events.h (the #include <Carbon/Carbon.h> line and everything through the MouseAction/KeyAction/KeyActionUnicode declarations) in #ifdef __APPLE__ / #endif /* __APPLE__ */, so on non-Apple builds the header compiles to an empty guarded shell instead of failing on the Carbon.h include. Risk: any non-macOS translation unit that actually relies on these declarations (MouseAction, KeyAction, etc.) being present will now silently lose them rather than fail loudly on the Carbon include; a complete fix would also confirm no non-Apple build path includes this file expecting real declarations.

πŸ€– Prompt for AI agents
In meshcore/KVM/MacOS/mac_events.h around line 11, review and complete this code-review fix: Unconditional Carbon.h include breaks non-macOS builds.
What the draft fix changed: Wrapped the macOS-only body of meshcore/KVM/MacOS/mac_events.h (the `#include <Carbon/Carbon.h>` line and everything through the `MouseAction`/`KeyAction`/`KeyActionUnicode` declarations) in `#ifdef __APPLE__` / `#endif /* __APPLE__ */`, so on non-Apple builds the header compiles to an empty guarded shell instead of failing on the Carbon.h include. Risk: any non-macOS translation unit that actually relies on these declarations (MouseAction, KeyAction, etc.) being present will now silently lose them rather than fail loudly on the Carbon include; a complete fix would also confirm no non-Apple build path includes this file expecting real declarations.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟑 60 medium β€” react πŸ‘/πŸ‘Ž to teach the reviewer

#include <string.h>
#include <stdio.h>
Expand Down Expand Up @@ -379,4 +380,7 @@ extern void MouseAction(double absX, double absY, int button, short wheel);
extern void KeyAction(unsigned char vk, int up);
extern void KeyActionUnicode(uint16_t unicode, int up);

#endif /* LINUX_EVENTS_H_ */
#endif /* __APPLE__ */

#endif /* MAC_EVENTS_H_ */

3 changes: 3 additions & 0 deletions microstack/ILibAsyncServerSocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ limitations under the License.
#include <crtdbg.h>
#endif

#if defined(WIN32)
#if defined(WINSOCK2)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 πŸ”΄ WINSOCK2/WINSOCK1 headers included without a WIN32 guard

Wrapped the #if defined(WINSOCK2) ... #elif defined(WINSOCK1) ... #endif header inclusion block near the top of the file (previously at line ~22) with an outer #if defined(WIN32) ... #endif guard, matching the style used consistently elsewhere in the file (e.g. the #if defined(WIN32) blocks in ILibAsyncServerSocket_ResumeListeningSink and ILibCreateAsyncServerSocketModuleWithMemoryExMOD). This ensures <winsock2.h>/<ws2tcpip.h> or <winsock.h>/<wininet.h> are only included when building for WIN32, preventing POSIX builds from pulling in Windows-only headers if WINSOCK2/WINSOCK1 macros happen to be defined independently of WIN32.

πŸ€– Prompt for AI agents
In microstack/ILibAsyncServerSocket.c around line 22, review and complete this code-review fix: WINSOCK2/WINSOCK1 headers included without a WIN32 guard.
What the draft fix changed: Wrapped the `#if defined(WINSOCK2) ... #elif defined(WINSOCK1) ... #endif` header inclusion block near the top of the file (previously at line ~22) with an outer `#if defined(WIN32) ... #endif` guard, matching the style used consistently elsewhere in the file (e.g. the `#if defined(WIN32)` blocks in `ILibAsyncServerSocket_ResumeListeningSink` and `ILibCreateAsyncServerSocketModuleWithMemoryExMOD`). This ensures `<winsock2.h>/<ws2tcpip.h>` or `<winsock.h>/<wininet.h>` are only included when building for WIN32, preventing POSIX builds from pulling in Windows-only headers if WINSOCK2/WINSOCK1 macros happen to be defined independently of WIN32.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 92 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

#include <winsock2.h>
#include <ws2tcpip.h>
#elif defined(WINSOCK1)
#include <winsock.h>
#include <wininet.h>
#endif
#endif

#include "ILibParsers.h"
#include "ILibAsyncServerSocket.h"
Expand Down Expand Up @@ -791,3 +793,4 @@ void ILibAsyncServerSocket_SSL_SetSink(ILibAsyncServerSocket_ServerModule AsyncS
((struct ILibAsyncServerSocketModule*)AsyncServerSocketModule)->OnSSLContext = handler;
}
#endif

5 changes: 2 additions & 3 deletions samples/webrtc/C# Sample/WebRTC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ limitations under the License.
#include "stdafx.h"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 πŸ”΄ WinSock2.h/WS2tcpip.h included unconditionally in WebRTC.cpp

Moved the previously unconditional #include <WinSock2.h> and #include <WS2tcpip.h> at file scope into the existing #if defined(WIN32) guard block (which previously only wrapped crtdbg.h), matching the suggested fix exactly. This prevents these Windows-only headers from being included on POSIX targets while leaving all other code unchanged.

πŸ€– Prompt for AI agents
In samples/webrtc/C# Sample/WebRTC.cpp around line 21, review and complete this code-review fix: WinSock2.h/WS2tcpip.h included unconditionally in WebRTC.cpp.
What the draft fix changed: Moved the previously unconditional `#include <WinSock2.h>` and `#include <WS2tcpip.h>` at file scope into the existing `#if defined(WIN32)` guard block (which previously only wrapped `crtdbg.h`), matching the suggested fix exactly. This prevents these Windows-only headers from being included on POSIX targets while leaving all other code unchanged.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 95 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

#include "WebRTC.h"

#if defined(WIN32)
#include <WinSock2.h>
#include <WS2tcpip.h>

#if defined(WIN32)
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#endif
Expand Down Expand Up @@ -469,4 +468,4 @@ extern "C"
return(ILibSCTP_Debug_SetDebugCallback(((void**)connection)[0], debugField, handler));
}
#endif
}
}