فهرست منبع

Update source code formatting with clang-format 17.0.3

Added SCDisplayRef type alias to fix a quirk of this specific
clang-format version with ObjC block syntax.
PatTheMav 1 سال پیش
والد
کامیت
f4733ec6a2

+ 1 - 1
UI/obf.c

@@ -1,7 +1,7 @@
 #include "obf.h"
 #include <stdbool.h>
 
-#define LOWER_HALFBYTE(x) ((x)&0xF)
+#define LOWER_HALFBYTE(x) ((x) & 0xF)
 #define UPPER_HALFBYTE(x) (((x) >> 4) & 0xF)
 
 void deobfuscate_str(char *str, uint64_t val)

+ 2 - 2
libobs/graphics/math-defs.h

@@ -28,8 +28,8 @@ extern "C" {
 #define M_PI 3.1415926535897932384626433832795f
 #endif
 
-#define RAD(val) ((val)*0.0174532925199432957692369076848f)
-#define DEG(val) ((val)*57.295779513082320876798154814105f)
+#define RAD(val) ((val) * 0.0174532925199432957692369076848f)
+#define DEG(val) ((val) * 57.295779513082320876798154814105f)
 #define LARGE_EPSILON 1e-2f
 #define EPSILON 1e-4f
 #define TINY_EPSILON 1e-5f

+ 1 - 1
libobs/util/windows/obfuscate.c

@@ -6,7 +6,7 @@
 #include <windows.h>
 #include "obfuscate.h"
 
-#define LOWER_HALFBYTE(x) ((x)&0xF)
+#define LOWER_HALFBYTE(x) ((x) & 0xF)
 #define UPPER_HALFBYTE(x) (((x) >> 4) & 0xF)
 
 static void deobfuscate_str(char *str, uint64_t val)

+ 1 - 2
plugins/mac-capture/mac-sck-audio-capture.m

@@ -68,8 +68,7 @@ static bool init_audio_screen_stream(struct screen_capture *sc)
     sc->stream_properties = [[SCStreamConfiguration alloc] init];
     os_sem_wait(sc->shareable_content_available);
 
-    SCDisplay * (^get_target_display)(void) = ^SCDisplay *
-    {
+    SCDisplayRef (^get_target_display)(void) = ^SCDisplayRef {
         for (SCDisplay *display in sc->shareable_content.displays) {
             if (display.displayID == sc->display) {
                 return display;

+ 2 - 0
plugins/mac-capture/mac-sck-common.h

@@ -28,6 +28,8 @@ typedef enum {
     ScreenCaptureAudioApplicationStream = 1,
 } ScreenCaptureAudioStreamType;
 
+typedef SCDisplay *SCDisplayRef;
+
 @interface ScreenCaptureDelegate : NSObject <SCStreamOutput, SCStreamDelegate>
 
 @property struct screen_capture *sc;

+ 1 - 2
plugins/mac-capture/mac-sck-video-capture.m

@@ -86,8 +86,7 @@ static bool init_screen_stream(struct screen_capture *sc)
     sc->stream_properties = [[SCStreamConfiguration alloc] init];
     os_sem_wait(sc->shareable_content_available);
 
-    SCDisplay * (^get_target_display)(void) = ^SCDisplay *
-    {
+    SCDisplayRef (^get_target_display)(void) = ^SCDisplayRef {
         for (SCDisplay *display in sc->shareable_content.displays) {
             if (display.displayID == sc->display) {
                 return display;

+ 1 - 1
plugins/obs-ffmpeg/obs-ffmpeg-rist.h

@@ -25,7 +25,7 @@
 #define RIST_MAX_PAYLOAD_SIZE (10000 - 28)
 
 #define FF_LIBRIST_MAKE_VERSION(major, minor, patch) \
-	((patch) + ((minor)*0x100) + ((major)*0x10000))
+	((patch) + ((minor) * 0x100) + ((major) * 0x10000))
 #define FF_LIBRIST_VERSION                                 \
 	FF_LIBRIST_MAKE_VERSION(LIBRIST_API_VERSION_MAJOR, \
 				LIBRIST_API_VERSION_MINOR, \

+ 2 - 2
plugins/obs-ffmpeg/obs-ffmpeg-url.h

@@ -46,7 +46,7 @@ typedef struct URLContext {
 //#define LOG_DEBUG 7 // issue w/ libobs
 #define LOG_PRIMASK 0x07
 
-#define LOG_PRI(p) ((p)&LOG_PRIMASK)
+#define LOG_PRI(p) ((p) & LOG_PRIMASK)
 #define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
 
 #define LOG_KERN (0 << 3)
@@ -74,7 +74,7 @@ typedef struct URLContext {
 
 #define LOG_NFACILITIES 24
 #define LOG_FACMASK 0x03f8
-#define LOG_FAC(p) (((p)&LOG_FACMASK) >> 3)
+#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
 #endif
 #endif
 

+ 1 - 1
plugins/vlc-video/vlc-video-plugin.c

@@ -179,9 +179,9 @@ static bool load_libvlc_module(void)
 	RegCloseKey(key);
 #else
 
+/* According to otoolo -L, this is what libvlc.dylib wants. */
 #ifdef __APPLE__
 #define LIBVLC_DIR "/Applications/VLC.app/Contents/MacOS/"
-/* According to otoolo -L, this is what libvlc.dylib wants. */
 #define LIBVLC_CORE_FILE LIBVLC_DIR "lib/libvlccore.dylib"
 #define LIBVLC_FILE LIBVLC_DIR "lib/libvlc.5.dylib"
 	setenv("VLC_PLUGIN_PATH", LIBVLC_DIR "plugins", false);

+ 2 - 0
plugins/win-capture/graphics-hook/vulkan-capture.c

@@ -2213,6 +2213,7 @@ static void VKAPI_CALL OBS_DestroySurfaceKHR(VkInstance inst, VkSurfaceKHR surf,
 	destroy_surface(inst, surf, ac);
 }
 
+/* clang-format off */
 #define GETPROCADDR(func)               \
 	if (!strcmp(pName, "vk" #func)) \
 		return (PFN_vkVoidFunction)&OBS_##func;
@@ -2220,6 +2221,7 @@ static void VKAPI_CALL OBS_DestroySurfaceKHR(VkInstance inst, VkSurfaceKHR surf,
 #define GETPROCADDR_IF_SUPPORTED(func)  \
 	if (!strcmp(pName, "vk" #func)) \
 		return funcs->func ? (PFN_vkVoidFunction)&OBS_##func : NULL;
+/* clang-format on */
 
 static PFN_vkVoidFunction VKAPI_CALL OBS_GetDeviceProcAddr(VkDevice device,
 							   const char *pName)

+ 1 - 1
plugins/win-dshow/win-dshow.cpp

@@ -1308,7 +1308,7 @@ static inline void AddCap(vector<Resolution> &resolutions, const VideoInfo &cap)
 }
 
 #define MAKE_DSHOW_FPS(fps) (10000000LL / (fps))
-#define MAKE_DSHOW_FRACTIONAL_FPS(den, num) ((num)*10000000LL / (den))
+#define MAKE_DSHOW_FRACTIONAL_FPS(den, num) ((num) * 10000000LL / (den))
 
 static long long GetOBSFPS()
 {