update clang-format (#666)

This commit is contained in:
ReenigneArcher
2023-01-02 11:17:02 -05:00
committed by GitHub
parent a7a9df3b9d
commit f9963ed39b
13 changed files with 1068 additions and 1375 deletions

View File

@@ -3,6 +3,8 @@
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
# the above-mentioned repo.
# Lint c++ source files and cmake files.
name: C++ Lint
on:
@@ -10,45 +12,36 @@ on:
branches: [master, nightly]
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check_src:
name: Check src
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check
id: check
run: |
if [ -d "./src" ]
then
FOUND=true
else
FOUND=false
fi
echo "src=${FOUND}" >> $GITHUB_OUTPUT
outputs:
src: ${{ steps.check.outputs.src }}
clang-format:
name: Clang Format Lint
needs: [check_src]
if: ${{ needs.check_src.outputs.src == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Find cpp files
id: cpp_files
run: |
cpp_files=$(find . -type f -iname "*.cpp" -o -iname "*.h" -o -iname "*.m" -o -iname "*.mm")
echo "found cpp files: ${cpp_files}"
# do not quote to keep this as a single line
echo cpp_files=${cpp_files} >> $GITHUB_OUTPUT
- name: Clang format lint
if: ${{ steps.cpp_files.outputs.cpp_files }}
uses: DoozyX/clang-format-lint-action@v0.15
with:
source: './src'
source: ${{ steps.cpp_files.outputs.cpp_files }}
extensions: 'cpp,h,m,mm'
clangFormatVersion: 13
clangFormatVersion: 15
style: file
inplace: false
@@ -57,7 +50,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: clang-format-fixes
path: src/
path: ${{ steps.cpp_files.outputs.cpp_files }}
cmake-lint:
name: CMake Lint

View File

@@ -32,7 +32,9 @@ std::uint16_t map_port(int port);
namespace mail {
#define MAIL(x) \
constexpr auto x = std::string_view { #x }
constexpr auto x = std::string_view { \
#x \
}
extern safe::mail_t man;

View File

@@ -193,4 +193,4 @@ std::vector<std::string> display_names(mem_type_e hwdevice_type) {
return display_names;
}
}
} // namespace platf

View File

@@ -84,4 +84,4 @@ public:
std::unique_ptr<audio_control_t> audio_control() {
return std::make_unique<macos_audio_control_t>();
}
}
} // namespace platf

View File

@@ -142,7 +142,7 @@ typedef struct control_encrypted_t {
return (uint8_t *)(this + 1);
}
// encrypted control_header_v2 and payload data follow
} * control_encrypted_p;
} *control_encrypted_p;
struct audio_fec_packet_raw_t {
uint8_t *payload() {

View File

@@ -21,7 +21,9 @@ template<typename T>
struct argument_type;
template<typename T, typename U>
struct argument_type<T(U)> { typedef U type; };
struct argument_type<T(U)> {
typedef U type;
};
#define KITTY_USING_MOVE_T(move_t, t, init_val, z) \
class move_t { \
@@ -133,7 +135,9 @@ template<bool V, class X, class Y>
using either_t = typename __either<V, X, Y>::type;
template<class... Ts>
struct overloaded : Ts... { using Ts::operator()...; };
struct overloaded : Ts... {
using Ts::operator()...;
};
template<class... Ts>
overloaded(Ts...) -> overloaded<Ts...>;

View File

@@ -265,21 +265,20 @@ extern "C" {
/*!
* NvFBC API version.
*/
#define NVFBC_VERSION (uint32_t) (NVFBC_VERSION_MINOR | (NVFBC_VERSION_MAJOR << 8))
#define NVFBC_VERSION (uint32_t)(NVFBC_VERSION_MINOR | (NVFBC_VERSION_MAJOR << 8))
/*!
* Creates a version number for structure parameters.
*/
#define NVFBC_STRUCT_VERSION(typeName, ver) \
(uint32_t) (sizeof(typeName) | ((ver) << 16) | (NVFBC_VERSION << 24))
(uint32_t)(sizeof(typeName) | ((ver) << 16) | (NVFBC_VERSION << 24))
/*!
* Defines error codes.
*
* \see NvFBCGetLastErrorStr
*/
typedef enum _NVFBCSTATUS
{
typedef enum _NVFBCSTATUS {
/*!
* This indicates that the API call returned with no errors.
*/
@@ -384,8 +383,7 @@ typedef enum _NVFBCSTATUS
/*!
* Defines boolean values.
*/
typedef enum _NVFBC_BOOL
{
typedef enum _NVFBC_BOOL {
/*!
* False value.
*/
@@ -404,8 +402,7 @@ typedef enum _NVFBC_BOOL
/*!
* Capture type.
*/
typedef enum _NVFBC_CAPTURE_TYPE
{
typedef enum _NVFBC_CAPTURE_TYPE {
/*!
* Capture frames to a buffer in system memory.
*/
@@ -439,8 +436,7 @@ typedef enum _NVFBC_CAPTURE_TYPE
* output captures the region of the X screen that the RandR CRTC is sending to
* the RandR output.
*/
typedef enum
{
typedef enum {
/*!
* By default, NvFBC tries to track a connected primary output. If none is
* found, then it tries to track the first connected output. If none is
@@ -471,8 +467,7 @@ typedef enum
/*!
* Buffer format.
*/
typedef enum _NVFBC_BUFFER_FORMAT
{
typedef enum _NVFBC_BUFFER_FORMAT {
/*!
* Data will be converted to ARGB8888 byte-order format. 32 bpp.
*/
@@ -519,8 +514,7 @@ typedef uint64_t NVFBC_SESSION_HANDLE;
* 800x600+100+50 effectively captures a region of 800x600+2020+50 relative to
* the X screen.
*/
typedef struct _NVFBC_BOX
{
typedef struct _NVFBC_BOX {
/*!
* [in] X offset of the box.
*/
@@ -542,8 +536,7 @@ typedef struct _NVFBC_BOX
/*!
* Size used to describe the size of a frame.
*/
typedef struct _NVFBC_SIZE
{
typedef struct _NVFBC_SIZE {
/*!
* [in] Width.
*/
@@ -557,8 +550,7 @@ typedef struct _NVFBC_SIZE
/*!
* Describes information about a captured frame.
*/
typedef struct _NVFBC_FRAME_GRAB_INFO
{
typedef struct _NVFBC_FRAME_GRAB_INFO {
/*!
* [out] Width of the captured frame.
*/
@@ -644,8 +636,7 @@ typedef struct _NVFBC_FRAME_GRAB_INFO
/*!
* Defines parameters for the CreateHandle() API call.
*/
typedef struct _NVFBC_CREATE_HANDLE_PARAMS
{
typedef struct _NVFBC_CREATE_HANDLE_PARAMS {
/*!
* [in] Must be set to NVFBC_CREATE_HANDLE_PARAMS_VER
*/
@@ -705,8 +696,7 @@ typedef struct _NVFBC_CREATE_HANDLE_PARAMS
/*!
* Defines parameters for the ::NvFBCDestroyHandle() API call.
*/
typedef struct _NVFBC_DESTROY_HANDLE_PARAMS
{
typedef struct _NVFBC_DESTROY_HANDLE_PARAMS {
/*!
* [in] Must be set to NVFBC_DESTROY_HANDLE_PARAMS_VER
*/
@@ -736,8 +726,7 @@ typedef struct _NVFBC_DESTROY_HANDLE_PARAMS
*
* \see Requirements
*/
typedef struct _NVFBC_OUTPUT
{
typedef struct _NVFBC_OUTPUT {
/*!
* Identifier of the RandR output.
*/
@@ -758,8 +747,7 @@ typedef struct _NVFBC_OUTPUT
/*!
* Defines parameters for the ::NvFBCGetStatus() API call.
*/
typedef struct _NVFBC_GET_STATUS_PARAMS
{
typedef struct _NVFBC_GET_STATUS_PARAMS {
/*!
* [in] Must be set to NVFBC_GET_STATUS_PARAMS_VER
*/
@@ -830,8 +818,7 @@ typedef struct _NVFBC_GET_STATUS_PARAMS
/*!
* Defines parameters for the ::NvFBCCreateCaptureSession() API call.
*/
typedef struct _NVFBC_CREATE_CAPTURE_SESSION_PARAMS
{
typedef struct _NVFBC_CREATE_CAPTURE_SESSION_PARAMS {
/*!
* [in] Must be set to NVFBC_CREATE_CAPTURE_SESSION_PARAMS_VER
*/
@@ -998,8 +985,7 @@ typedef struct _NVFBC_CREATE_CAPTURE_SESSION_PARAMS
/*!
* Defines parameters for the ::NvFBCDestroyCaptureSession() API call.
*/
typedef struct _NVFBC_DESTROY_CAPTURE_SESSION_PARAMS
{
typedef struct _NVFBC_DESTROY_CAPTURE_SESSION_PARAMS {
/*!
* [in] Must be set to NVFBC_DESTROY_CAPTURE_SESSION_PARAMS_VER
*/
@@ -1014,8 +1000,7 @@ typedef struct _NVFBC_DESTROY_CAPTURE_SESSION_PARAMS
/*!
* Defines parameters for the ::NvFBCBindContext() API call.
*/
typedef struct _NVFBC_BIND_CONTEXT_PARAMS
{
typedef struct _NVFBC_BIND_CONTEXT_PARAMS {
/*!
* [in] Must be set to NVFBC_BIND_CONTEXT_PARAMS_VER
*/
@@ -1030,8 +1015,7 @@ typedef struct _NVFBC_BIND_CONTEXT_PARAMS
/*!
* Defines parameters for the ::NvFBCReleaseContext() API call.
*/
typedef struct _NVFBC_RELEASE_CONTEXT_PARAMS
{
typedef struct _NVFBC_RELEASE_CONTEXT_PARAMS {
/*!
* [in] Must be set to NVFBC_RELEASE_CONTEXT_PARAMS_VER
*/
@@ -1046,8 +1030,7 @@ typedef struct _NVFBC_RELEASE_CONTEXT_PARAMS
/*!
* Defines flags that can be used when capturing to system memory.
*/
typedef enum
{
typedef enum {
/*!
* Default, capturing waits for a new frame or mouse move.
*
@@ -1087,8 +1070,7 @@ typedef enum
/*!
* Defines parameters for the ::NvFBCToSysSetUp() API call.
*/
typedef struct _NVFBC_TOSYS_SETUP_PARAMS
{
typedef struct _NVFBC_TOSYS_SETUP_PARAMS {
/*!
* [in] Must be set to NVFBC_TOSYS_SETUP_PARAMS_VER
*/
@@ -1166,8 +1148,7 @@ typedef struct _NVFBC_TOSYS_SETUP_PARAMS
/*!
* Defines parameters for the ::NvFBCToSysGrabFrame() API call.
*/
typedef struct _NVFBC_TOSYS_GRAB_FRAME_PARAMS
{
typedef struct _NVFBC_TOSYS_GRAB_FRAME_PARAMS {
/*!
* [in] Must be set to NVFBC_TOSYS_GRAB_FRAME_PARAMS_VER
*/
@@ -1218,8 +1199,7 @@ typedef struct _NVFBC_TOSYS_GRAB_FRAME_PARAMS
/*!
* Defines flags that can be used when capturing to a CUDA buffer in video memory.
*/
typedef enum
{
typedef enum {
/*!
* Default, capturing waits for a new frame or mouse move.
*
@@ -1259,8 +1239,7 @@ typedef enum
/*!
* Defines parameters for the ::NvFBCToCudaSetUp() API call.
*/
typedef struct _NVFBC_TOCUDA_SETUP_PARAMS
{
typedef struct _NVFBC_TOCUDA_SETUP_PARAMS {
/*!
* [in] Must be set to NVFBC_TOCUDA_SETUP_PARAMS_VER
*/
@@ -1279,8 +1258,7 @@ typedef struct _NVFBC_TOCUDA_SETUP_PARAMS
/*!
* Defines parameters for the ::NvFBCToCudaGrabFrame() API call.
*/
typedef struct _NVFBC_TOCUDA_GRAB_FRAME_PARAMS
{
typedef struct _NVFBC_TOCUDA_GRAB_FRAME_PARAMS {
/*!
* [in] Must be set to NVFBC_TOCUDA_GRAB_FRAME_PARAMS_VER.
*/
@@ -1345,8 +1323,7 @@ typedef struct _NVFBC_TOCUDA_GRAB_FRAME_PARAMS
/*!
* Defines flags that can be used when capturing to an OpenGL buffer in video memory.
*/
typedef enum
{
typedef enum {
/*!
* Default, capturing waits for a new frame or mouse move.
*
@@ -1391,8 +1368,7 @@ typedef enum
/*!
* Defines parameters for the ::NvFBCToGLSetUp() API call.
*/
typedef struct _NVFBC_TOGL_SETUP_PARAMS
{
typedef struct _NVFBC_TOGL_SETUP_PARAMS {
/*!
* [in] Must be set to NVFBC_TOGL_SETUP_PARAMS_VER
*/
@@ -1458,8 +1434,7 @@ typedef struct _NVFBC_TOGL_SETUP_PARAMS
/*!
* Defines parameters for the ::NvFBCToGLGrabFrame() API call.
*/
typedef struct _NVFBC_TOGL_GRAB_FRAME_PARAMS
{
typedef struct _NVFBC_TOGL_GRAB_FRAME_PARAMS {
/*!
* [in] Must be set to NVFBC_TOGL_GRAB_FRAME_PARAMS_VER.
*/
@@ -1550,7 +1525,7 @@ typedef struct _NVFBC_TOGL_GRAB_FRAME_PARAMS
* A NULL terminated error message, or an empty string. Its maximum length
* is NVFBC_ERROR_STR_LEN.
*/
const char* NVFBCAPI NvFBCGetLastErrorStr(const NVFBC_SESSION_HANDLE sessionHandle);
const char *NVFBCAPI NvFBCGetLastErrorStr(const NVFBC_SESSION_HANDLE sessionHandle);
/*!
* \brief Allocates a new handle for an NvFBC client.
@@ -1925,20 +1900,20 @@ NVFBCSTATUS NVFBCAPI NvFBCToGLGrabFrame(const NVFBC_SESSION_HANDLE sessionHandle
*
* Defines API function pointers
*/
typedef const char* (NVFBCAPI* PNVFBCGETLASTERRORSTR)(const NVFBC_SESSION_HANDLE sessionHandle);
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCCREATEHANDLE)(NVFBC_SESSION_HANDLE *pSessionHandle, NVFBC_CREATE_HANDLE_PARAMS *pParams);
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCDESTROYHANDLE)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_DESTROY_HANDLE_PARAMS *pParams);
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCBINDCONTEXT)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_BIND_CONTEXT_PARAMS *pParams);
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCRELEASECONTEXT)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_RELEASE_CONTEXT_PARAMS *pParams);
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCGETSTATUS)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_GET_STATUS_PARAMS *pParams);
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCCREATECAPTURESESSION)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_CREATE_CAPTURE_SESSION_PARAMS *pParams);
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCDESTROYCAPTURESESSION)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_DESTROY_CAPTURE_SESSION_PARAMS *pParams);
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCTOSYSSETUP)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_TOSYS_SETUP_PARAMS *pParams);
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCTOSYSGRABFRAME)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_TOSYS_GRAB_FRAME_PARAMS *pParams);
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCTOCUDASETUP)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_TOCUDA_SETUP_PARAMS *pParams);
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCTOCUDAGRABFRAME)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_TOCUDA_GRAB_FRAME_PARAMS *pParams);
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCTOGLSETUP)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_TOGL_SETUP_PARAMS *pParams);
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCTOGLGRABFRAME)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_TOGL_GRAB_FRAME_PARAMS *pParams);
typedef const char *(NVFBCAPI *PNVFBCGETLASTERRORSTR)(const NVFBC_SESSION_HANDLE sessionHandle);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCCREATEHANDLE)(NVFBC_SESSION_HANDLE *pSessionHandle, NVFBC_CREATE_HANDLE_PARAMS *pParams);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCDESTROYHANDLE)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_DESTROY_HANDLE_PARAMS *pParams);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCBINDCONTEXT)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_BIND_CONTEXT_PARAMS *pParams);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCRELEASECONTEXT)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_RELEASE_CONTEXT_PARAMS *pParams);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCGETSTATUS)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_GET_STATUS_PARAMS *pParams);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCCREATECAPTURESESSION)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_CREATE_CAPTURE_SESSION_PARAMS *pParams);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCDESTROYCAPTURESESSION)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_DESTROY_CAPTURE_SESSION_PARAMS *pParams);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCTOSYSSETUP)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_TOSYS_SETUP_PARAMS *pParams);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCTOSYSGRABFRAME)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_TOSYS_GRAB_FRAME_PARAMS *pParams);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCTOCUDASETUP)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_TOCUDA_SETUP_PARAMS *pParams);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCTOCUDAGRABFRAME)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_TOCUDA_GRAB_FRAME_PARAMS *pParams);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCTOGLSETUP)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_TOGL_SETUP_PARAMS *pParams);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCTOGLGRABFRAME)(const NVFBC_SESSION_HANDLE sessionHandle, NVFBC_TOGL_GRAB_FRAME_PARAMS *pParams);
/// \endcond
@@ -1962,15 +1937,15 @@ typedef struct
PNVFBCTOSYSGRABFRAME nvFBCToSysGrabFrame; //!< [out] Pointer to ::NvFBCToSysGrabFrame().
PNVFBCTOCUDASETUP nvFBCToCudaSetUp; //!< [out] Pointer to ::NvFBCToCudaSetUp().
PNVFBCTOCUDAGRABFRAME nvFBCToCudaGrabFrame; //!< [out] Pointer to ::NvFBCToCudaGrabFrame().
void* pad1; //!< [out] Retired. Do not use.
void* pad2; //!< [out] Retired. Do not use.
void* pad3; //!< [out] Retired. Do not use.
void *pad1; //!< [out] Retired. Do not use.
void *pad2; //!< [out] Retired. Do not use.
void *pad3; //!< [out] Retired. Do not use.
PNVFBCBINDCONTEXT nvFBCBindContext; //!< [out] Pointer to ::NvFBCBindContext().
PNVFBCRELEASECONTEXT nvFBCReleaseContext; //!< [out] Pointer to ::NvFBCReleaseContext().
void* pad4; //!< [out] Retired. Do not use.
void* pad5; //!< [out] Retired. Do not use.
void* pad6; //!< [out] Retired. Do not use.
void* pad7; //!< [out] Retired. Do not use.
void *pad4; //!< [out] Retired. Do not use.
void *pad5; //!< [out] Retired. Do not use.
void *pad6; //!< [out] Retired. Do not use.
void *pad7; //!< [out] Retired. Do not use.
PNVFBCTOGLSETUP nvFBCToGLSetUp; //!< [out] Pointer to ::nvFBCToGLSetup().
PNVFBCTOGLGRABFRAME nvFBCToGLGrabFrame; //!< [out] Pointer to ::nvFBCToGLGrabFrame().
} NVFBC_API_FUNCTION_LIST;
@@ -1997,7 +1972,7 @@ NVFBCSTATUS NVFBCAPI NvFBCCreateInstance(NVFBC_API_FUNCTION_LIST *pFunctionList)
*
* Defines function pointer for the ::NvFBCCreateInstance() API call.
*/
typedef NVFBCSTATUS (NVFBCAPI* PNVFBCCREATEINSTANCE)(NVFBC_API_FUNCTION_LIST *pFunctionList);
typedef NVFBCSTATUS(NVFBCAPI *PNVFBCCREATEINSTANCE)(NVFBC_API_FUNCTION_LIST *pFunctionList);
#ifdef __cplusplus
}

File diff suppressed because it is too large Load Diff