diff options
Diffstat (limited to '')
170 files changed, 706 insertions, 701 deletions
@@ -201,38 +201,37 @@ /** * Gamma ramp structure union for different depths */ -typedef union gamma_ramps_any { +union gamma_ramps_any { /** * 8-bit gamma ramps */ - libgamma_gamma_ramps8_t bits8; + struct libgamma_gamma_ramps8 bits8; /** * 16-bit gamma ramps */ - libgamma_gamma_ramps16_t bits16; + struct libgamma_gamma_ramps16 bits16; /** * 32-bit gamma ramps */ - libgamma_gamma_ramps32_t bits32; + struct libgamma_gamma_ramps32 bits32; /** * 64-bit gamma ramps */ - libgamma_gamma_ramps64_t bits64; + struct libgamma_gamma_ramps64 bits64; /** * Single precision float gamma ramps */ - libgamma_gamma_rampsf_t float_single; + struct libgamma_gamma_rampsf float_single; /** * Double precision float gamma ramps */ - libgamma_gamma_rampsd_t float_double; - -} gamma_ramps_any_t; + struct libgamma_gamma_rampsd float_double; +}; /** @@ -244,7 +243,7 @@ typedef union gamma_ramps_any { * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -typedef int get_ramps_any_fun(libgamma_crtc_state_t *restrict, gamma_ramps_any_t *restrict); +typedef int get_ramps_any_fun(struct libgamma_crtc_state *restrict, union gamma_ramps_any *restrict); /** * A function for writing the gamma ramps to a CRTC @@ -255,7 +254,7 @@ typedef int get_ramps_any_fun(libgamma_crtc_state_t *restrict, gamma_ramps_any_t * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -typedef int set_ramps_any_fun(libgamma_crtc_state_t *restrict, const gamma_ramps_any_t *restrict); +typedef int set_ramps_any_fun(struct libgamma_crtc_state *restrict, const union gamma_ramps_any *restrict); @@ -311,7 +310,7 @@ typedef int set_ramps_any_fun(libgamma_crtc_state_t *restrict, const gamma_ramps * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_internal_translated_ramp_get_(libgamma_crtc_state_t *restrict, gamma_ramps_any_t *restrict, +int libgamma_internal_translated_ramp_get_(struct libgamma_crtc_state *restrict, union gamma_ramps_any *restrict, signed, signed, get_ramps_any_fun *); /** @@ -330,7 +329,7 @@ int libgamma_internal_translated_ramp_get_(libgamma_crtc_state_t *restrict, gamm * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_internal_translated_ramp_set_(libgamma_crtc_state_t *restrict, const gamma_ramps_any_t *restrict, +int libgamma_internal_translated_ramp_set_(struct libgamma_crtc_state *restrict, const union gamma_ramps_any *restrict, signed, signed, set_ramps_any_fun *); /** @@ -342,7 +341,7 @@ int libgamma_internal_translated_ramp_set_(libgamma_crtc_state_t *restrict, cons * @param in Input gamma ramps */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_internal_translate_to_64(signed, size_t, uint64_t *restrict, const gamma_ramps_any_t *restrict); +void libgamma_internal_translate_to_64(signed, size_t, uint64_t *restrict, const union gamma_ramps_any *restrict); /** * Undo the actions of `libgamma_internal_translate_to_64` @@ -353,7 +352,7 @@ void libgamma_internal_translate_to_64(signed, size_t, uint64_t *restrict, const * @param in Input array, may be modified */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_internal_translate_from_64(signed, size_t, gamma_ramps_any_t *restrict, const uint64_t *restrict); +void libgamma_internal_translate_from_64(signed, size_t, union gamma_ramps_any *restrict, const uint64_t *restrict); /** * Allocate and initalise a gamma ramp with any depth @@ -367,7 +366,8 @@ void libgamma_internal_translate_from_64(signed, size_t, gamma_ramps_any_t *rest * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_internal_allocated_any_ramp(gamma_ramps_any_t *restrict, const gamma_ramps_any_t *restrict, signed, size_t *restrict); +int libgamma_internal_allocated_any_ramp(union gamma_ramps_any *restrict, const union gamma_ramps_any *restrict, + signed, size_t *restrict); /** @@ -380,4 +380,4 @@ int libgamma_internal_allocated_any_ramp(gamma_ramps_any_t *restrict, const gamm * @return Non-zero on error */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_internal_parse_edid(libgamma_crtc_information_t *restrict, unsigned long long); +int libgamma_internal_parse_edid(struct libgamma_crtc_information *restrict, unsigned long long); diff --git a/fake-quartz-cg.c b/fake-quartz-cg.c index 34d3995..b0cc574 100644 --- a/fake-quartz-cg.c +++ b/fake-quartz-cg.c @@ -227,7 +227,7 @@ CGGetOnlineDisplayList(uint32_t max_size, CGDirectDisplayID *restrict displays_o * `CGDisplayRestoreColorSyncSettings` which restore the * all gamma ramps on the system to the system settnigs. */ - original_ramps = malloc(crtc_count * 3 * 256 * sizeof(uint16_t)); + original_ramps = malloc(crtc_count * 3 * 256 * sizeof(*original_ramps)); if (!original_ramps) { perror("malloc"); xcb_disconnect(connection); @@ -248,13 +248,12 @@ CGGetOnlineDisplayList(uint32_t max_size, CGDirectDisplayID *restrict displays_o } /* Copy over the gamma ramps to the memory area we have allocated */ -#define __DEST(C) original_ramps + (C + 3 * i) * 256 -#define __SRC(C) xcb_randr_get_crtc_gamma_##C(gamma_reply) - memcpy(__DEST(0), __SRC(red), 256 * sizeof(uint16_t)); - memcpy(__DEST(1), __SRC(green), 256 * sizeof(uint16_t)); - memcpy(__DEST(2), __SRC(blue), 256 * sizeof(uint16_t)); -#undef __SRC -#undef __DEST + memcpy(&original_ramps[(3 * i + 0) * 256], xcb_randr_get_crtc_gamma_red(gamma_reply) + 256 * sizeof(*original_ramps)); + memcpy(&original_ramps[(3 * i + 1) * 256], xcb_randr_get_crtc_gamma_green(gamma_reply), + 256 * sizeof(*original_ramps)); + memcpy(&original_ramps[(3 * i + 2) * 256], xcb_randr_get_crtc_gamma_blue(gamma_reply), + 256 * sizeof(*original_ramps)); /* Release resouces */ free(gamma_reply); diff --git a/fake-w32-gdi.c b/fake-w32-gdi.c index bee0e93..e5978a2 100644 --- a/fake-w32-gdi.c +++ b/fake-w32-gdi.c @@ -316,6 +316,7 @@ GetDeviceGammaRamp(HDC hDC, LPVOID restrict lpRamp) xcb_randr_get_crtc_gamma_cookie_t gamma_cookie; xcb_randr_get_crtc_gamma_reply_t *restrict gamma_reply; xcb_generic_error_t *error; + uint16_t *restrict ramp = lpRamp; /* Read current gamma ramps */ gamma_cookie = xcb_randr_get_crtc_gamma(connection, *(xcb_randr_crtc_t *)hDC); @@ -323,16 +324,10 @@ GetDeviceGammaRamp(HDC hDC, LPVOID restrict lpRamp) if (error) return FALSE; -#define DEST_RAMP(I) (&((uint16_t *)lpRamp)[(I) * GAMMA_RAMP_SIZE]) -#define SRC_RAMP(C) (xcb_randr_get_crtc_gamma_##C(gamma_reply)) - /* Copy the ramps into the output parameter (coalesced) */ - memcpy(DEST_RAMP(0), SRC_RAMP(red), GAMMA_RAMP_SIZE * sizeof(uint16_t)); - memcpy(DEST_RAMP(1), SRC_RAMP(green), GAMMA_RAMP_SIZE * sizeof(uint16_t)); - memcpy(DEST_RAMP(2), SRC_RAMP(blue), GAMMA_RAMP_SIZE * sizeof(uint16_t)); - -#undef SRC_RAMP -#undef DEST_RAMP + memcpy(&ramp[0 * GAMMA_RAMP_SIZE], xcb_randr_get_crtc_gamma_red(gamma_reply), GAMMA_RAMP_SIZE * sizeof(*ramp)); + memcpy(&ramp[1 * GAMMA_RAMP_SIZE], xcb_randr_get_crtc_gamma_green(gamma_reply), GAMMA_RAMP_SIZE * sizeof(*ramp)); + memcpy(&ramp[2 * GAMMA_RAMP_SIZE], xcb_randr_get_crtc_gamma_blue(gamma_reply), GAMMA_RAMP_SIZE * sizeof(*ramp)); free(gamma_reply); return TRUE; diff --git a/get_ramps.h b/get_ramps.h index 5c51242..2645feb 100644 --- a/get_ramps.h +++ b/get_ramps.h @@ -8,7 +8,7 @@ #define CONCAT(A, B) A##B -gamma_ramps_any_t ramps_; +union gamma_ramps_any ramps_; switch (this->partition->site->method) { #define X(CONST, CNAME, MDEPTH, MRAMPS)\ case CONST:\ @@ -11,61 +11,62 @@ #undef libgamma_method_capabilities -int libgamma_crtc_set_gamma_ramps8(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps8_t); -int libgamma_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps16_t); -int libgamma_crtc_set_gamma_ramps32(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps32_t); -int libgamma_crtc_set_gamma_ramps64(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps64_t); -int libgamma_crtc_set_gamma_rampsf(libgamma_crtc_state_t *restrict, libgamma_gamma_rampsf_t); -int libgamma_crtc_set_gamma_rampsd(libgamma_crtc_state_t *restrict, libgamma_gamma_rampsd_t); -int libgamma_get_crtc_information(libgamma_crtc_information_t *restrict, libgamma_crtc_state_t *restrict, int32_t); -int libgamma_method_capabilities(libgamma_method_capabilities_t *restrict, int); +int libgamma_crtc_set_gamma_ramps8(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps8); +int libgamma_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps16); +int libgamma_crtc_set_gamma_ramps32(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps32); +int libgamma_crtc_set_gamma_ramps64(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps64); +int libgamma_crtc_set_gamma_rampsf(struct libgamma_crtc_state *restrict, struct libgamma_gamma_rampsf); +int libgamma_crtc_set_gamma_rampsd(struct libgamma_crtc_state *restrict, struct libgamma_gamma_rampsd); +int libgamma_get_crtc_information(struct libgamma_crtc_information *restrict, struct libgamma_crtc_state *restrict, int32_t); +int libgamma_method_capabilities(struct libgamma_method_capabilities__new *restrict, int); int -libgamma_crtc_set_gamma_ramps8(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps8_t ramps) +libgamma_crtc_set_gamma_ramps8(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps8 ramps) { return libgamma_crtc_set_gamma_ramps8__new(this, &ramps); } int -libgamma_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps16_t ramps) +libgamma_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps16 ramps) { return libgamma_crtc_set_gamma_ramps16__new(this, &ramps); } int -libgamma_crtc_set_gamma_ramps32(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps32_t ramps) +libgamma_crtc_set_gamma_ramps32(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps32 ramps) { return libgamma_crtc_set_gamma_ramps32__new(this, &ramps); } int -libgamma_crtc_set_gamma_ramps64(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps64_t ramps) +libgamma_crtc_set_gamma_ramps64(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps64 ramps) { return libgamma_crtc_set_gamma_ramps64__new(this, &ramps); } int -libgamma_crtc_set_gamma_rampsf(libgamma_crtc_state_t *restrict this, libgamma_gamma_rampsf_t ramps) +libgamma_crtc_set_gamma_rampsf(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_rampsf ramps) { return libgamma_crtc_set_gamma_rampsf__new(this, &ramps); } int -libgamma_crtc_set_gamma_rampsd(libgamma_crtc_state_t *restrict this, libgamma_gamma_rampsd_t ramps) +libgamma_crtc_set_gamma_rampsd(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_rampsd ramps) { return libgamma_crtc_set_gamma_rampsd__new(this, &ramps); } int -libgamma_get_crtc_information(libgamma_crtc_information_t *restrict this, libgamma_crtc_state_t *restrict crtc, int32_t fields) +libgamma_get_crtc_information(struct libgamma_crtc_information *restrict this, + struct libgamma_crtc_state *restrict crtc, int32_t fields) { - return libgamma_get_crtc_information__new(this, offsetof(libgamma_crtc_information_t, gamma_error) + + return libgamma_get_crtc_information__new(this, offsetof(struct libgamma_crtc_information, gamma_error) + sizeof(this->gamma_error), crtc, (unsigned long long int)fields); } int -libgamma_method_capabilities(libgamma_method_capabilities_t *restrict this, int method) +libgamma_method_capabilities(struct libgamma_method_capabilities__new *restrict this, int method) { const size_t size = (_Alignof(unsigned) > sizeof(int32_t) ? _Alignof(unsigned) : sizeof(int32_t)) + sizeof(unsigned); return libgamma_method_capabilities__new(this, size, method); @@ -16,6 +16,19 @@ +/* Some functions have been new signatures, the old ones are still + * available at link time */ +#define libgamma_method_capabilities libgamma_method_capabilities__new +#define libgamma_get_crtc_information libgamma_get_crtc_information__new +#define libgamma_crtc_set_gamma_ramps8 libgamma_crtc_set_gamma_ramps8__new +#define libgamma_crtc_set_gamma_ramps16 libgamma_crtc_set_gamma_ramps16__new +#define libgamma_crtc_set_gamma_ramps32 libgamma_crtc_set_gamma_ramps32__new +#define libgamma_crtc_set_gamma_ramps64 libgamma_crtc_set_gamma_ramps64__new +#define libgamma_crtc_set_gamma_rampsf libgamma_crtc_set_gamma_rampsf__new +#define libgamma_crtc_set_gamma_rampsd libgamma_crtc_set_gamma_rampsd__new + + + /** * `errno` has be set with a standard error number * to indicate the what has gone wrong @@ -398,7 +411,7 @@ extern const int libgamma_method_count; /** * Types for connectors */ -typedef enum libgamma_connector_type { +enum libgamma_connector_type { /** * The adjustment method does not know the connector's type * @@ -526,8 +539,7 @@ typedef enum libgamma_connector_type { /* DEVELOPERS: Remember to update LIBGAMMA_CONNECTOR_TYPE_COUNT below * and LIST_CONNECTOR_TYPES in common.h when adding methods */ - -} libgamma_connector_type_t; +}; /** * The number of values defined in `libgamma_connector_type_t` @@ -549,7 +561,7 @@ extern const int libgamma_connector_type_count; * Currently the possible values are very biased * to LCD, Plasma and monochrome monitors */ -typedef enum libgamma_subpixel_order { +enum libgamma_subpixel_order { /** * The adjustment method does not know the order of the subpixels * @@ -584,8 +596,7 @@ typedef enum libgamma_subpixel_order { /* DEVELOPERS: Remember to update LIBGAMMA_SUBPIXEL_ORDER_COUNT below * and LIST_SUBPIXEL_ORDERS in common.h when adding methods */ - -} libgamma_subpixel_order_t; +}; /** * The number of values defined in `libgamma_subpixel_order_t` @@ -604,7 +615,7 @@ extern const int libgamma_subpixel_order_count; /** * Answer enum to a decision problem */ -typedef enum libgamma_decision { +enum libgamma_decision { /** * The answer is negative */ @@ -619,15 +630,14 @@ typedef enum libgamma_decision { * The answer is positive */ LIBGAMMA_YES = 2 - -} libgamma_decision_t; +}; /** * Capabilities of adjustment methods */ -typedef struct libgamma_method_capabilities { +struct libgamma_method_capabilities { /** * OR of the CRTC information fields in `libgamma_crtc_information_t` * that may (but can fail) be read successfully @@ -760,8 +770,7 @@ typedef struct libgamma_method_capabilities { * @since .struct_version==1, replaces .crtc_information__old (previously named .crtc_information) */ unsigned long long crtc_information; - -} libgamma_method_capabilities_t; +}; /** * The number the version of the library the program is @@ -782,7 +791,7 @@ typedef struct libgamma_method_capabilities { * and the BSD:s, there can usually be any (feasible) number of * sites. In X.org parlance they are called displays. */ -typedef struct libgamma_site_state { +struct libgamma_site_state { /** * Adjustment method implementation specific data * @@ -818,8 +827,7 @@ typedef struct libgamma_site_state { * Rendering Manager, a partition is a graphics card. */ size_t partitions_available; - -} libgamma_site_state_t; +}; /** @@ -834,7 +842,7 @@ typedef struct libgamma_site_state { * On hardware-level adjustment methods, such as Direct * Rendering Manager, a partition is a graphics card. */ -typedef struct libgamma_partition_state { +struct libgamma_partition_state { /** * Adjustment method implementation specific data * @@ -845,7 +853,7 @@ typedef struct libgamma_partition_state { /** * The site this partition belongs to */ - libgamma_site_state_t *site; + struct libgamma_site_state *site; /** * The index of the partition @@ -860,8 +868,7 @@ typedef struct libgamma_partition_state { * online */ size_t crtcs_available; - -} libgamma_partition_state_t; +}; /** @@ -871,7 +878,7 @@ typedef struct libgamma_partition_state { * monitor that is plugged in to the connector * that the CRTC belongs to */ -typedef struct libgamma_crtc_state { +struct libgamma_crtc_state { /** * Adjustment method implementation specific data * @@ -882,20 +889,19 @@ typedef struct libgamma_crtc_state { /** * The partition this CRTC belongs to */ - libgamma_partition_state_t *partition; + struct libgamma_partition_state *partition; /** * The index of the CRTC within its partition */ size_t crtc; - -} libgamma_crtc_state_t; +}; /** * Cathode ray tube controller information data structure */ -typedef struct libgamma_crtc_information { +struct libgamma_crtc_information { /** * For a `libgamma_crtc_information_t` fill in the values for @@ -1137,7 +1143,7 @@ typedef struct libgamma_crtc_information { * * @since Always */ - libgamma_decision_t gamma_support; + enum libgamma_decision gamma_support; /** * Zero on success, positive it holds the value `errno` had @@ -1164,7 +1170,7 @@ typedef struct libgamma_crtc_information { * * @since Always */ - libgamma_subpixel_order_t subpixel_order; + enum libgamma_subpixel_order subpixel_order; /** * Zero on success, positive it holds the value `errno` had @@ -1235,7 +1241,7 @@ typedef struct libgamma_crtc_information { * * @since Always */ - libgamma_connector_type_t connector_type; + enum libgamma_connector_type connector_type; /** * Zero on success, positive it holds the value `errno` had @@ -1429,8 +1435,7 @@ typedef struct libgamma_crtc_information { * LIBGAMMA_CRTC_INFO_COUNT, and LIBGAMMA_CRTC_INFO_MACRO_EDID * macros below and may add additional LIBGAMMA_CRTC_INFO_MACRO_* * macros below */ - -} libgamma_crtc_information_t; +}; /** @@ -1515,7 +1520,7 @@ extern const int libgamma_crtc_info_count; /** * Gamma ramp structure for 8-bit gamma ramps */ -typedef struct libgamma_gamma_ramps8 { +struct libgamma_gamma_ramps8 { /** * The size of `red` */ @@ -1545,15 +1550,13 @@ typedef struct libgamma_gamma_ramps8 { * The gamma ramp for the blue channel */ uint8_t *blue; - -} libgamma_gamma_ramps8_t; +}; /** * Gamma ramp structure for 16-bit gamma ramps */ -typedef struct libgamma_gamma_ramps16 -{ +struct libgamma_gamma_ramps16 { /** * The size of `red` */ @@ -1583,15 +1586,13 @@ typedef struct libgamma_gamma_ramps16 * The gamma ramp for the blue channel */ uint16_t *blue; - -} libgamma_gamma_ramps16_t; +}; /** * Gamma ramp structure for 32-bit gamma ramps */ -typedef struct libgamma_gamma_ramps32 -{ +struct libgamma_gamma_ramps32 { /** * The size of `red` */ @@ -1621,15 +1622,13 @@ typedef struct libgamma_gamma_ramps32 * The gamma ramp for the blue channel */ uint32_t *blue; - -} libgamma_gamma_ramps32_t; +}; /** * Gamma ramp structure for 64-bit gamma ramps */ -typedef struct libgamma_gamma_ramps64 -{ +struct libgamma_gamma_ramps64 { /** * The size of `red` */ @@ -1659,15 +1658,13 @@ typedef struct libgamma_gamma_ramps64 * The gamma ramp for the blue channel */ uint64_t *blue; - -} libgamma_gamma_ramps64_t; +}; /** * Gamma ramp structure for `float` gamma ramps */ -typedef struct libgamma_gamma_rampsf -{ +struct libgamma_gamma_rampsf { /** * The size of `red` */ @@ -1697,15 +1694,13 @@ typedef struct libgamma_gamma_rampsf * The gamma ramp for the blue channel */ float *blue; - -} libgamma_gamma_rampsf_t; +}; /** * Gamma ramp structure for `double` gamma ramps */ -typedef struct libgamma_gamma_rampsd -{ +struct libgamma_gamma_rampsd { /** * The size of `red` */ @@ -1735,8 +1730,7 @@ typedef struct libgamma_gamma_rampsd * The gamma ramp for the blue channel */ double *blue; - -} libgamma_gamma_rampsd_t; +}; /** @@ -1961,7 +1955,7 @@ int libgamma_value_of_method(const char *); * recognised (errno is not changed) */ LIBGAMMA_GCC_ONLY__(__attribute__((__warn_unused_result__, __const__))) -const char *libgamma_name_of_connector_type(int); +const char *libgamma_name_of_connector_type(enum libgamma_connector_type); /** * Get the name of the constant for a connector @@ -1973,7 +1967,7 @@ const char *libgamma_name_of_connector_type(int); * `NULL` if not recognised (errno is not changed) */ LIBGAMMA_GCC_ONLY__(__attribute__((__warn_unused_result__, __const__))) -const char *libgamma_const_of_connector_type(int); +const char *libgamma_const_of_connector_type(enum libgamma_connector_type); /** * Get the value of a connector type @@ -1985,7 +1979,7 @@ const char *libgamma_const_of_connector_type(int); * `LIBGAMMA_CONNECTOR_TYPE_NOT_RECOGNISED` of not defined */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__, __access__(__read_only__, 1), __pure__))) -int libgamma_value_of_connector_type(const char *); +int libgamma_value_of_connector_type(const char *); /* FIXME return type */ @@ -2001,7 +1995,7 @@ int libgamma_value_of_connector_type(const char *); * recognised (errno is not changed) */ LIBGAMMA_GCC_ONLY__(__attribute__((__warn_unused_result__, __const__))) -const char *libgamma_name_of_subpixel_order(int); +const char *libgamma_name_of_subpixel_order(enum libgamma_subpixel_order); /** * Get the name of the constant for a subpixel order, @@ -2013,7 +2007,7 @@ const char *libgamma_name_of_subpixel_order(int); * `NULL` if not recognised (errno is not changed) */ LIBGAMMA_GCC_ONLY__(__attribute__((__warn_unused_result__, __const__))) -const char *libgamma_const_of_subpixel_order(int); +const char *libgamma_const_of_subpixel_order(enum libgamma_subpixel_order); /** * Get the value of a subpixel order @@ -2025,7 +2019,7 @@ const char *libgamma_const_of_subpixel_order(int); * `LIBGAMMA_SUBPIXEL_ORDER_NOT_RECOGNISED` of not defined */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__, __access__(__read_only__, 1), __pure__))) -int libgamma_value_of_subpixel_order(const char *); +int libgamma_value_of_subpixel_order(const char *); /* FIXME return type */ @@ -2040,7 +2034,7 @@ int libgamma_value_of_subpixel_order(const char *); * @return Zero on success, -1 on allocation error, `errno` will be set accordingly */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_gamma_ramps8_initialise(libgamma_gamma_ramps8_t *restrict); +int libgamma_gamma_ramps8_initialise(struct libgamma_gamma_ramps8 *restrict); /** * Release resources that are held by a gamma ramp strcuture that @@ -2050,7 +2044,7 @@ int libgamma_gamma_ramps8_initialise(libgamma_gamma_ramps8_t *restrict); * @param this The gamma ramps */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_gamma_ramps8_destroy(libgamma_gamma_ramps8_t *restrict); +void libgamma_gamma_ramps8_destroy(struct libgamma_gamma_ramps8 *restrict); /** * Release resources that are held by a gamma ramp strcuture that @@ -2061,7 +2055,7 @@ void libgamma_gamma_ramps8_destroy(libgamma_gamma_ramps8_t *restrict); * @param this The gamma ramps */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_gamma_ramps8_free(libgamma_gamma_ramps8_t *restrict); +void libgamma_gamma_ramps8_free(struct libgamma_gamma_ramps8 *restrict); /** @@ -2075,7 +2069,7 @@ void libgamma_gamma_ramps8_free(libgamma_gamma_ramps8_t *restrict); * @return Zero on success, -1 on allocation error, `errno` will be set accordingly */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_gamma_ramps16_initialise(libgamma_gamma_ramps16_t *restrict); +int libgamma_gamma_ramps16_initialise(struct libgamma_gamma_ramps16 *restrict); /** * Release resources that are held by a gamma ramp strcuture that @@ -2085,7 +2079,7 @@ int libgamma_gamma_ramps16_initialise(libgamma_gamma_ramps16_t *restrict); * @param this The gamma ramps */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_gamma_ramps16_destroy(libgamma_gamma_ramps16_t *restrict); +void libgamma_gamma_ramps16_destroy(struct libgamma_gamma_ramps16 *restrict); /** * Release resources that are held by a gamma ramp strcuture that @@ -2096,7 +2090,7 @@ void libgamma_gamma_ramps16_destroy(libgamma_gamma_ramps16_t *restrict); * @param this The gamma ramps */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_gamma_ramps16_free(libgamma_gamma_ramps16_t *restrict); +void libgamma_gamma_ramps16_free(struct libgamma_gamma_ramps16 *restrict); /** @@ -2110,7 +2104,7 @@ void libgamma_gamma_ramps16_free(libgamma_gamma_ramps16_t *restrict); * @return Zero on success, -1 on allocation error, `errno` will be set accordingly */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_gamma_ramps32_initialise(libgamma_gamma_ramps32_t *restrict); +int libgamma_gamma_ramps32_initialise(struct libgamma_gamma_ramps32 *restrict); /** * Release resources that are held by a gamma ramp strcuture that @@ -2120,7 +2114,7 @@ int libgamma_gamma_ramps32_initialise(libgamma_gamma_ramps32_t *restrict); * @param this The gamma ramps */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_gamma_ramps32_destroy(libgamma_gamma_ramps32_t *restrict); +void libgamma_gamma_ramps32_destroy(struct libgamma_gamma_ramps32 *restrict); /** * Release resources that are held by a gamma ramp strcuture that @@ -2131,7 +2125,7 @@ void libgamma_gamma_ramps32_destroy(libgamma_gamma_ramps32_t *restrict); * @param this The gamma ramps */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_gamma_ramps32_free(libgamma_gamma_ramps32_t *restrict); +void libgamma_gamma_ramps32_free(struct libgamma_gamma_ramps32 *restrict); /** @@ -2145,7 +2139,7 @@ void libgamma_gamma_ramps32_free(libgamma_gamma_ramps32_t *restrict); * @return Zero on success, -1 on allocation error, `errno` will be set accordingly */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_gamma_ramps64_initialise(libgamma_gamma_ramps64_t *restrict); +int libgamma_gamma_ramps64_initialise(struct libgamma_gamma_ramps64 *restrict); /** * Release resources that are held by a gamma ramp strcuture that @@ -2155,7 +2149,7 @@ int libgamma_gamma_ramps64_initialise(libgamma_gamma_ramps64_t *restrict); * @param this The gamma ramps */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_gamma_ramps64_destroy(libgamma_gamma_ramps64_t *restrict); +void libgamma_gamma_ramps64_destroy(struct libgamma_gamma_ramps64 *restrict); /** * Release resources that are held by a gamma ramp strcuture that @@ -2166,7 +2160,7 @@ void libgamma_gamma_ramps64_destroy(libgamma_gamma_ramps64_t *restrict); * @param this The gamma ramps */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_gamma_ramps64_free(libgamma_gamma_ramps64_t *restrict); +void libgamma_gamma_ramps64_free(struct libgamma_gamma_ramps64 *restrict); /** @@ -2180,7 +2174,7 @@ void libgamma_gamma_ramps64_free(libgamma_gamma_ramps64_t *restrict); * @return Zero on success, -1 on allocation error, `errno` will be set accordingly */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_gamma_rampsf_initialise(libgamma_gamma_rampsf_t *restrict); +int libgamma_gamma_rampsf_initialise(struct libgamma_gamma_rampsf *restrict); /** * Release resources that are held by a gamma ramp strcuture that @@ -2190,7 +2184,7 @@ int libgamma_gamma_rampsf_initialise(libgamma_gamma_rampsf_t *restrict); * @param this The gamma ramps */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_gamma_rampsf_destroy(libgamma_gamma_rampsf_t *restrict); +void libgamma_gamma_rampsf_destroy(struct libgamma_gamma_rampsf *restrict); /** * Release resources that are held by a gamma ramp strcuture that @@ -2201,7 +2195,7 @@ void libgamma_gamma_rampsf_destroy(libgamma_gamma_rampsf_t *restrict); * @param this The gamma ramps */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_gamma_rampsf_free(libgamma_gamma_rampsf_t *restrict); +void libgamma_gamma_rampsf_free(struct libgamma_gamma_rampsf *restrict); /** @@ -2215,7 +2209,7 @@ void libgamma_gamma_rampsf_free(libgamma_gamma_rampsf_t *restrict); * @return Zero on success, -1 on allocation error, `errno` will be set accordingly */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_gamma_rampsd_initialise(libgamma_gamma_rampsd_t *restrict); +int libgamma_gamma_rampsd_initialise(struct libgamma_gamma_rampsd *restrict); /** * Release resources that are held by a gamma ramp strcuture that @@ -2225,7 +2219,7 @@ int libgamma_gamma_rampsd_initialise(libgamma_gamma_rampsd_t *restrict); * @param this The gamma ramps */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_gamma_rampsd_destroy(libgamma_gamma_rampsd_t *restrict); +void libgamma_gamma_rampsd_destroy(struct libgamma_gamma_rampsd *restrict); /** * Release resources that are held by a gamma ramp strcuture that @@ -2236,7 +2230,7 @@ void libgamma_gamma_rampsd_destroy(libgamma_gamma_rampsd_t *restrict); * @param this The gamma ramps */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_gamma_rampsd_free(libgamma_gamma_rampsd_t *restrict); +void libgamma_gamma_rampsd_free(struct libgamma_gamma_rampsd *restrict); @@ -2271,8 +2265,7 @@ size_t libgamma_list_methods(int *restrict, size_t, int); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__access__(__write_only__, 1)))) -int libgamma_method_capabilities__new(libgamma_method_capabilities_t *restrict, size_t, int); -#define libgamma_method_capabilities libgamma_method_capabilities__new +int libgamma_method_capabilities(struct libgamma_method_capabilities *restrict, size_t, int); /** * Return the default site for an adjustment method @@ -2314,7 +2307,7 @@ const char *libgamma_method_default_site_variable(int); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__(1)))) -int libgamma_site_initialise(libgamma_site_state_t *restrict, int, char *restrict); +int libgamma_site_initialise(struct libgamma_site_state *restrict, int, char *restrict); /** * Release all resources held by a site state @@ -2322,7 +2315,7 @@ int libgamma_site_initialise(libgamma_site_state_t *restrict, int, char *restric * @param this The site state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_site_destroy(libgamma_site_state_t *restrict); +void libgamma_site_destroy(struct libgamma_site_state *restrict); /** * Release all resources held by a site state @@ -2332,7 +2325,7 @@ void libgamma_site_destroy(libgamma_site_state_t *restrict); */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) inline void -libgamma_site_free(libgamma_site_state_t *restrict this__) +libgamma_site_free(struct libgamma_site_state *restrict this__) { libgamma_site_destroy(this__); free(this__); @@ -2346,7 +2339,7 @@ libgamma_site_free(libgamma_site_state_t *restrict this__) * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_site_restore(libgamma_site_state_t *restrict); +int libgamma_site_restore(struct libgamma_site_state *restrict); @@ -2360,7 +2353,7 @@ int libgamma_site_restore(libgamma_site_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_partition_initialise(libgamma_partition_state_t *restrict, libgamma_site_state_t *restrict, size_t); +int libgamma_partition_initialise(struct libgamma_partition_state *restrict, struct libgamma_site_state *restrict, size_t); /** * Release all resources held by a partition state @@ -2368,7 +2361,7 @@ int libgamma_partition_initialise(libgamma_partition_state_t *restrict, libgamma * @param this The partition state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_partition_destroy(libgamma_partition_state_t *restrict); +void libgamma_partition_destroy(struct libgamma_partition_state *restrict); /** * Release all resources held by a partition state @@ -2378,7 +2371,7 @@ void libgamma_partition_destroy(libgamma_partition_state_t *restrict); */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) inline void -libgamma_partition_free(libgamma_partition_state_t *restrict this__) +libgamma_partition_free(struct libgamma_partition_state *restrict this__) { libgamma_partition_destroy(this__); free(this__); @@ -2392,7 +2385,7 @@ libgamma_partition_free(libgamma_partition_state_t *restrict this__) * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_partition_restore(libgamma_partition_state_t *restrict); +int libgamma_partition_restore(struct libgamma_partition_state *restrict); @@ -2406,7 +2399,7 @@ int libgamma_partition_restore(libgamma_partition_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma_partition_state_t *restrict, size_t); +int libgamma_crtc_initialise(struct libgamma_crtc_state *restrict, struct libgamma_partition_state *restrict, size_t); /** * Release all resources held by a CRTC state @@ -2414,7 +2407,7 @@ int libgamma_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma_partition * @param this The CRTC state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_crtc_destroy(libgamma_crtc_state_t *restrict); +void libgamma_crtc_destroy(struct libgamma_crtc_state *restrict); /** * Release all resources held by a CRTC state @@ -2424,7 +2417,7 @@ void libgamma_crtc_destroy(libgamma_crtc_state_t *restrict); */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) inline void -libgamma_crtc_free(libgamma_crtc_state_t *restrict this__) +libgamma_crtc_free(struct libgamma_crtc_state *restrict this__) { libgamma_crtc_destroy(this__); free(this__); @@ -2438,7 +2431,7 @@ libgamma_crtc_free(libgamma_crtc_state_t *restrict this__) * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_crtc_restore(libgamma_crtc_state_t *restrict); +int libgamma_crtc_restore(struct libgamma_crtc_state *restrict); /** @@ -2452,9 +2445,8 @@ int libgamma_crtc_restore(libgamma_crtc_state_t *restrict); * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__write_only__, 1)))) -int libgamma_get_crtc_information__new(libgamma_crtc_information_t *restrict, size_t, - libgamma_crtc_state_t *restrict, unsigned long long); -#define libgamma_get_crtc_information libgamma_get_crtc_information__new +int libgamma_get_crtc_information(struct libgamma_crtc_information *restrict, size_t, + struct libgamma_crtc_state *restrict, unsigned long long); /** * Release all resources in an information data structure for a CRTC @@ -2462,7 +2454,7 @@ int libgamma_get_crtc_information__new(libgamma_crtc_information_t *restrict, si * @param this The CRTC information */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_crtc_information_destroy(libgamma_crtc_information_t *restrict); +void libgamma_crtc_information_destroy(struct libgamma_crtc_information *restrict); /** * Release all resources in an information data structure for a CRTC @@ -2472,7 +2464,7 @@ void libgamma_crtc_information_destroy(libgamma_crtc_information_t *restrict); */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) inline void -libgamma_crtc_information_free(libgamma_crtc_information_t *restrict this__) +libgamma_crtc_information_free(struct libgamma_crtc_information *restrict this__) { libgamma_crtc_information_destroy(this__); free(this__); @@ -2538,7 +2530,7 @@ unsigned char *libgamma_unhex_edid(const char *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 2)))) -int libgamma_crtc_get_gamma_ramps8(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps8_t *restrict); +int libgamma_crtc_get_gamma_ramps8(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps8 *restrict); /** * Set the gamma ramps for a CRTC, 8-bit gamma-depth version. @@ -2549,8 +2541,7 @@ int libgamma_crtc_get_gamma_ramps8(libgamma_crtc_state_t *restrict, libgamma_gam * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 2)))) -int libgamma_crtc_set_gamma_ramps8__new(libgamma_crtc_state_t *restrict, const libgamma_gamma_ramps8_t *restrict); -#define libgamma_crtc_set_gamma_ramps8 libgamma_crtc_set_gamma_ramps8__new +int libgamma_crtc_set_gamma_ramps8(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_ramps8 *restrict); /** @@ -2566,7 +2557,7 @@ int libgamma_crtc_set_gamma_ramps8__new(libgamma_crtc_state_t *restrict, const l * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_crtc_set_gamma_ramps8_f(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps8_fun *, +int libgamma_crtc_set_gamma_ramps8_f(struct libgamma_crtc_state *restrict, libgamma_gamma_ramps8_fun *, libgamma_gamma_ramps8_fun *, libgamma_gamma_ramps8_fun *); @@ -2579,7 +2570,7 @@ int libgamma_crtc_set_gamma_ramps8_f(libgamma_crtc_state_t *restrict, libgamma_g * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __hot__, __access__(__read_only__, 2)))) -int libgamma_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps16_t *restrict); +int libgamma_crtc_get_gamma_ramps16(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps16 *restrict); /** * Set the gamma ramps for a CRTC, 16-bit gamma-depth version @@ -2590,8 +2581,7 @@ int libgamma_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict, libgamma_ga * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __hot__, __access__(__read_only__, 2)))) -int libgamma_crtc_set_gamma_ramps16__new(libgamma_crtc_state_t *restrict, const libgamma_gamma_ramps16_t *restrict); -#define libgamma_crtc_set_gamma_ramps16 libgamma_crtc_set_gamma_ramps16__new +int libgamma_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_ramps16 *restrict); /** * Set the gamma ramps for a CRTC, 16-bit gamma-depth function version @@ -2606,7 +2596,7 @@ int libgamma_crtc_set_gamma_ramps16__new(libgamma_crtc_state_t *restrict, const * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __hot__))) -int libgamma_crtc_set_gamma_ramps16_f(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps16_fun *, +int libgamma_crtc_set_gamma_ramps16_f(struct libgamma_crtc_state *restrict, libgamma_gamma_ramps16_fun *, libgamma_gamma_ramps16_fun *, libgamma_gamma_ramps16_fun *); @@ -2619,7 +2609,7 @@ int libgamma_crtc_set_gamma_ramps16_f(libgamma_crtc_state_t *restrict, libgamma_ * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 2)))) -int libgamma_crtc_get_gamma_ramps32(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps32_t *restrict); +int libgamma_crtc_get_gamma_ramps32(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps32 *restrict); /** * Set the gamma ramps for a CRTC, 32-bit gamma-depth version @@ -2630,8 +2620,7 @@ int libgamma_crtc_get_gamma_ramps32(libgamma_crtc_state_t *restrict, libgamma_ga * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 2)))) -int libgamma_crtc_set_gamma_ramps32__new(libgamma_crtc_state_t *restrict, const libgamma_gamma_ramps32_t *restrict); -#define libgamma_crtc_set_gamma_ramps32 libgamma_crtc_set_gamma_ramps32__new +int libgamma_crtc_set_gamma_ramps32(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_ramps32 *restrict); /** * Set the gamma ramps for a CRTC, 32-bit gamma-depth function version @@ -2646,7 +2635,7 @@ int libgamma_crtc_set_gamma_ramps32__new(libgamma_crtc_state_t *restrict, const * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_crtc_set_gamma_ramps32_f(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps32_fun *, +int libgamma_crtc_set_gamma_ramps32_f(struct libgamma_crtc_state *restrict, libgamma_gamma_ramps32_fun *, libgamma_gamma_ramps32_fun *, libgamma_gamma_ramps32_fun *); @@ -2659,7 +2648,7 @@ int libgamma_crtc_set_gamma_ramps32_f(libgamma_crtc_state_t *restrict, libgamma_ * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 2)))) -int libgamma_crtc_get_gamma_ramps64(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps64_t *restrict); +int libgamma_crtc_get_gamma_ramps64(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps64 *restrict); /** * Set the gamma ramps for a CRTC, 64-bit gamma-depth version @@ -2670,8 +2659,7 @@ int libgamma_crtc_get_gamma_ramps64(libgamma_crtc_state_t *restrict, libgamma_ga * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 2)))) -int libgamma_crtc_set_gamma_ramps64__new(libgamma_crtc_state_t *restrict, const libgamma_gamma_ramps64_t *restrict); -#define libgamma_crtc_set_gamma_ramps64 libgamma_crtc_set_gamma_ramps64__new +int libgamma_crtc_set_gamma_ramps64(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_ramps64 *restrict); /** * Set the gamma ramps for a CRTC, 64-bit gamma-depth function version @@ -2686,7 +2674,7 @@ int libgamma_crtc_set_gamma_ramps64__new(libgamma_crtc_state_t *restrict, const * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_crtc_set_gamma_ramps64_f(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps64_fun *, +int libgamma_crtc_set_gamma_ramps64_f(struct libgamma_crtc_state *restrict, libgamma_gamma_ramps64_fun *, libgamma_gamma_ramps64_fun *, libgamma_gamma_ramps64_fun *); @@ -2699,7 +2687,7 @@ int libgamma_crtc_set_gamma_ramps64_f(libgamma_crtc_state_t *restrict, libgamma_ * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 2)))) -int libgamma_crtc_get_gamma_rampsf(libgamma_crtc_state_t *restrict, libgamma_gamma_rampsf_t *restrict); +int libgamma_crtc_get_gamma_rampsf(struct libgamma_crtc_state *restrict, struct libgamma_gamma_rampsf *restrict); /** * Set the gamma ramps for a CRTC, `float` version @@ -2710,8 +2698,7 @@ int libgamma_crtc_get_gamma_rampsf(libgamma_crtc_state_t *restrict, libgamma_gam * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 2)))) -int libgamma_crtc_set_gamma_rampsf__new(libgamma_crtc_state_t *restrict, const libgamma_gamma_rampsf_t *restrict); -#define libgamma_crtc_set_gamma_rampsf libgamma_crtc_set_gamma_rampsf__new +int libgamma_crtc_set_gamma_rampsf(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_rampsf *restrict); /** * Set the gamma ramps for a CRTC, `float` function version @@ -2726,7 +2713,7 @@ int libgamma_crtc_set_gamma_rampsf__new(libgamma_crtc_state_t *restrict, const l * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_crtc_set_gamma_rampsf_f(libgamma_crtc_state_t *restrict, libgamma_gamma_rampsf_fun *, +int libgamma_crtc_set_gamma_rampsf_f(struct libgamma_crtc_state *restrict, libgamma_gamma_rampsf_fun *, libgamma_gamma_rampsf_fun *, libgamma_gamma_rampsf_fun *); @@ -2739,7 +2726,7 @@ int libgamma_crtc_set_gamma_rampsf_f(libgamma_crtc_state_t *restrict, libgamma_g * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 2)))) -int libgamma_crtc_get_gamma_rampsd(libgamma_crtc_state_t *restrict, libgamma_gamma_rampsd_t *restrict); +int libgamma_crtc_get_gamma_rampsd(struct libgamma_crtc_state *restrict, struct libgamma_gamma_rampsd *restrict); /** * Set the gamma ramps for a CRTC, `double` version @@ -2750,8 +2737,7 @@ int libgamma_crtc_get_gamma_rampsd(libgamma_crtc_state_t *restrict, libgamma_gam * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 2)))) -int libgamma_crtc_set_gamma_rampsd__new(libgamma_crtc_state_t *restrict, const libgamma_gamma_rampsd_t *restrict); -#define libgamma_crtc_set_gamma_rampsd libgamma_crtc_set_gamma_rampsd__new +int libgamma_crtc_set_gamma_rampsd(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_rampsd *restrict); /** * Set the gamma ramps for a CRTC, `double` function version @@ -2766,8 +2752,31 @@ int libgamma_crtc_set_gamma_rampsd__new(libgamma_crtc_state_t *restrict, const l * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -int libgamma_crtc_set_gamma_rampsd_f(libgamma_crtc_state_t *restrict, libgamma_gamma_rampsd_fun *, +int libgamma_crtc_set_gamma_rampsd_f(struct libgamma_crtc_state *restrict, libgamma_gamma_rampsd_fun *, libgamma_gamma_rampsd_fun *, libgamma_gamma_rampsd_fun *); + +#define LIBGAMMA_TYPEDEF__(T, N)\ + LIBGAMMA_GCC_ONLY__(__attribute__((__deprecated__("Use "#T" "#N" instead of "#N"_t"))))\ + typedef T N N##_t + +LIBGAMMA_TYPEDEF__(enum, libgamma_connector_type); +LIBGAMMA_TYPEDEF__(enum, libgamma_subpixel_order); +LIBGAMMA_TYPEDEF__(enum, libgamma_decision); +LIBGAMMA_TYPEDEF__(struct, libgamma_method_capabilities); +LIBGAMMA_TYPEDEF__(struct, libgamma_site_state); +LIBGAMMA_TYPEDEF__(struct, libgamma_partition_state); +LIBGAMMA_TYPEDEF__(struct, libgamma_crtc_state); +LIBGAMMA_TYPEDEF__(struct, libgamma_crtc_information); +LIBGAMMA_TYPEDEF__(struct, libgamma_gamma_ramps8); +LIBGAMMA_TYPEDEF__(struct, libgamma_gamma_ramps16); +LIBGAMMA_TYPEDEF__(struct, libgamma_gamma_ramps32); +LIBGAMMA_TYPEDEF__(struct, libgamma_gamma_ramps64); +LIBGAMMA_TYPEDEF__(struct, libgamma_gamma_rampsf); +LIBGAMMA_TYPEDEF__(struct, libgamma_gamma_rampsd); + +#undef LIBGAMMA_TYPEDEF__ + + #endif diff --git a/libgamma_const_of_connector_type.c b/libgamma_const_of_connector_type.c index 5958953..31bd3cc 100644 --- a/libgamma_const_of_connector_type.c +++ b/libgamma_const_of_connector_type.c @@ -12,9 +12,9 @@ * `NULL` if not recognised (errno is not changed) */ const char * -libgamma_const_of_connector_type(int connector) +libgamma_const_of_connector_type(enum libgamma_connector_type connector) { - switch (connector) { + switch ((int)connector) { #define X(CONST, ...)\ case CONST:\ return #CONST; diff --git a/libgamma_const_of_subpixel_order.c b/libgamma_const_of_subpixel_order.c index b320e9d..9cf285c 100644 --- a/libgamma_const_of_subpixel_order.c +++ b/libgamma_const_of_subpixel_order.c @@ -12,9 +12,9 @@ * `NULL` if not recognised (errno is not changed) */ const char * -libgamma_const_of_subpixel_order(int order) +libgamma_const_of_subpixel_order(enum libgamma_subpixel_order order) { - switch (order) { + switch ((int)order) { #define X(CONST, ...)\ case CONST:\ return #CONST; diff --git a/libgamma_crtc_destroy.c b/libgamma_crtc_destroy.c index 61cfe58..d506498 100644 --- a/libgamma_crtc_destroy.c +++ b/libgamma_crtc_destroy.c @@ -8,7 +8,7 @@ * @param this The CRTC state */ void -libgamma_crtc_destroy(libgamma_crtc_state_t *restrict this) +libgamma_crtc_destroy(struct libgamma_crtc_state *restrict this) { switch (this->partition->site->method) { #define X(CONST, CNAME, ...)\ diff --git a/libgamma_crtc_free.c b/libgamma_crtc_free.c index 986fd96..f7972e0 100644 --- a/libgamma_crtc_free.c +++ b/libgamma_crtc_free.c @@ -8,4 +8,4 @@ * * @param this The CRTC state */ -extern inline void libgamma_crtc_free(libgamma_crtc_state_t *restrict); +extern inline void libgamma_crtc_free(struct libgamma_crtc_state *restrict); diff --git a/libgamma_crtc_get_gamma_ramps16.c b/libgamma_crtc_get_gamma_ramps16.c index cb4759b..0c87298 100644 --- a/libgamma_crtc_get_gamma_ramps16.c +++ b/libgamma_crtc_get_gamma_ramps16.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps16_t* restrict ramps) +libgamma_crtc_get_gamma_ramps16(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps16 *restrict ramps) { #define DEPTH 16 #define TYPE bits16 diff --git a/libgamma_crtc_get_gamma_ramps32.c b/libgamma_crtc_get_gamma_ramps32.c index bd0658d..3fc167f 100644 --- a/libgamma_crtc_get_gamma_ramps32.c +++ b/libgamma_crtc_get_gamma_ramps32.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_crtc_get_gamma_ramps32(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps32_t* restrict ramps) +libgamma_crtc_get_gamma_ramps32(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps32 *restrict ramps) { #define DEPTH 32 #define TYPE bits32 diff --git a/libgamma_crtc_get_gamma_ramps64.c b/libgamma_crtc_get_gamma_ramps64.c index f49b757..f00006c 100644 --- a/libgamma_crtc_get_gamma_ramps64.c +++ b/libgamma_crtc_get_gamma_ramps64.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_crtc_get_gamma_ramps64(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps64_t* restrict ramps) +libgamma_crtc_get_gamma_ramps64(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps64 *restrict ramps) { #define DEPTH 64 #define TYPE bits64 diff --git a/libgamma_crtc_get_gamma_ramps8.c b/libgamma_crtc_get_gamma_ramps8.c index 598603a..9fd587f 100644 --- a/libgamma_crtc_get_gamma_ramps8.c +++ b/libgamma_crtc_get_gamma_ramps8.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_crtc_get_gamma_ramps8(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps8_t* restrict ramps) +libgamma_crtc_get_gamma_ramps8(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps8 *restrict ramps) { #define DEPTH 8 #define TYPE bits8 diff --git a/libgamma_crtc_get_gamma_rampsd.c b/libgamma_crtc_get_gamma_rampsd.c index ccee0c3..07cceaf 100644 --- a/libgamma_crtc_get_gamma_rampsd.c +++ b/libgamma_crtc_get_gamma_rampsd.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_crtc_get_gamma_rampsd(libgamma_crtc_state_t *restrict this, libgamma_gamma_rampsd_t* restrict ramps) +libgamma_crtc_get_gamma_rampsd(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_rampsd *restrict ramps) { #define DEPTH -2 #define TYPE float_double diff --git a/libgamma_crtc_get_gamma_rampsf.c b/libgamma_crtc_get_gamma_rampsf.c index 2496e40..af21775 100644 --- a/libgamma_crtc_get_gamma_rampsf.c +++ b/libgamma_crtc_get_gamma_rampsf.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_crtc_get_gamma_rampsf(libgamma_crtc_state_t *restrict this, libgamma_gamma_rampsf_t* restrict ramps) +libgamma_crtc_get_gamma_rampsf(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_rampsf *restrict ramps) { #define DEPTH -1 #define TYPE float_single diff --git a/libgamma_crtc_information_destroy.c b/libgamma_crtc_information_destroy.c index 0789451..2b89ec9 100644 --- a/libgamma_crtc_information_destroy.c +++ b/libgamma_crtc_information_destroy.c @@ -8,7 +8,7 @@ * @param this The CRTC information */ void -libgamma_crtc_information_destroy(libgamma_crtc_information_t *restrict this) +libgamma_crtc_information_destroy(struct libgamma_crtc_information *restrict this) { free(this->edid); free(this->connector_name); diff --git a/libgamma_crtc_information_free.c b/libgamma_crtc_information_free.c index 84048f4..3fbd050 100644 --- a/libgamma_crtc_information_free.c +++ b/libgamma_crtc_information_free.c @@ -8,4 +8,4 @@ * * @param this The CRTC information */ -extern inline void libgamma_crtc_information_free(libgamma_crtc_information_t *restrict); +extern inline void libgamma_crtc_information_free(struct libgamma_crtc_information *restrict); diff --git a/libgamma_crtc_initialise.c b/libgamma_crtc_initialise.c index 92d6960..e276192 100644 --- a/libgamma_crtc_initialise.c +++ b/libgamma_crtc_initialise.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_crtc_initialise(libgamma_crtc_state_t *restrict this, libgamma_partition_state_t *restrict partition, size_t crtc) +libgamma_crtc_initialise(struct libgamma_crtc_state *restrict this, struct libgamma_partition_state *restrict partition, size_t crtc) { this->partition = partition; this->crtc = crtc; diff --git a/libgamma_crtc_restore.c b/libgamma_crtc_restore.c index d6a97c8..c680345 100644 --- a/libgamma_crtc_restore.c +++ b/libgamma_crtc_restore.c @@ -10,7 +10,7 @@ * error identifier provided by this library */ int -libgamma_crtc_restore(libgamma_crtc_state_t *restrict this) +libgamma_crtc_restore(struct libgamma_crtc_state *restrict this) { switch (this->partition->site->method) { #define X(CONST, CNAME, ...)\ diff --git a/libgamma_crtc_set_gamma_ramps16.c b/libgamma_crtc_set_gamma_ramps16.c index 9e4da01..a4cf562 100644 --- a/libgamma_crtc_set_gamma_ramps16.c +++ b/libgamma_crtc_set_gamma_ramps16.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict this, const libgamma_gamma_ramps16_t *restrict ramps) +libgamma_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_ramps16 *restrict ramps) { #define DEPTH 16 #define TYPE bits16 diff --git a/libgamma_crtc_set_gamma_ramps16_f.c b/libgamma_crtc_set_gamma_ramps16_f.c index dfb17e7..a4275d1 100644 --- a/libgamma_crtc_set_gamma_ramps16_f.c +++ b/libgamma_crtc_set_gamma_ramps16_f.c @@ -15,8 +15,8 @@ * error identifier provided by this library */ int -libgamma_crtc_set_gamma_ramps16_f(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps16_fun *red_function, - libgamma_gamma_ramps16_fun *green_function, libgamma_gamma_ramps16_fun *blue_function) +libgamma_crtc_set_gamma_ramps16_f(struct libgamma_crtc_state *restrict this, libgamma_gamma_ramps16_fun *red_function, + libgamma_gamma_ramps16_fun *green_function, libgamma_gamma_ramps16_fun *blue_function) { #define TYPE uint16_t #define APPEND_RAMPS(X) X##ramps16 diff --git a/libgamma_crtc_set_gamma_ramps32.c b/libgamma_crtc_set_gamma_ramps32.c index bc8235a..3c78675 100644 --- a/libgamma_crtc_set_gamma_ramps32.c +++ b/libgamma_crtc_set_gamma_ramps32.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_crtc_set_gamma_ramps32(libgamma_crtc_state_t *restrict this, const libgamma_gamma_ramps32_t *restrict ramps) +libgamma_crtc_set_gamma_ramps32(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_ramps32 *restrict ramps) { #define DEPTH 32 #define TYPE bits32 diff --git a/libgamma_crtc_set_gamma_ramps32_f.c b/libgamma_crtc_set_gamma_ramps32_f.c index ddd304a..101a9c7 100644 --- a/libgamma_crtc_set_gamma_ramps32_f.c +++ b/libgamma_crtc_set_gamma_ramps32_f.c @@ -15,8 +15,8 @@ * error identifier provided by this library */ int -libgamma_crtc_set_gamma_ramps32_f(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps32_fun *red_function, - libgamma_gamma_ramps32_fun *green_function, libgamma_gamma_ramps32_fun *blue_function) +libgamma_crtc_set_gamma_ramps32_f(struct libgamma_crtc_state *restrict this, libgamma_gamma_ramps32_fun *red_function, + libgamma_gamma_ramps32_fun *green_function, libgamma_gamma_ramps32_fun *blue_function) { #define TYPE uint32_t #define APPEND_RAMPS(X) X##ramps32 diff --git a/libgamma_crtc_set_gamma_ramps64.c b/libgamma_crtc_set_gamma_ramps64.c index a65ff72..fa5c02d 100644 --- a/libgamma_crtc_set_gamma_ramps64.c +++ b/libgamma_crtc_set_gamma_ramps64.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_crtc_set_gamma_ramps64(libgamma_crtc_state_t *restrict this, const libgamma_gamma_ramps64_t *restrict ramps) +libgamma_crtc_set_gamma_ramps64(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_ramps64 *restrict ramps) { #define DEPTH 64 #define TYPE bits64 diff --git a/libgamma_crtc_set_gamma_ramps64_f.c b/libgamma_crtc_set_gamma_ramps64_f.c index 2d65e12..25ffb9b 100644 --- a/libgamma_crtc_set_gamma_ramps64_f.c +++ b/libgamma_crtc_set_gamma_ramps64_f.c @@ -15,8 +15,8 @@ * error identifier provided by this library */ int -libgamma_crtc_set_gamma_ramps64_f(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps64_fun *red_function, - libgamma_gamma_ramps64_fun *green_function, libgamma_gamma_ramps64_fun *blue_function) +libgamma_crtc_set_gamma_ramps64_f(struct libgamma_crtc_state *restrict this, libgamma_gamma_ramps64_fun *red_function, + libgamma_gamma_ramps64_fun *green_function, libgamma_gamma_ramps64_fun *blue_function) { #define TYPE uint64_t #define APPEND_RAMPS(X) X##ramps64 diff --git a/libgamma_crtc_set_gamma_ramps8.c b/libgamma_crtc_set_gamma_ramps8.c index a419455..c59d3cf 100644 --- a/libgamma_crtc_set_gamma_ramps8.c +++ b/libgamma_crtc_set_gamma_ramps8.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_crtc_set_gamma_ramps8(libgamma_crtc_state_t *restrict this, const libgamma_gamma_ramps8_t *restrict ramps) +libgamma_crtc_set_gamma_ramps8(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_ramps8 *restrict ramps) { #define DEPTH 8 #define TYPE bits8 diff --git a/libgamma_crtc_set_gamma_ramps8_f.c b/libgamma_crtc_set_gamma_ramps8_f.c index 054a45c..9f1c5d9 100644 --- a/libgamma_crtc_set_gamma_ramps8_f.c +++ b/libgamma_crtc_set_gamma_ramps8_f.c @@ -15,7 +15,7 @@ * error identifier provided by this library */ int -libgamma_crtc_set_gamma_ramps8_f(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps8_fun *red_function, +libgamma_crtc_set_gamma_ramps8_f(struct libgamma_crtc_state *restrict this, libgamma_gamma_ramps8_fun *red_function, libgamma_gamma_ramps8_fun *green_function, libgamma_gamma_ramps8_fun *blue_function) { #define TYPE uint8_t diff --git a/libgamma_crtc_set_gamma_rampsd.c b/libgamma_crtc_set_gamma_rampsd.c index 5ecc234..28b3efc 100644 --- a/libgamma_crtc_set_gamma_rampsd.c +++ b/libgamma_crtc_set_gamma_rampsd.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_crtc_set_gamma_rampsd(libgamma_crtc_state_t *restrict this, const libgamma_gamma_rampsd_t *restrict ramps) +libgamma_crtc_set_gamma_rampsd(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_rampsd *restrict ramps) { #define DEPTH -2 #define TYPE float_double diff --git a/libgamma_crtc_set_gamma_rampsd_f.c b/libgamma_crtc_set_gamma_rampsd_f.c index e00da5f..719f705 100644 --- a/libgamma_crtc_set_gamma_rampsd_f.c +++ b/libgamma_crtc_set_gamma_rampsd_f.c @@ -15,7 +15,7 @@ * error identifier provided by this library */ int -libgamma_crtc_set_gamma_rampsd_f(libgamma_crtc_state_t *restrict this, libgamma_gamma_rampsd_fun *red_function, +libgamma_crtc_set_gamma_rampsd_f(struct libgamma_crtc_state *restrict this, libgamma_gamma_rampsd_fun *red_function, libgamma_gamma_rampsd_fun *green_function, libgamma_gamma_rampsd_fun *blue_function) { #define TYPE double diff --git a/libgamma_crtc_set_gamma_rampsf.c b/libgamma_crtc_set_gamma_rampsf.c index 15f4a39..78c3156 100644 --- a/libgamma_crtc_set_gamma_rampsf.c +++ b/libgamma_crtc_set_gamma_rampsf.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_crtc_set_gamma_rampsf(libgamma_crtc_state_t *restrict this, const libgamma_gamma_rampsf_t *restrict ramps) +libgamma_crtc_set_gamma_rampsf(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_rampsf *restrict ramps) { #define DEPTH -1 #define TYPE float_single diff --git a/libgamma_crtc_set_gamma_rampsf_f.c b/libgamma_crtc_set_gamma_rampsf_f.c index da4db21..140bced 100644 --- a/libgamma_crtc_set_gamma_rampsf_f.c +++ b/libgamma_crtc_set_gamma_rampsf_f.c @@ -15,7 +15,7 @@ * error identifier provided by this library */ int -libgamma_crtc_set_gamma_rampsf_f(libgamma_crtc_state_t *restrict this, libgamma_gamma_rampsf_fun *red_function, +libgamma_crtc_set_gamma_rampsf_f(struct libgamma_crtc_state *restrict this, libgamma_gamma_rampsf_fun *red_function, libgamma_gamma_rampsf_fun *green_function, libgamma_gamma_rampsf_fun *blue_function) { #define TYPE float diff --git a/libgamma_dummy_crtc_destroy.c b/libgamma_dummy_crtc_destroy.c index b79fb98..935c12b 100644 --- a/libgamma_dummy_crtc_destroy.c +++ b/libgamma_dummy_crtc_destroy.c @@ -9,9 +9,9 @@ * @param this The CRTC state */ void -libgamma_dummy_crtc_destroy(libgamma_crtc_state_t *restrict this) +libgamma_dummy_crtc_destroy(struct libgamma_crtc_state *restrict this) { - libgamma_dummy_crtc_t *data = this->data; + struct libgamma_dummy_crtc *data = this->data; if (data) { free(data->gamma_red); data->gamma_red = NULL; diff --git a/libgamma_dummy_crtc_get_gamma_ramps16.c b/libgamma_dummy_crtc_get_gamma_ramps16.c index 9acda3c..721b5e0 100644 --- a/libgamma_dummy_crtc_get_gamma_ramps16.c +++ b/libgamma_dummy_crtc_get_gamma_ramps16.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps16_t *restrict ramps) +libgamma_dummy_crtc_get_gamma_ramps16(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps16 *restrict ramps) { #define LIBGAMMA_DUMMY_GET_RAMPS #define TYPE uint16_t diff --git a/libgamma_dummy_crtc_get_gamma_ramps32.c b/libgamma_dummy_crtc_get_gamma_ramps32.c index c1a0b62..eec9391 100644 --- a/libgamma_dummy_crtc_get_gamma_ramps32.c +++ b/libgamma_dummy_crtc_get_gamma_ramps32.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_get_gamma_ramps32(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps32_t *restrict ramps) +libgamma_dummy_crtc_get_gamma_ramps32(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps32 *restrict ramps) { #define LIBGAMMA_DUMMY_GET_RAMPS #define TYPE uint32_t diff --git a/libgamma_dummy_crtc_get_gamma_ramps64.c b/libgamma_dummy_crtc_get_gamma_ramps64.c index 3ec4fed..c2aaddb 100644 --- a/libgamma_dummy_crtc_get_gamma_ramps64.c +++ b/libgamma_dummy_crtc_get_gamma_ramps64.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_get_gamma_ramps64(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps64_t *restrict ramps) +libgamma_dummy_crtc_get_gamma_ramps64(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps64 *restrict ramps) { #define LIBGAMMA_DUMMY_GET_RAMPS #define TYPE uint64_t diff --git a/libgamma_dummy_crtc_get_gamma_ramps8.c b/libgamma_dummy_crtc_get_gamma_ramps8.c index 42a6616..b026d46 100644 --- a/libgamma_dummy_crtc_get_gamma_ramps8.c +++ b/libgamma_dummy_crtc_get_gamma_ramps8.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_get_gamma_ramps8(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps8_t *restrict ramps) +libgamma_dummy_crtc_get_gamma_ramps8(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps8 *restrict ramps) { #define LIBGAMMA_DUMMY_GET_RAMPS #define TYPE uint8_t diff --git a/libgamma_dummy_crtc_get_gamma_rampsd.c b/libgamma_dummy_crtc_get_gamma_rampsd.c index 70939ca..244a287 100644 --- a/libgamma_dummy_crtc_get_gamma_rampsd.c +++ b/libgamma_dummy_crtc_get_gamma_rampsd.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_get_gamma_rampsd(libgamma_crtc_state_t *restrict this, libgamma_gamma_rampsd_t *restrict ramps) +libgamma_dummy_crtc_get_gamma_rampsd(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_rampsd *restrict ramps) { #define LIBGAMMA_DUMMY_GET_RAMPS #define TYPE double diff --git a/libgamma_dummy_crtc_get_gamma_rampsf.c b/libgamma_dummy_crtc_get_gamma_rampsf.c index bf89228..ad712fd 100644 --- a/libgamma_dummy_crtc_get_gamma_rampsf.c +++ b/libgamma_dummy_crtc_get_gamma_rampsf.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_get_gamma_rampsf(libgamma_crtc_state_t *restrict this, libgamma_gamma_rampsf_t *restrict ramps) +libgamma_dummy_crtc_get_gamma_rampsf(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_rampsf *restrict ramps) { #define LIBGAMMA_DUMMY_GET_RAMPS #define TYPE float diff --git a/libgamma_dummy_crtc_initialise.c b/libgamma_dummy_crtc_initialise.c index 49a11f5..a3f9c87 100644 --- a/libgamma_dummy_crtc_initialise.c +++ b/libgamma_dummy_crtc_initialise.c @@ -13,11 +13,11 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_initialise(libgamma_crtc_state_t *restrict this, - libgamma_partition_state_t *restrict partition, size_t crtc) +libgamma_dummy_crtc_initialise(struct libgamma_crtc_state *restrict this, + struct libgamma_partition_state *restrict partition, size_t crtc) { - libgamma_dummy_partition_t *partition_data = partition->data; - libgamma_dummy_crtc_t *data = &partition_data->crtcs[crtc]; + struct libgamma_dummy_partition *partition_data = partition->data; + struct libgamma_dummy_crtc *data = &partition_data->crtcs[crtc]; size_t stop_size; this->data = NULL; diff --git a/libgamma_dummy_crtc_restore.c b/libgamma_dummy_crtc_restore.c index d2a50ce..9cde936 100644 --- a/libgamma_dummy_crtc_restore.c +++ b/libgamma_dummy_crtc_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_restore(libgamma_crtc_state_t *restrict this) +libgamma_dummy_crtc_restore(struct libgamma_crtc_state *restrict this) { if (!libgamma_dummy_internal_configurations.capabilities.crtc_restore) { errno = ENOTSUP; diff --git a/libgamma_dummy_crtc_set_gamma_ramps16.c b/libgamma_dummy_crtc_set_gamma_ramps16.c index c386ccb..a3a3a39 100644 --- a/libgamma_dummy_crtc_set_gamma_ramps16.c +++ b/libgamma_dummy_crtc_set_gamma_ramps16.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict this, const libgamma_gamma_ramps16_t *restrict ramps) +libgamma_dummy_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_ramps16 *restrict ramps) { #define LIBGAMMA_DUMMY_SET_RAMPS #define TYPE uint16_t diff --git a/libgamma_dummy_crtc_set_gamma_ramps32.c b/libgamma_dummy_crtc_set_gamma_ramps32.c index e178868..0216816 100644 --- a/libgamma_dummy_crtc_set_gamma_ramps32.c +++ b/libgamma_dummy_crtc_set_gamma_ramps32.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_set_gamma_ramps32(libgamma_crtc_state_t *restrict this, const libgamma_gamma_ramps32_t *restrict ramps) +libgamma_dummy_crtc_set_gamma_ramps32(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_ramps32 *restrict ramps) { #define LIBGAMMA_DUMMY_SET_RAMPS #define TYPE uint32_t diff --git a/libgamma_dummy_crtc_set_gamma_ramps64.c b/libgamma_dummy_crtc_set_gamma_ramps64.c index 0660b55..6df0847 100644 --- a/libgamma_dummy_crtc_set_gamma_ramps64.c +++ b/libgamma_dummy_crtc_set_gamma_ramps64.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_set_gamma_ramps64(libgamma_crtc_state_t *restrict this, const libgamma_gamma_ramps64_t *restrict ramps) +libgamma_dummy_crtc_set_gamma_ramps64(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_ramps64 *restrict ramps) { #define LIBGAMMA_DUMMY_SET_RAMPS #define TYPE uint64_t diff --git a/libgamma_dummy_crtc_set_gamma_ramps8.c b/libgamma_dummy_crtc_set_gamma_ramps8.c index 6f4f7de..2508c34 100644 --- a/libgamma_dummy_crtc_set_gamma_ramps8.c +++ b/libgamma_dummy_crtc_set_gamma_ramps8.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_set_gamma_ramps8(libgamma_crtc_state_t *restrict this, const libgamma_gamma_ramps8_t *restrict ramps) +libgamma_dummy_crtc_set_gamma_ramps8(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_ramps8 *restrict ramps) { #define LIBGAMMA_DUMMY_SET_RAMPS #define TYPE uint8_t diff --git a/libgamma_dummy_crtc_set_gamma_rampsd.c b/libgamma_dummy_crtc_set_gamma_rampsd.c index 4583bbd..b57ffe0 100644 --- a/libgamma_dummy_crtc_set_gamma_rampsd.c +++ b/libgamma_dummy_crtc_set_gamma_rampsd.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_set_gamma_rampsd(libgamma_crtc_state_t *restrict this, const libgamma_gamma_rampsd_t *restrict ramps) +libgamma_dummy_crtc_set_gamma_rampsd(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_rampsd *restrict ramps) { #define LIBGAMMA_DUMMY_SET_RAMPS #define TYPE double diff --git a/libgamma_dummy_crtc_set_gamma_rampsf.c b/libgamma_dummy_crtc_set_gamma_rampsf.c index 1969b11..41e22df 100644 --- a/libgamma_dummy_crtc_set_gamma_rampsf.c +++ b/libgamma_dummy_crtc_set_gamma_rampsf.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_dummy_crtc_set_gamma_rampsf(libgamma_crtc_state_t *restrict this, const libgamma_gamma_rampsf_t *restrict ramps) +libgamma_dummy_crtc_set_gamma_rampsf(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_rampsf *restrict ramps) { #define LIBGAMMA_DUMMY_SET_RAMPS #define TYPE float diff --git a/libgamma_dummy_get_crtc_information.c b/libgamma_dummy_get_crtc_information.c index f8f885e..541ae77 100644 --- a/libgamma_dummy_get_crtc_information.c +++ b/libgamma_dummy_get_crtc_information.c @@ -12,11 +12,11 @@ * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ int -libgamma_dummy_get_crtc_information(libgamma_crtc_information_t *restrict this, - libgamma_crtc_state_t *restrict crtc, unsigned long long fields) +libgamma_dummy_get_crtc_information(struct libgamma_crtc_information *restrict this, + struct libgamma_crtc_state *restrict crtc, unsigned long long fields) { - libgamma_dummy_crtc_t *restrict data = crtc->data; - int supported = libgamma_dummy_internal_configurations.capabilities.crtc_information; + struct libgamma_dummy_crtc *restrict data = crtc->data; + unsigned long long supported = libgamma_dummy_internal_configurations.capabilities.crtc_information; int e = 0; size_t n; diff --git a/libgamma_dummy_internal_configurations.c b/libgamma_dummy_internal_configurations.c index 8aa3ae9..0e508d8 100644 --- a/libgamma_dummy_internal_configurations.c +++ b/libgamma_dummy_internal_configurations.c @@ -6,7 +6,7 @@ /** * Configurations for the dummy adjustment method */ -libgamma_dummy_configurations_t libgamma_dummy_internal_configurations = { +struct libgamma_dummy_configurations libgamma_dummy_internal_configurations = { .capabilities = { .crtc_information = (1 << LIBGAMMA_CRTC_INFO_COUNT) - 1, .default_site_known = 1, diff --git a/libgamma_dummy_internal_crtc_restore_forced.c b/libgamma_dummy_internal_crtc_restore_forced.c index ab4cf50..a3c460f 100644 --- a/libgamma_dummy_internal_crtc_restore_forced.c +++ b/libgamma_dummy_internal_crtc_restore_forced.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_dummy_internal_crtc_restore_forced(libgamma_dummy_crtc_t *restrict data) +libgamma_dummy_internal_crtc_restore_forced(struct libgamma_dummy_crtc *restrict data) { size_t rn = data->info. red_gamma_size; size_t gn = data->info.green_gamma_size; @@ -22,7 +22,7 @@ libgamma_dummy_internal_crtc_restore_forced(libgamma_dummy_crtc_t *restrict data if (!data->gamma_red) return 0; -#define __reset_ramps(TYPE, MAX)\ +#define RESET_RAMPS(TYPE, MAX)\ do {\ TYPE *red = data->gamma_red;\ TYPE *green = data->gamma_green;\ @@ -32,14 +32,14 @@ libgamma_dummy_internal_crtc_restore_forced(libgamma_dummy_crtc_t *restrict data for (i = 0; i < bn; i++) blue [i] = (TYPE)((double)(MAX) * ((double)i / (double)(bn - 1)));\ } while (0) - if (data->info.gamma_depth == 8) __reset_ramps(uint8_t, INT8_MAX); - else if (data->info.gamma_depth == 16) __reset_ramps(uint16_t, INT16_MAX); - else if (data->info.gamma_depth == 32) __reset_ramps(uint32_t, INT32_MAX); - else if (data->info.gamma_depth == 64) __reset_ramps(uint64_t, INT64_MAX); - else if (data->info.gamma_depth == -1) __reset_ramps(float, 1); - else __reset_ramps(double, 1); + if (data->info.gamma_depth == 8) RESET_RAMPS(uint8_t, INT8_MAX); + else if (data->info.gamma_depth == 16) RESET_RAMPS(uint16_t, INT16_MAX); + else if (data->info.gamma_depth == 32) RESET_RAMPS(uint32_t, INT32_MAX); + else if (data->info.gamma_depth == 64) RESET_RAMPS(uint64_t, INT64_MAX); + else if (data->info.gamma_depth == -1) RESET_RAMPS(float, 1); + else RESET_RAMPS(double, 1); -#undef __reset_ramps +#undef RESET_RAMPS return 0; } diff --git a/libgamma_dummy_method_capabilities.c b/libgamma_dummy_method_capabilities.c index f5b53fa..dee715a 100644 --- a/libgamma_dummy_method_capabilities.c +++ b/libgamma_dummy_method_capabilities.c @@ -9,7 +9,7 @@ * @param this The data structure to fill with the method's capabilities */ void -libgamma_dummy_method_capabilities(libgamma_method_capabilities_t *restrict this) +libgamma_dummy_method_capabilities(struct libgamma_method_capabilities *restrict this) { int real_method = libgamma_dummy_internal_configurations.real_method; *this = libgamma_dummy_internal_configurations.capabilities; diff --git a/libgamma_dummy_partition_destroy.c b/libgamma_dummy_partition_destroy.c index 946901e..4ecdc9f 100644 --- a/libgamma_dummy_partition_destroy.c +++ b/libgamma_dummy_partition_destroy.c @@ -9,9 +9,9 @@ * @param this The partition state */ void -libgamma_dummy_partition_destroy(libgamma_partition_state_t *restrict this) +libgamma_dummy_partition_destroy(struct libgamma_partition_state *restrict this) { - libgamma_dummy_partition_t *data = this->data; + struct libgamma_dummy_partition *data = this->data; size_t i; if (data) { diff --git a/libgamma_dummy_partition_initialise.c b/libgamma_dummy_partition_initialise.c index c3147ba..2557413 100644 --- a/libgamma_dummy_partition_initialise.c +++ b/libgamma_dummy_partition_initialise.c @@ -13,13 +13,13 @@ * error identifier provided by this library */ int -libgamma_dummy_partition_initialise(libgamma_partition_state_t *restrict this, - libgamma_site_state_t *restrict site, size_t partition) +libgamma_dummy_partition_initialise(struct libgamma_partition_state *restrict this, + struct libgamma_site_state *restrict site, size_t partition) { - libgamma_crtc_information_t template = libgamma_dummy_internal_configurations.crtc_info_template; - libgamma_dummy_site_t *site_data = site->data; - libgamma_dummy_partition_t *data = &site_data->partitions[partition]; - libgamma_dummy_crtc_t *crtc_data; + struct libgamma_crtc_information template = libgamma_dummy_internal_configurations.crtc_info_template; + struct libgamma_dummy_site *site_data = site->data; + struct libgamma_dummy_partition *data = &site_data->partitions[partition]; + struct libgamma_dummy_crtc *crtc_data; size_t i, n; this->data = NULL; @@ -30,7 +30,7 @@ libgamma_dummy_partition_initialise(libgamma_partition_state_t *restrict this, this->data = data; data->state = this; - data->crtcs = calloc(data->crtc_count, sizeof(libgamma_dummy_crtc_t)); + data->crtcs = calloc(data->crtc_count, sizeof(*data->crtcs)); if (!data->crtcs) goto fail; for (i = 0; i < data->crtc_count; i++) { diff --git a/libgamma_dummy_partition_restore.c b/libgamma_dummy_partition_restore.c index 457086a..b7fc4ac 100644 --- a/libgamma_dummy_partition_restore.c +++ b/libgamma_dummy_partition_restore.c @@ -11,9 +11,9 @@ * error identifier provided by this library */ int -libgamma_dummy_partition_restore(libgamma_partition_state_t *restrict this) +libgamma_dummy_partition_restore(struct libgamma_partition_state *restrict this) { - libgamma_dummy_partition_t *data = this->data; + struct libgamma_dummy_partition *data = this->data; size_t i; if (!libgamma_dummy_internal_configurations.capabilities.partition_restore) { diff --git a/libgamma_dummy_site_destroy.c b/libgamma_dummy_site_destroy.c index f0d71ce..eabebfc 100644 --- a/libgamma_dummy_site_destroy.c +++ b/libgamma_dummy_site_destroy.c @@ -9,9 +9,9 @@ * @param this The site state */ void -libgamma_dummy_site_destroy(libgamma_site_state_t *restrict this) +libgamma_dummy_site_destroy(struct libgamma_site_state *restrict this) { - libgamma_dummy_site_t *data = this->data; + struct libgamma_dummy_site *data = this->data; if (data) { free(data->partitions); free(data); diff --git a/libgamma_dummy_site_initialise.c b/libgamma_dummy_site_initialise.c index 4154516..1eb617e 100644 --- a/libgamma_dummy_site_initialise.c +++ b/libgamma_dummy_site_initialise.c @@ -17,9 +17,9 @@ * error identifier provided by this library */ int -libgamma_dummy_site_initialise(libgamma_site_state_t *restrict this, char *restrict site) +libgamma_dummy_site_initialise(struct libgamma_site_state *restrict this, char *restrict site) { - libgamma_dummy_site_t *data = NULL; + struct libgamma_dummy_site *data = NULL; size_t i, sites, crtcs; sites = libgamma_dummy_internal_configurations.site_count; @@ -27,10 +27,10 @@ libgamma_dummy_site_initialise(libgamma_site_state_t *restrict this, char *restr sites = !!sites; this->data = NULL; - if (site && *site && (atoll(site) < 0 || sites <= (unsigned long long)atoll(site))) + if (site && *site && (atoll(site) < 0 || sites <= (size_t)atoll(site))) return LIBGAMMA_NO_SUCH_SITE; - data = malloc(sizeof(libgamma_dummy_site_t)); + data = malloc(sizeof(*data)); if (!data) goto fail; @@ -45,7 +45,7 @@ libgamma_dummy_site_initialise(libgamma_site_state_t *restrict this, char *restr if (!libgamma_dummy_internal_configurations.capabilities.multiple_crtcs) crtcs = !!crtcs; - data->partitions = malloc(data->partition_count * sizeof(libgamma_dummy_partition_t)); + data->partitions = malloc(data->partition_count * sizeof(*data->partitions)); if (!data->partitions) goto fail; diff --git a/libgamma_dummy_site_restore.c b/libgamma_dummy_site_restore.c index 1e1d737..0e8a7a5 100644 --- a/libgamma_dummy_site_restore.c +++ b/libgamma_dummy_site_restore.c @@ -11,9 +11,9 @@ * error identifier provided by this library */ int -libgamma_dummy_site_restore(libgamma_site_state_t *restrict this) +libgamma_dummy_site_restore(struct libgamma_site_state *restrict this) { - libgamma_dummy_site_t *data = this->data; + struct libgamma_dummy_site *data = this->data; size_t i, j; if (!libgamma_dummy_internal_configurations.capabilities.site_restore) { diff --git a/libgamma_gamma_ramps16_destroy.c b/libgamma_gamma_ramps16_destroy.c index 09a00f1..6afa1c4 100644 --- a/libgamma_gamma_ramps16_destroy.c +++ b/libgamma_gamma_ramps16_destroy.c @@ -10,7 +10,7 @@ * @param this The gamma ramps */ void -libgamma_gamma_ramps16_destroy(libgamma_gamma_ramps16_t *restrict this) +libgamma_gamma_ramps16_destroy(struct libgamma_gamma_ramps16 *restrict this) { free(this->red); } diff --git a/libgamma_gamma_ramps16_free.c b/libgamma_gamma_ramps16_free.c index 70b9368..0b9f21f 100644 --- a/libgamma_gamma_ramps16_free.c +++ b/libgamma_gamma_ramps16_free.c @@ -11,7 +11,7 @@ * @param this The gamma ramps */ void -libgamma_gamma_ramps16_free(libgamma_gamma_ramps16_t *restrict this) +libgamma_gamma_ramps16_free(struct libgamma_gamma_ramps16 *restrict this) { free(this->red); free(this); diff --git a/libgamma_gamma_ramps16_initialise.c b/libgamma_gamma_ramps16_initialise.c index c1c55cb..08d242b 100644 --- a/libgamma_gamma_ramps16_initialise.c +++ b/libgamma_gamma_ramps16_initialise.c @@ -13,14 +13,14 @@ * @return Zero on success, -1 on allocation error, `errno` will be set accordingly */ int -libgamma_gamma_ramps16_initialise(libgamma_gamma_ramps16_t *restrict this) +libgamma_gamma_ramps16_initialise(struct libgamma_gamma_ramps16 *restrict this) { size_t n = this->red_size + this->green_size + this->blue_size; #ifdef HAVE_LIBGAMMA_METHOD_LINUX_DRM /* Valgrind complains about us reading uninitialize memory if we just use malloc */ - this->red = calloc(n, sizeof(uint16_t)); + this->red = calloc(n, sizeof(*this->red)); #else - this->red = malloc(n * sizeof(uint16_t)); + this->red = malloc(n * sizeof(*this->red)); #endif this->green = &this-> red[this-> red_size]; this->blue = &this->green[this->green_size]; diff --git a/libgamma_gamma_ramps32_destroy.c b/libgamma_gamma_ramps32_destroy.c index 4eabb6a..a937b28 100644 --- a/libgamma_gamma_ramps32_destroy.c +++ b/libgamma_gamma_ramps32_destroy.c @@ -10,7 +10,7 @@ * @param this The gamma ramps */ void -libgamma_gamma_ramps32_destroy(libgamma_gamma_ramps32_t *restrict this) +libgamma_gamma_ramps32_destroy(struct libgamma_gamma_ramps32 *restrict this) { free(this->red); } diff --git a/libgamma_gamma_ramps32_free.c b/libgamma_gamma_ramps32_free.c index 96f7909..25a2f69 100644 --- a/libgamma_gamma_ramps32_free.c +++ b/libgamma_gamma_ramps32_free.c @@ -11,7 +11,7 @@ * @param this The gamma ramps */ void -libgamma_gamma_ramps32_free(libgamma_gamma_ramps32_t *restrict this) +libgamma_gamma_ramps32_free(struct libgamma_gamma_ramps32 *restrict this) { free(this->red); free(this); diff --git a/libgamma_gamma_ramps32_initialise.c b/libgamma_gamma_ramps32_initialise.c index 28c1a00..1134c8d 100644 --- a/libgamma_gamma_ramps32_initialise.c +++ b/libgamma_gamma_ramps32_initialise.c @@ -13,10 +13,10 @@ * @return Zero on success, -1 on allocation error, `errno` will be set accordingly */ int -libgamma_gamma_ramps32_initialise(libgamma_gamma_ramps32_t *restrict this) +libgamma_gamma_ramps32_initialise(struct libgamma_gamma_ramps32 *restrict this) { size_t n = this->red_size + this->green_size + this->blue_size; - this->red = malloc(n * sizeof(uint32_t)); + this->red = malloc(n * sizeof(*this->red)); this->green = &this-> red[this-> red_size]; this->blue = &this->green[this->green_size]; return this->red ? 0 : -1; diff --git a/libgamma_gamma_ramps64_destroy.c b/libgamma_gamma_ramps64_destroy.c index aeb85c4..b9b0701 100644 --- a/libgamma_gamma_ramps64_destroy.c +++ b/libgamma_gamma_ramps64_destroy.c @@ -10,7 +10,7 @@ * @param this The gamma ramps */ void -libgamma_gamma_ramps64_destroy(libgamma_gamma_ramps64_t *restrict this) +libgamma_gamma_ramps64_destroy(struct libgamma_gamma_ramps64 *restrict this) { free(this->red); } diff --git a/libgamma_gamma_ramps64_free.c b/libgamma_gamma_ramps64_free.c index 493d8be..3096222 100644 --- a/libgamma_gamma_ramps64_free.c +++ b/libgamma_gamma_ramps64_free.c @@ -11,7 +11,7 @@ * @param this The gamma ramps */ void -libgamma_gamma_ramps64_free(libgamma_gamma_ramps64_t *restrict this) +libgamma_gamma_ramps64_free(struct libgamma_gamma_ramps64 *restrict this) { free(this->red); free(this); diff --git a/libgamma_gamma_ramps64_initialise.c b/libgamma_gamma_ramps64_initialise.c index 1196670..9580028 100644 --- a/libgamma_gamma_ramps64_initialise.c +++ b/libgamma_gamma_ramps64_initialise.c @@ -13,10 +13,10 @@ * @return Zero on success, -1 on allocation error, `errno` will be set accordingly */ int -libgamma_gamma_ramps64_initialise(libgamma_gamma_ramps64_t *restrict this) +libgamma_gamma_ramps64_initialise(struct libgamma_gamma_ramps64 *restrict this) { size_t n = this->red_size + this->green_size + this->blue_size; - this->red = malloc(n * sizeof(uint64_t)); + this->red = malloc(n * sizeof(*this->red)); this->green = &this-> red[this-> red_size]; this->blue = &this->green[this->green_size]; return this->red ? 0 : -1; diff --git a/libgamma_gamma_ramps8_destroy.c b/libgamma_gamma_ramps8_destroy.c index 630d8cc..fd3f234 100644 --- a/libgamma_gamma_ramps8_destroy.c +++ b/libgamma_gamma_ramps8_destroy.c @@ -10,7 +10,7 @@ * @param this The gamma ramps */ void -libgamma_gamma_ramps8_destroy(libgamma_gamma_ramps8_t *restrict this) +libgamma_gamma_ramps8_destroy(struct libgamma_gamma_ramps8 *restrict this) { free(this->red); } diff --git a/libgamma_gamma_ramps8_free.c b/libgamma_gamma_ramps8_free.c index 78be13a..111958f 100644 --- a/libgamma_gamma_ramps8_free.c +++ b/libgamma_gamma_ramps8_free.c @@ -11,7 +11,7 @@ * @param this The gamma ramps */ void -libgamma_gamma_ramps8_free(libgamma_gamma_ramps8_t *restrict this) +libgamma_gamma_ramps8_free(struct libgamma_gamma_ramps8 *restrict this) { free(this->red); free(this); diff --git a/libgamma_gamma_ramps8_initialise.c b/libgamma_gamma_ramps8_initialise.c index 6c64614..04bf465 100644 --- a/libgamma_gamma_ramps8_initialise.c +++ b/libgamma_gamma_ramps8_initialise.c @@ -13,10 +13,10 @@ * @return Zero on success, -1 on allocation error, `errno` will be set accordingly */ int -libgamma_gamma_ramps8_initialise(libgamma_gamma_ramps8_t *restrict this) +libgamma_gamma_ramps8_initialise(struct libgamma_gamma_ramps8 *restrict this) { size_t n = this->red_size + this->green_size + this->blue_size; - this->red = malloc(n * sizeof(uint8_t)); + this->red = malloc(n * sizeof(*this->red)); this->green = &this-> red[this-> red_size]; this->blue = &this->green[this->green_size]; return this->red ? 0 : -1; diff --git a/libgamma_gamma_rampsd_destroy.c b/libgamma_gamma_rampsd_destroy.c index 47e27f3..f88e1ce 100644 --- a/libgamma_gamma_rampsd_destroy.c +++ b/libgamma_gamma_rampsd_destroy.c @@ -10,7 +10,7 @@ * @param this The gamma ramps */ void -libgamma_gamma_rampsd_destroy(libgamma_gamma_rampsd_t *restrict this) +libgamma_gamma_rampsd_destroy(struct libgamma_gamma_rampsd *restrict this) { free(this->red); } diff --git a/libgamma_gamma_rampsd_free.c b/libgamma_gamma_rampsd_free.c index c9b18bc..f620da8 100644 --- a/libgamma_gamma_rampsd_free.c +++ b/libgamma_gamma_rampsd_free.c @@ -11,7 +11,7 @@ * @param this The gamma ramps */ void -libgamma_gamma_rampsd_free(libgamma_gamma_rampsd_t *restrict this) +libgamma_gamma_rampsd_free(struct libgamma_gamma_rampsd *restrict this) { free(this->red); free(this); diff --git a/libgamma_gamma_rampsd_initialise.c b/libgamma_gamma_rampsd_initialise.c index bb98d0b..f3ca3ef 100644 --- a/libgamma_gamma_rampsd_initialise.c +++ b/libgamma_gamma_rampsd_initialise.c @@ -13,10 +13,10 @@ * @return Zero on success, -1 on allocation error, `errno` will be set accordingly */ int -libgamma_gamma_rampsd_initialise(libgamma_gamma_rampsd_t *restrict this) +libgamma_gamma_rampsd_initialise(struct libgamma_gamma_rampsd *restrict this) { size_t n = this->red_size + this->green_size + this->blue_size; - this->red = malloc(n * sizeof(double)); + this->red = malloc(n * sizeof(*this->red)); this->green = &this-> red[this-> red_size]; this->blue = &this->green[this->green_size]; return this->red ? 0 : -1; diff --git a/libgamma_gamma_rampsf_destroy.c b/libgamma_gamma_rampsf_destroy.c index 0b184d7..064a241 100644 --- a/libgamma_gamma_rampsf_destroy.c +++ b/libgamma_gamma_rampsf_destroy.c @@ -10,7 +10,7 @@ * @param this The gamma ramps */ void -libgamma_gamma_rampsf_destroy(libgamma_gamma_rampsf_t *restrict this) +libgamma_gamma_rampsf_destroy(struct libgamma_gamma_rampsf *restrict this) { free(this->red); } diff --git a/libgamma_gamma_rampsf_free.c b/libgamma_gamma_rampsf_free.c index fdaf590..400f8a6 100644 --- a/libgamma_gamma_rampsf_free.c +++ b/libgamma_gamma_rampsf_free.c @@ -11,7 +11,7 @@ * @param this The gamma ramps */ void -libgamma_gamma_rampsf_free(libgamma_gamma_rampsf_t *restrict this) +libgamma_gamma_rampsf_free(struct libgamma_gamma_rampsf *restrict this) { free(this->red); free(this); diff --git a/libgamma_gamma_rampsf_initialise.c b/libgamma_gamma_rampsf_initialise.c index b77fc83..0937bc7 100644 --- a/libgamma_gamma_rampsf_initialise.c +++ b/libgamma_gamma_rampsf_initialise.c @@ -13,10 +13,10 @@ * @return Zero on success, -1 on allocation error, `errno` will be set accordingly */ int -libgamma_gamma_rampsf_initialise(libgamma_gamma_rampsf_t *restrict this) +libgamma_gamma_rampsf_initialise(struct libgamma_gamma_rampsf *restrict this) { size_t n = this->red_size + this->green_size + this->blue_size; - this->red = malloc(n * sizeof(float)); + this->red = malloc(n * sizeof(*this->red)); this->green = &this-> red[this-> red_size]; this->blue = &this->green[this->green_size]; return this->red ? 0 : -1; diff --git a/libgamma_get_crtc_information.c b/libgamma_get_crtc_information.c index 58011dd..a409b76 100644 --- a/libgamma_get_crtc_information.c +++ b/libgamma_get_crtc_information.c @@ -13,11 +13,11 @@ * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ int -libgamma_get_crtc_information(libgamma_crtc_information_t *restrict this, size_t size, - libgamma_crtc_state_t *restrict crtc, unsigned long long fields) +libgamma_get_crtc_information(struct libgamma_crtc_information *restrict this, size_t size, + struct libgamma_crtc_state *restrict crtc, unsigned long long fields) { - libgamma_crtc_information_t info_; - int r, (*func)(libgamma_crtc_information_t *restrict, libgamma_crtc_state_t *restrict, unsigned long long); + struct libgamma_crtc_information info_; + int r, (*func)(struct libgamma_crtc_information *restrict, struct libgamma_crtc_state *restrict, unsigned long long); this->edid = NULL; this->connector_name = NULL; diff --git a/libgamma_internal_allocated_any_ramp.c b/libgamma_internal_allocated_any_ramp.c index 28f6ba9..afb128c 100644 --- a/libgamma_internal_allocated_any_ramp.c +++ b/libgamma_internal_allocated_any_ramp.c @@ -20,7 +20,7 @@ * error identifier provided by this library */ int -libgamma_internal_allocated_any_ramp(gamma_ramps_any_t *restrict ramps_sys, const gamma_ramps_any_t *restrict ramps, +libgamma_internal_allocated_any_ramp(union gamma_ramps_any *restrict ramps_sys, const union gamma_ramps_any *restrict ramps, signed depth, size_t *restrict elements) { /* Calculate the size of the allocation to do */ diff --git a/libgamma_internal_parse_edid.c b/libgamma_internal_parse_edid.c index 6041556..9c8a84f 100644 --- a/libgamma_internal_parse_edid.c +++ b/libgamma_internal_parse_edid.c @@ -24,9 +24,9 @@ * @return Non-zero on error */ int -libgamma_internal_parse_edid(libgamma_crtc_information_t *restrict this, unsigned long long fields) +libgamma_internal_parse_edid(struct libgamma_crtc_information *restrict this, unsigned long long fields) { -#define __m(value)\ +#define M(value)\ (this->edid[index++] != (value)) uint16_t red_x, green_x, blue_x, white_x; @@ -40,7 +40,7 @@ libgamma_internal_parse_edid(libgamma_crtc_information_t *restrict this, unsigne if (this->edid_length < 128) error = LIBGAMMA_EDID_LENGTH_UNSUPPORTED; /* Check that the magic number of that of the EDID structure */ - else if (__m(0x00) || __m(0xFF) || __m(0xFF) || __m(0xFF) || __m(0xFF) || __m(0xFF) || __m(0xFF) || __m(0x00)) + else if (M(0x00) || M(0xFF) || M(0xFF) || M(0xFF) || M(0xFF) || M(0xFF) || M(0xFF) || M(0x00)) error = LIBGAMMA_EDID_WRONG_MAGIC_NUMBER; /* Check that EDID structure revision 1.x is used. We only know that we * support revisions 1.1, 1.3, and 1.4, and since they are all comptible, @@ -77,14 +77,14 @@ libgamma_internal_parse_edid(libgamma_crtc_information_t *restrict this, unsigne /* Retrieve the monitor's subpixel chromas */ if (fields & (LIBGAMMA_CRTC_INFO_CHROMA | LIBGAMMA_CRTC_INFO_WHITE_POINT)) { - red_x = (((uint16_t)this->edid[25] >> 6) & 2) | ((uint16_t)this->edid[27] << 2); - red_y = (((uint16_t)this->edid[25] >> 4) & 2) | ((uint16_t)this->edid[28] << 2); - green_x = (((uint16_t)this->edid[25] >> 2) & 2) | ((uint16_t)this->edid[29] << 2); - green_y = (((uint16_t)this->edid[25] >> 0) & 2) | ((uint16_t)this->edid[30] << 2); - blue_x = (((uint16_t)this->edid[26] >> 6) & 2) | ((uint16_t)this->edid[31] << 2); - blue_y = (((uint16_t)this->edid[26] >> 4) & 2) | ((uint16_t)this->edid[32] << 2); - white_x = (((uint16_t)this->edid[26] >> 2) & 2) | ((uint16_t)this->edid[33] << 2); - white_y = (((uint16_t)this->edid[26] >> 6) & 2) | ((uint16_t)this->edid[34] << 2); + red_x = (uint16_t)((((uint16_t)this->edid[25] >> 6) & 2) | ((uint16_t)this->edid[27] << 2)); + red_y = (uint16_t)((((uint16_t)this->edid[25] >> 4) & 2) | ((uint16_t)this->edid[28] << 2)); + green_x = (uint16_t)((((uint16_t)this->edid[25] >> 2) & 2) | ((uint16_t)this->edid[29] << 2)); + green_y = (uint16_t)((((uint16_t)this->edid[25] >> 0) & 2) | ((uint16_t)this->edid[30] << 2)); + blue_x = (uint16_t)((((uint16_t)this->edid[26] >> 6) & 2) | ((uint16_t)this->edid[31] << 2)); + blue_y = (uint16_t)((((uint16_t)this->edid[26] >> 4) & 2) | ((uint16_t)this->edid[32] << 2)); + white_x = (uint16_t)((((uint16_t)this->edid[26] >> 2) & 2) | ((uint16_t)this->edid[33] << 2)); + white_y = (uint16_t)((((uint16_t)this->edid[26] >> 6) & 2) | ((uint16_t)this->edid[34] << 2)); /* Even though the maximum value as encoded is 1023, the values should be divided by 1024 */ this->red_chroma_x = (float)red_x / 1024.f; this->red_chroma_y = (float)red_y / 1024.f; @@ -120,5 +120,5 @@ libgamma_internal_parse_edid(libgamma_crtc_information_t *restrict this, unsigne * specified in the monitor's EDID */ return error | this->gamma_error; -#undef __m +#undef M } diff --git a/libgamma_internal_translate_from_64.c b/libgamma_internal_translate_from_64.c index e7203a3..d1e5b18 100644 --- a/libgamma_internal_translate_from_64.c +++ b/libgamma_internal_translate_from_64.c @@ -11,7 +11,7 @@ * Preform installation in an `for (i = 0; i < n; i++)` * loop and do a `break` afterwords */ -#define __translate(instruction) for (i = 0; i < n; i++) instruction; break +#define TRANSLATE(instruction) for (i = 0; i < n; i++) instruction; break /** @@ -23,19 +23,19 @@ * @param in Input array, may be modified */ void -libgamma_internal_translate_from_64(signed depth, size_t n, gamma_ramps_any_t *restrict out, const uint64_t *restrict in) +libgamma_internal_translate_from_64(signed depth, size_t n, union gamma_ramps_any *restrict out, const uint64_t *restrict in) { size_t i; switch (depth) { /* Translate integer */ - case 8: __translate(out->bits8. ALL[i] = (uint8_t)(in[i] / UINT64_C(0x0101010101010101))); - case 16: __translate(out->bits16.ALL[i] = (uint16_t)(in[i] / UINT64_C(0x0001000100010001))); - case 32: __translate(out->bits32.ALL[i] = (uint32_t)(in[i] / UINT64_C(0x0000000100000001))); + case 8: TRANSLATE(out->bits8. ALL[i] = (uint8_t)(in[i] / UINT64_C(0x0101010101010101))); + case 16: TRANSLATE(out->bits16.ALL[i] = (uint16_t)(in[i] / UINT64_C(0x0001000100010001))); + case 32: TRANSLATE(out->bits32.ALL[i] = (uint32_t)(in[i] / UINT64_C(0x0000000100000001))); /* Identity translation */ - case 64: __translate(out->bits64.ALL[i] = in[i]); + case 64: TRANSLATE(out->bits64.ALL[i] = in[i]); /* Translate floating point */ - case -1: __translate(out->float_single.ALL[i] = (float)in[i] / (float)UINT64_MAX); - case -2: __translate(out->float_double.ALL[i] = (double)in[i] / (double)UINT64_MAX); + case -1: TRANSLATE(out->float_single.ALL[i] = (float)in[i] / (float)UINT64_MAX); + case -2: TRANSLATE(out->float_double.ALL[i] = (double)in[i] / (double)UINT64_MAX); default: /* This is not possible */ abort(); diff --git a/libgamma_internal_translate_to_64.c b/libgamma_internal_translate_to_64.c index 2c4a316..24cb0ed 100644 --- a/libgamma_internal_translate_to_64.c +++ b/libgamma_internal_translate_to_64.c @@ -12,7 +12,7 @@ * Preform installation in an `for (i = 0; i < n; i++)` * loop and do a `break` afterwords */ -#define __translate(instruction) for (i = 0; i < n; i++) instruction; break +#define TRANSLATE(instruction) for (i = 0; i < n; i++) instruction; break /** @@ -158,19 +158,19 @@ double_to_64(double value) * @param in Input gamma ramps */ void -libgamma_internal_translate_to_64(signed depth, size_t n, uint64_t *restrict out, const gamma_ramps_any_t *restrict in) +libgamma_internal_translate_to_64(signed depth, size_t n, uint64_t *restrict out, const union gamma_ramps_any *restrict in) { size_t i; switch (depth) { /* Translate integer */ - case 8: __translate(out[i] = (uint64_t)in->bits8. ALL[i] * UINT64_C(0x0101010101010101)); - case 16: __translate(out[i] = (uint64_t)in->bits16.ALL[i] * UINT64_C(0x0001000100010001)); - case 32: __translate(out[i] = (uint64_t)in->bits32.ALL[i] * UINT64_C(0x0000000100000001)); + case 8: TRANSLATE(out[i] = (uint64_t)in->bits8. ALL[i] * UINT64_C(0x0101010101010101)); + case 16: TRANSLATE(out[i] = (uint64_t)in->bits16.ALL[i] * UINT64_C(0x0001000100010001)); + case 32: TRANSLATE(out[i] = (uint64_t)in->bits32.ALL[i] * UINT64_C(0x0000000100000001)); /* Identity translation */ - case 64: __translate(out[i] = in->bits64.ALL[i]); + case 64: TRANSLATE(out[i] = in->bits64.ALL[i]); /* Translate floating point */ - case -1: __translate(out[i] = float_to_64(in->float_single.ALL[i])); - case -2: __translate(out[i] = double_to_64(in->float_double.ALL[i])); + case -1: TRANSLATE(out[i] = float_to_64(in->float_single.ALL[i])); + case -2: TRANSLATE(out[i] = double_to_64(in->float_double.ALL[i])); default: /* This is not possible */ abort(); diff --git a/libgamma_internal_translated_ramp_get_.c b/libgamma_internal_translated_ramp_get_.c index 53ca8a4..852f6c9 100644 --- a/libgamma_internal_translated_ramp_get_.c +++ b/libgamma_internal_translated_ramp_get_.c @@ -24,12 +24,12 @@ * error identifier provided by this library */ int -libgamma_internal_translated_ramp_get_(libgamma_crtc_state_t *restrict this, gamma_ramps_any_t *restrict ramps, +libgamma_internal_translated_ramp_get_(struct libgamma_crtc_state *restrict this, union gamma_ramps_any *restrict ramps, signed depth_user, signed depth_system, get_ramps_any_fun *fun) { size_t n; int r; - gamma_ramps_any_t ramps_sys; + union gamma_ramps_any ramps_sys; uint64_t *restrict ramps_full; /* Allocate ramps with proper data type */ @@ -43,7 +43,7 @@ libgamma_internal_translated_ramp_get_(libgamma_crtc_state_t *restrict this, gam } /* Allocate intermediary ramps */ - ramps_full = malloc(n * sizeof(uint64_t)); + ramps_full = malloc(n * sizeof(*ramps_full)); if (!ramps_full) { free(ramps_sys.ANY.red); return LIBGAMMA_ERRNO_SET; diff --git a/libgamma_internal_translated_ramp_set_.c b/libgamma_internal_translated_ramp_set_.c index 8099346..f249e54 100644 --- a/libgamma_internal_translated_ramp_set_.c +++ b/libgamma_internal_translated_ramp_set_.c @@ -24,12 +24,12 @@ * error identifier provided by this library */ int -libgamma_internal_translated_ramp_set_(libgamma_crtc_state_t *restrict this, const gamma_ramps_any_t *restrict ramps, +libgamma_internal_translated_ramp_set_(struct libgamma_crtc_state *restrict this, const union gamma_ramps_any *restrict ramps, signed depth_user, signed depth_system, set_ramps_any_fun *fun) { size_t n; int r; - gamma_ramps_any_t ramps_sys; + union gamma_ramps_any ramps_sys; uint64_t *restrict ramps_full; /* Allocate ramps with proper data type */ @@ -37,7 +37,7 @@ libgamma_internal_translated_ramp_set_(libgamma_crtc_state_t *restrict this, con return r; /* Allocate intermediary ramps */ - ramps_full = malloc(n * sizeof(uint64_t)); + ramps_full = malloc(n * sizeof(*ramps_full)); if (!ramps_full) { free(ramps_sys.ANY.red); return LIBGAMMA_ERRNO_SET; diff --git a/libgamma_linux_drm_crtc_destroy.c b/libgamma_linux_drm_crtc_destroy.c index 0d0ce65..b27408d 100644 --- a/libgamma_linux_drm_crtc_destroy.c +++ b/libgamma_linux_drm_crtc_destroy.c @@ -9,7 +9,7 @@ * @param this The CRTC state */ void -libgamma_linux_drm_crtc_destroy(libgamma_crtc_state_t *restrict this) +libgamma_linux_drm_crtc_destroy(struct libgamma_crtc_state *restrict this) { (void) this; } diff --git a/libgamma_linux_drm_crtc_get_gamma_ramps16.c b/libgamma_linux_drm_crtc_get_gamma_ramps16.c index 8242bae..35cb50e 100644 --- a/libgamma_linux_drm_crtc_get_gamma_ramps16.c +++ b/libgamma_linux_drm_crtc_get_gamma_ramps16.c @@ -12,9 +12,9 @@ * error identifier provided by this library */ int -libgamma_linux_drm_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps16_t *restrict ramps) +libgamma_linux_drm_crtc_get_gamma_ramps16(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps16 *restrict ramps) { - libgamma_drm_card_data_t *restrict card = this->partition->data; + struct libgamma_drm_card_data *restrict card = this->partition->data; int r; #ifdef DEBUG /* Gamma ramp sizes are identical but not fixed */ diff --git a/libgamma_linux_drm_crtc_initialise.c b/libgamma_linux_drm_crtc_initialise.c index 233c34b..e047ad6 100644 --- a/libgamma_linux_drm_crtc_initialise.c +++ b/libgamma_linux_drm_crtc_initialise.c @@ -13,13 +13,13 @@ * error identifier provided by this library */ int -libgamma_linux_drm_crtc_initialise(libgamma_crtc_state_t *restrict this, - libgamma_partition_state_t *restrict partition, size_t crtc) +libgamma_linux_drm_crtc_initialise(struct libgamma_crtc_state *restrict this, + struct libgamma_partition_state *restrict partition, size_t crtc) { - libgamma_drm_card_data_t *restrict card = partition->data; + struct libgamma_drm_card_data *restrict card = partition->data; if (crtc >= partition->crtcs_available) return LIBGAMMA_NO_SUCH_CRTC; - this->data = (void*)(size_t)card->res->crtcs[crtc]; + this->data = (void *)(size_t)card->res->crtcs[crtc]; return 0; } diff --git a/libgamma_linux_drm_crtc_restore.c b/libgamma_linux_drm_crtc_restore.c index fae5446..0d8bb79 100644 --- a/libgamma_linux_drm_crtc_restore.c +++ b/libgamma_linux_drm_crtc_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library. */ int -libgamma_linux_drm_crtc_restore(libgamma_crtc_state_t *restrict this) +libgamma_linux_drm_crtc_restore(struct libgamma_crtc_state *restrict this) { (void) this; errno = ENOTSUP; diff --git a/libgamma_linux_drm_crtc_set_gamma_ramps16.c b/libgamma_linux_drm_crtc_set_gamma_ramps16.c index 4147443..a150029 100644 --- a/libgamma_linux_drm_crtc_set_gamma_ramps16.c +++ b/libgamma_linux_drm_crtc_set_gamma_ramps16.c @@ -12,9 +12,10 @@ * error identifier provided by this library */ int -libgamma_linux_drm_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict this, const libgamma_gamma_ramps16_t *restrict ramps) +libgamma_linux_drm_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict this, + const struct libgamma_gamma_ramps16 *restrict ramps) { - libgamma_drm_card_data_t *restrict card = this->partition->data; + struct libgamma_drm_card_data *restrict card = this->partition->data; int r; #ifdef DEBUG /* Gamma ramp sizes are identical but not fixed */ diff --git a/libgamma_linux_drm_get_crtc_information.c b/libgamma_linux_drm_get_crtc_information.c index 39ec116..a476878 100644 --- a/libgamma_linux_drm_get_crtc_information.c +++ b/libgamma_linux_drm_get_crtc_information.c @@ -12,10 +12,10 @@ '* @return The CRTC's conncetor, `NULL` on error */ static drmModeConnector * -find_connector(libgamma_crtc_state_t *restrict this, int *restrict error) +find_connector(struct libgamma_crtc_state *restrict this, int *restrict error) { uint32_t crtc_id = (uint32_t)(size_t)this->data; - libgamma_drm_card_data_t *restrict card = this->partition->data; + struct libgamma_drm_card_data *restrict card = this->partition->data; size_t i, n = (size_t)card->res->count_connectors; /* Open connectors and encoders if not already opened */ if (!card->connectors) { @@ -70,9 +70,9 @@ fail: * @return The value stored in `out->gamma_size_error` */ static int -get_gamma_ramp_size(libgamma_crtc_information_t *restrict out, const libgamma_crtc_state_t *restrict crtc) +get_gamma_ramp_size(struct libgamma_crtc_information *restrict out, const struct libgamma_crtc_state *restrict crtc) { - libgamma_drm_card_data_t *restrict card = crtc->partition->data; + struct libgamma_drm_card_data *restrict card = crtc->partition->data; uint32_t crtc_id = card->res->crtcs[crtc->crtc]; drmModeCrtc *restrict crtc_info; /* Get CRTC information */ @@ -99,7 +99,7 @@ get_gamma_ramp_size(libgamma_crtc_information_t *restrict out, const libgamma_cr * @param connector The connector */ static void -get_subpixel_order(libgamma_crtc_information_t *restrict out, const drmModeConnector *restrict connector) +get_subpixel_order(struct libgamma_crtc_information *restrict out, const drmModeConnector *restrict connector) { switch (connector->subpixel) { #define X(CONST, NAME, DRM_SUFFIX)\ @@ -123,7 +123,7 @@ get_subpixel_order(libgamma_crtc_information_t *restrict out, const drmModeConne * @param connector_name_base Output for the basename of the connector */ static void -get_connector_type(libgamma_crtc_information_t *restrict out, const drmModeConnector *restrict connector, +get_connector_type(struct libgamma_crtc_information *restrict out, const drmModeConnector *restrict connector, const char **restrict connector_name_base) { /* These may not have been included by <xf86drmMode.h>, @@ -188,11 +188,11 @@ get_connector_type(libgamma_crtc_information_t *restrict out, const drmModeConne * @return Non-zero if at least on error occured */ static int -read_connector_data(libgamma_crtc_state_t *restrict crtc, libgamma_crtc_information_t *restrict out, +read_connector_data(struct libgamma_crtc_state *restrict crtc, struct libgamma_crtc_information *restrict out, const drmModeConnector *restrict connector, unsigned long long int fields) { const char *connector_name_base = NULL; - libgamma_drm_card_data_t *restrict card; + struct libgamma_drm_card_data *restrict card; uint32_t type; size_t i, n, c; @@ -254,9 +254,9 @@ read_connector_data(libgamma_crtc_state_t *restrict crtc, libgamma_crtc_informat * @reutnr Non-zero on error */ static int -get_edid(libgamma_crtc_state_t *restrict crtc, libgamma_crtc_information_t *restrict out, drmModeConnector *connector) +get_edid(struct libgamma_crtc_state *restrict crtc, struct libgamma_crtc_information *restrict out, drmModeConnector *connector) { - libgamma_drm_card_data_t *restrict card = crtc->partition->data; + struct libgamma_drm_card_data *restrict card = crtc->partition->data; int prop_n = connector->count_props; int prop_i; drmModePropertyRes *restrict prop; @@ -313,8 +313,8 @@ get_edid(libgamma_crtc_state_t *restrict crtc, libgamma_crtc_information_t *rest * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ int -libgamma_linux_drm_get_crtc_information(libgamma_crtc_information_t *restrict this, - libgamma_crtc_state_t *restrict crtc, unsigned long long fields) +libgamma_linux_drm_get_crtc_information(struct libgamma_crtc_information *restrict this, + struct libgamma_crtc_state *restrict crtc, unsigned long long fields) { #define _E(FIELD) ((fields & FIELD) ? LIBGAMMA_CRTC_INFO_NOT_SUPPORTED : 0) @@ -322,7 +322,7 @@ libgamma_linux_drm_get_crtc_information(libgamma_crtc_information_t *restrict th drmModeConnector *restrict connector; /* Wipe all error indicators */ - memset(this, 0, sizeof(libgamma_crtc_information_t)); + memset(this, 0, sizeof(*this)); /* We need to free the EDID after us if it is not explicitly requested */ free_edid = !(fields & LIBGAMMA_CRTC_INFO_EDID); diff --git a/libgamma_linux_drm_internal_release_connectors_and_encoders.c b/libgamma_linux_drm_internal_release_connectors_and_encoders.c index 35cc6b9..fe61dac 100644 --- a/libgamma_linux_drm_internal_release_connectors_and_encoders.c +++ b/libgamma_linux_drm_internal_release_connectors_and_encoders.c @@ -9,13 +9,13 @@ * @param this The graphics card data */ void -libgamma_linux_drm_internal_release_connectors_and_encoders(libgamma_drm_card_data_t *restrict this) +libgamma_linux_drm_internal_release_connectors_and_encoders(struct libgamma_drm_card_data *restrict this) { size_t i, n; /* Release individual encoders */ if (this->encoders) - for (i = 0, n = (size_t)(this->res->count_connectors); i < n; i++) + for (i = 0, n = (size_t)this->res->count_connectors; i < n; i++) if (this->encoders[i]) drmModeFreeEncoder(this->encoders[i]); /* Release encoder array */ @@ -24,7 +24,7 @@ libgamma_linux_drm_internal_release_connectors_and_encoders(libgamma_drm_card_da /* Release individual connectors */ if (this->connectors) - for (i = 0, n = (size_t)(this->res->count_connectors); i < n; i++) + for (i = 0, n = (size_t)this->res->count_connectors; i < n; i++) if (this->connectors[i]) drmModeFreeConnector(this->connectors[i]); /* Release connector array */ diff --git a/libgamma_linux_drm_method_capabilities.c b/libgamma_linux_drm_method_capabilities.c index fd1679c..3959dbe 100644 --- a/libgamma_linux_drm_method_capabilities.c +++ b/libgamma_linux_drm_method_capabilities.c @@ -9,7 +9,7 @@ * @param this The data structure to fill with the method's capabilities */ void -libgamma_linux_drm_method_capabilities(libgamma_method_capabilities_t *restrict this) +libgamma_linux_drm_method_capabilities(struct libgamma_method_capabilities *restrict this) { /* Support for all information except gamma ramp support */ this->crtc_information = LIBGAMMA_CRTC_INFO_MACRO_EDID diff --git a/libgamma_linux_drm_partition_destroy.c b/libgamma_linux_drm_partition_destroy.c index 8b1e08c..6f6cf6a 100644 --- a/libgamma_linux_drm_partition_destroy.c +++ b/libgamma_linux_drm_partition_destroy.c @@ -9,9 +9,9 @@ * @param this The partition state */ void -libgamma_linux_drm_partition_destroy(libgamma_partition_state_t *restrict this) +libgamma_linux_drm_partition_destroy(struct libgamma_partition_state *restrict this) { - libgamma_drm_card_data_t *restrict data = this->data; + struct libgamma_drm_card_data *restrict data = this->data; libgamma_linux_drm_internal_release_connectors_and_encoders(data); if (data->res) drmModeFreeResources(data->res); diff --git a/libgamma_linux_drm_partition_initialise.c b/libgamma_linux_drm_partition_initialise.c index 997e4d2..8136cd9 100644 --- a/libgamma_linux_drm_partition_initialise.c +++ b/libgamma_linux_drm_partition_initialise.c @@ -32,20 +32,21 @@ figure_out_card_open_error(const char *pathname) return LIBGAMMA_ERRNO_SET; } -#define __test(R, W) ((attr.st_mode & ((R) | (W))) == ((R) | (W))) + /* TODO Can this be simplified? */ +#define TEST(R, W) ((attr.st_mode & ((R) | (W))) == ((R) | (W))) /* Get permission requirement for the file */ if (stat(pathname, &attr)) return errno == EACCES ? LIBGAMMA_NO_SUCH_PARTITION : LIBGAMMA_ERRNO_SET; /* Test owner's, group's and others' permissions */ - if ((attr.st_uid == geteuid() && __test(S_IRUSR, S_IWUSR)) || - (attr.st_gid == getegid() && __test(S_IRGRP, S_IWGRP)) || __test(S_IROTH, S_IWOTH)) + if ((attr.st_uid == geteuid() && TEST(S_IRUSR, S_IWUSR)) || + (attr.st_gid == getegid() && TEST(S_IRGRP, S_IWGRP)) || TEST(S_IROTH, S_IWOTH)) return LIBGAMMA_DEVICE_ACCESS_FAILED; /* The group should be "video", but perhaps it is "root" to restrict users */ - if (!attr.st_gid /* root group */ || __test(S_IRGRP, S_IWGRP)) + if (!attr.st_gid /* root group */ || TEST(S_IRGRP, S_IWGRP)) return LIBGAMMA_DEVICE_RESTRICTED; @@ -79,7 +80,7 @@ figure_out_card_open_error(const char *pathname) libgamma_group_gid_set(attr.st_gid); libgamma_group_name_set(group ? group->gr_name : NULL); return LIBGAMMA_DEVICE_REQUIRE_GROUP; -#undef __test +#undef TEST } @@ -93,11 +94,11 @@ figure_out_card_open_error(const char *pathname) * error identifier provided by this library */ int -libgamma_linux_drm_partition_initialise(libgamma_partition_state_t *restrict this, - libgamma_site_state_t *restrict site, size_t partition) +libgamma_linux_drm_partition_initialise(struct libgamma_partition_state *restrict this, + struct libgamma_site_state *restrict site, size_t partition) { int rc = 0; - libgamma_drm_card_data_t *restrict data; + struct libgamma_drm_card_data *restrict data; char pathname[PATH_MAX]; (void) site; @@ -108,7 +109,7 @@ libgamma_linux_drm_partition_initialise(libgamma_partition_state_t *restrict thi /* Allocate and initialise graphics card data */ this->data = NULL; - data = malloc(sizeof(libgamma_drm_card_data_t)); + data = malloc(sizeof(*data)); if (!data) return LIBGAMMA_ERRNO_SET; data->fd = -1; diff --git a/libgamma_linux_drm_partition_restore.c b/libgamma_linux_drm_partition_restore.c index 561f5ff..97df043 100644 --- a/libgamma_linux_drm_partition_restore.c +++ b/libgamma_linux_drm_partition_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library. */ int -libgamma_linux_drm_partition_restore(libgamma_partition_state_t *restrict this) +libgamma_linux_drm_partition_restore(struct libgamma_partition_state *restrict this) { (void) this; errno = ENOTSUP; diff --git a/libgamma_linux_drm_site_destroy.c b/libgamma_linux_drm_site_destroy.c index 2ef775a..6fdbf15 100644 --- a/libgamma_linux_drm_site_destroy.c +++ b/libgamma_linux_drm_site_destroy.c @@ -9,7 +9,7 @@ * @param this The site state */ void -libgamma_linux_drm_site_destroy(libgamma_site_state_t *restrict this) +libgamma_linux_drm_site_destroy(struct libgamma_site_state *restrict this) { (void) this; } diff --git a/libgamma_linux_drm_site_initialise.c b/libgamma_linux_drm_site_initialise.c index e6ead83..9c57bd1 100644 --- a/libgamma_linux_drm_site_initialise.c +++ b/libgamma_linux_drm_site_initialise.c @@ -17,7 +17,7 @@ * error identifier provided by this library */ int -libgamma_linux_drm_site_initialise(libgamma_site_state_t *restrict this, char *restrict site) +libgamma_linux_drm_site_initialise(struct libgamma_site_state *restrict this, char *restrict site) { char pathname[PATH_MAX]; struct stat _attr; diff --git a/libgamma_linux_drm_site_restore.c b/libgamma_linux_drm_site_restore.c index b223051..e97f9c2 100644 --- a/libgamma_linux_drm_site_restore.c +++ b/libgamma_linux_drm_site_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_linux_drm_site_restore(libgamma_site_state_t *restrict this) +libgamma_linux_drm_site_restore(struct libgamma_site_state *restrict this) { (void) this; errno = ENOTSUP; diff --git a/libgamma_list_methods.c b/libgamma_list_methods.c index 45faff4..6da4f43 100644 --- a/libgamma_list_methods.c +++ b/libgamma_list_methods.c @@ -45,7 +45,7 @@ is_vt_proper(int fd) static int list_method_test(int method, int operation) { - libgamma_method_capabilities_t caps; + struct libgamma_method_capabilities caps; int fd, r, saved_errno; libgamma_method_capabilities(&caps, sizeof(caps), method); diff --git a/libgamma_method_capabilities.c b/libgamma_method_capabilities.c index 6c44056..226591c 100644 --- a/libgamma_method_capabilities.c +++ b/libgamma_method_capabilities.c @@ -13,10 +13,10 @@ * error identifier provided by this library */ int -libgamma_method_capabilities(libgamma_method_capabilities_t *restrict this, size_t size, int method) +libgamma_method_capabilities(struct libgamma_method_capabilities *restrict this, size_t size, int method) { - libgamma_method_capabilities_t caps_; - void (*func)(libgamma_method_capabilities_t *restrict); + struct libgamma_method_capabilities caps_; + void (*func)(struct libgamma_method_capabilities *restrict); memset(this, 0, sizeof(*this)); @@ -45,4 +45,5 @@ libgamma_method_capabilities(libgamma_method_capabilities_t *restrict this, size } } this->crtc_information__old = (int32_t)this->crtc_information; + return 0; } diff --git a/libgamma_name_of_connector_type.c b/libgamma_name_of_connector_type.c index f02b961..41e3581 100644 --- a/libgamma_name_of_connector_type.c +++ b/libgamma_name_of_connector_type.c @@ -15,9 +15,9 @@ * recognised (errno is not changed) */ const char * -libgamma_name_of_connector_type(int connector) +libgamma_name_of_connector_type(enum libgamma_connector_type connector) { - switch (connector) { + switch ((int)connector) { #define X(CONST, NAME, ...)\ case CONST:\ return NAME; diff --git a/libgamma_name_of_subpixel_order.c b/libgamma_name_of_subpixel_order.c index c3612bf..0a92609 100644 --- a/libgamma_name_of_subpixel_order.c +++ b/libgamma_name_of_subpixel_order.c @@ -14,9 +14,9 @@ * recognised (errno is not changed) */ const char * -libgamma_name_of_subpixel_order(int order) +libgamma_name_of_subpixel_order(enum libgamma_subpixel_order order) { - switch (order) { + switch ((int)order) { #define X(CONST, NAME, ...)\ case CONST:\ return NAME; diff --git a/libgamma_partition_destroy.c b/libgamma_partition_destroy.c index 4f96945..8b95be5 100644 --- a/libgamma_partition_destroy.c +++ b/libgamma_partition_destroy.c @@ -8,7 +8,7 @@ * @param this The partition state */ void -libgamma_partition_destroy(libgamma_partition_state_t *restrict this) +libgamma_partition_destroy(struct libgamma_partition_state *restrict this) { switch (this->site->method) { #define X(CONST, CNAME, ...)\ diff --git a/libgamma_partition_free.c b/libgamma_partition_free.c index 787d3f4..e5f03e6 100644 --- a/libgamma_partition_free.c +++ b/libgamma_partition_free.c @@ -8,4 +8,4 @@ * * @param this The partition state */ -extern inline void libgamma_partition_free(libgamma_partition_state_t *restrict); +extern inline void libgamma_partition_free(struct libgamma_partition_state *restrict); diff --git a/libgamma_partition_initialise.c b/libgamma_partition_initialise.c index 4f2e763..79eff18 100644 --- a/libgamma_partition_initialise.c +++ b/libgamma_partition_initialise.c @@ -12,7 +12,8 @@ * error identifier provided by this library */ int -libgamma_partition_initialise(libgamma_partition_state_t *restrict this, libgamma_site_state_t *restrict site, size_t partition) +libgamma_partition_initialise(struct libgamma_partition_state *restrict this, + struct libgamma_site_state *restrict site, size_t partition) { this->site = site; this->partition = partition; diff --git a/libgamma_partition_restore.c b/libgamma_partition_restore.c index e1ff6bb..657fa55 100644 --- a/libgamma_partition_restore.c +++ b/libgamma_partition_restore.c @@ -10,7 +10,7 @@ * error identifier provided by this library */ int -libgamma_partition_restore(libgamma_partition_state_t *restrict this) +libgamma_partition_restore(struct libgamma_partition_state *restrict this) { switch (this->site->method) { #define X(CONST, CNAME, ...)\ diff --git a/libgamma_quartz_cg_crtc_destroy.c b/libgamma_quartz_cg_crtc_destroy.c index 9bf5ed9..bec00a1 100644 --- a/libgamma_quartz_cg_crtc_destroy.c +++ b/libgamma_quartz_cg_crtc_destroy.c @@ -9,7 +9,7 @@ * @param this The CRTC state */ void -libgamma_quartz_cg_crtc_destroy(libgamma_crtc_state_t *restrict this) +libgamma_quartz_cg_crtc_destroy(struct libgamma_crtc_state *restrict this) { (void) this; } diff --git a/libgamma_quartz_cg_crtc_get_gamma_rampsf.c b/libgamma_quartz_cg_crtc_get_gamma_rampsf.c index bb12779..3f03437 100644 --- a/libgamma_quartz_cg_crtc_get_gamma_rampsf.c +++ b/libgamma_quartz_cg_crtc_get_gamma_rampsf.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_quartz_cg_crtc_get_gamma_rampsf(libgamma_crtc_state_t *restrict this, libgamma_gamma_rampsf_t *restrict ramps) +libgamma_quartz_cg_crtc_get_gamma_rampsf(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_rampsf *restrict ramps) { CGDirectDisplayID *restrict crtcs = this->partition->data; CGDirectDisplayID crtc_id = crtcs[this->crtc]; diff --git a/libgamma_quartz_cg_crtc_initialise.c b/libgamma_quartz_cg_crtc_initialise.c index f79db95..91c724c 100644 --- a/libgamma_quartz_cg_crtc_initialise.c +++ b/libgamma_quartz_cg_crtc_initialise.c @@ -14,8 +14,8 @@ * error identifier provided by this library */ int -libgamma_quartz_cg_crtc_initialise(libgamma_crtc_state_t *restrict this, - libgamma_partition_state_t *restrict partition, size_t crtc) +libgamma_quartz_cg_crtc_initialise(struct libgamma_crtc_state *restrict this, + struct libgamma_partition_state *restrict partition, size_t crtc) { (void) this; return crtc < partition->crtcs_available ? 0 : LIBGAMMA_NO_SUCH_CRTC; diff --git a/libgamma_quartz_cg_crtc_restore.c b/libgamma_quartz_cg_crtc_restore.c index 3958873..60fb5a9 100644 --- a/libgamma_quartz_cg_crtc_restore.c +++ b/libgamma_quartz_cg_crtc_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_quartz_cg_crtc_restore(libgamma_crtc_state_t *restrict this) +libgamma_quartz_cg_crtc_restore(struct libgamma_crtc_state *restrict this) { (void) this; errno = ENOTSUP; diff --git a/libgamma_quartz_cg_crtc_set_gamma_rampsf.c b/libgamma_quartz_cg_crtc_set_gamma_rampsf.c index 7f53656..406a936 100644 --- a/libgamma_quartz_cg_crtc_set_gamma_rampsf.c +++ b/libgamma_quartz_cg_crtc_set_gamma_rampsf.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_quartz_cg_crtc_set_gamma_rampsf(libgamma_crtc_state_t *restrict this, const libgamma_gamma_rampsf_t *restrict ramps) +libgamma_quartz_cg_crtc_set_gamma_rampsf(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_rampsf *restrict ramps) { CGDirectDisplayID *restrict crtcs = this->partition->data; CGDirectDisplayID crtc_id = crtcs[this->crtc]; diff --git a/libgamma_quartz_cg_get_crtc_information.c b/libgamma_quartz_cg_get_crtc_information.c index 8104075..386dead 100644 --- a/libgamma_quartz_cg_get_crtc_information.c +++ b/libgamma_quartz_cg_get_crtc_information.c @@ -13,8 +13,8 @@ * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ int -libgamma_quartz_cg_get_crtc_information(libgamma_crtc_information_t *restrict this, - libgamma_crtc_state_t *restrict crtc, unsigned long long fields) +libgamma_quartz_cg_get_crtc_information(struct libgamma_crtc_information *restrict this, + struct libgamma_crtc_state *restrict crtc, unsigned long long fields) { #define SUPPORTED_FIELDS (LIBGAMMA_CRTC_INFO_GAMMA_SIZE | LIBGAMMA_CRTC_INFO_GAMMA_DEPTH) #define _E(FIELD) ((fields & FIELD) ? LIBGAMMA_CRTC_INFO_NOT_SUPPORTED : 0) diff --git a/libgamma_quartz_cg_method_capabilities.c b/libgamma_quartz_cg_method_capabilities.c index 30a3a4d..1993f5f 100644 --- a/libgamma_quartz_cg_method_capabilities.c +++ b/libgamma_quartz_cg_method_capabilities.c @@ -9,7 +9,7 @@ * @param this The data structure to fill with the method's capabilities */ void -libgamma_quartz_cg_method_capabilities(libgamma_method_capabilities_t* restrict this) +libgamma_quartz_cg_method_capabilities(struct libgamma_method_capabilities *restrict this) { /* Gamma ramps size and depth can be queried */ this->crtc_information = LIBGAMMA_CRTC_INFO_GAMMA_SIZE | LIBGAMMA_CRTC_INFO_GAMMA_DEPTH; diff --git a/libgamma_quartz_cg_partition_destroy.c b/libgamma_quartz_cg_partition_destroy.c index 0e6473c..10be772 100644 --- a/libgamma_quartz_cg_partition_destroy.c +++ b/libgamma_quartz_cg_partition_destroy.c @@ -9,7 +9,7 @@ * @param this The partition state */ void -libgamma_quartz_cg_partition_destroy(libgamma_partition_state_t *restrict this) +libgamma_quartz_cg_partition_destroy(struct libgamma_partition_state *restrict this) { free(this->data); } diff --git a/libgamma_quartz_cg_partition_initialise.c b/libgamma_quartz_cg_partition_initialise.c index dbdec9e..80fb4fc 100644 --- a/libgamma_quartz_cg_partition_initialise.c +++ b/libgamma_quartz_cg_partition_initialise.c @@ -13,8 +13,8 @@ * error identifier provided by this library */ int -libgamma_quartz_cg_partition_initialise(libgamma_partition_state_t *restrict this, - libgamma_site_state_t *restrict site, size_t partition) +libgamma_quartz_cg_partition_initialise(struct libgamma_partition_state *restrict this, + struct libgamma_site_state *restrict site, size_t partition) { CGDirectDisplayID *crtcs, *crtcs_old; uint32_t cap = 4, n; diff --git a/libgamma_quartz_cg_partition_restore.c b/libgamma_quartz_cg_partition_restore.c index 6c85b41..f104738 100644 --- a/libgamma_quartz_cg_partition_restore.c +++ b/libgamma_quartz_cg_partition_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_quartz_cg_partition_restore(libgamma_partition_state_t *restrict this) +libgamma_quartz_cg_partition_restore(struct libgamma_partition_state *restrict this) { return libgamma_quartz_cg_site_restore(this->site); } diff --git a/libgamma_quartz_cg_site_destroy.c b/libgamma_quartz_cg_site_destroy.c index d127820..ef41b44 100644 --- a/libgamma_quartz_cg_site_destroy.c +++ b/libgamma_quartz_cg_site_destroy.c @@ -9,7 +9,7 @@ * @param this The site state */ void -libgamma_quartz_cg_site_destroy(libgamma_site_state_t *restrict this) +libgamma_quartz_cg_site_destroy(struct libgamma_site_state *restrict this) { (void) this; close_fake_quartz_cg(); diff --git a/libgamma_quartz_cg_site_initialise.c b/libgamma_quartz_cg_site_initialise.c index e42155b..cc47e3a 100644 --- a/libgamma_quartz_cg_site_initialise.c +++ b/libgamma_quartz_cg_site_initialise.c @@ -17,7 +17,7 @@ * error identifier provided by this library */ int -libgamma_quartz_cg_site_initialise(libgamma_site_state_t *restrict this, char *restrict site) +libgamma_quartz_cg_site_initialise(struct libgamma_site_state *restrict this, char *restrict site) { this->partitions_available = 1; return site ? 0 : LIBGAMMA_NO_SUCH_SITE; diff --git a/libgamma_quartz_cg_site_restore.c b/libgamma_quartz_cg_site_restore.c index 101e8d6..7a0be2d 100644 --- a/libgamma_quartz_cg_site_restore.c +++ b/libgamma_quartz_cg_site_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_quartz_cg_site_restore(libgamma_site_state_t *restrict this) +libgamma_quartz_cg_site_restore(struct libgamma_site_state *restrict this) { (void) this; CGDisplayRestoreColorSyncSettings(); diff --git a/libgamma_site_destroy.c b/libgamma_site_destroy.c index 83b640b..4ccc795 100644 --- a/libgamma_site_destroy.c +++ b/libgamma_site_destroy.c @@ -8,7 +8,7 @@ * @param this The site state */ void -libgamma_site_destroy(libgamma_site_state_t *restrict this) +libgamma_site_destroy(struct libgamma_site_state *restrict this) { switch (this->method) { #define X(CONST, CNAME, ...)\ diff --git a/libgamma_site_free.c b/libgamma_site_free.c index 142ce70..a9283ec 100644 --- a/libgamma_site_free.c +++ b/libgamma_site_free.c @@ -8,4 +8,4 @@ * * @param this The site state */ -extern inline void libgamma_site_free(libgamma_site_state_t *restrict this); +extern inline void libgamma_site_free(struct libgamma_site_state *restrict this); diff --git a/libgamma_site_initialise.c b/libgamma_site_initialise.c index 15d7680..ae0889a 100644 --- a/libgamma_site_initialise.c +++ b/libgamma_site_initialise.c @@ -17,7 +17,7 @@ * error identifier provided by this library */ int -libgamma_site_initialise(libgamma_site_state_t *restrict this, int method, char *restrict site) +libgamma_site_initialise(struct libgamma_site_state *restrict this, int method, char *restrict site) { this->method = method; this->site = site; diff --git a/libgamma_site_restore.c b/libgamma_site_restore.c index 52be79e..123d18a 100644 --- a/libgamma_site_restore.c +++ b/libgamma_site_restore.c @@ -10,7 +10,7 @@ * error identifier provided by this library */ int -libgamma_site_restore(libgamma_site_state_t *restrict this) +libgamma_site_restore(struct libgamma_site_state *restrict this) { switch (this->method) { #define X(CONST, CNAME, ...)\ diff --git a/libgamma_w32_gdi_crtc_destroy.c b/libgamma_w32_gdi_crtc_destroy.c index c0f2dfe..886da00 100644 --- a/libgamma_w32_gdi_crtc_destroy.c +++ b/libgamma_w32_gdi_crtc_destroy.c @@ -9,7 +9,7 @@ * @param this The CRTC state */ void -libgamma_w32_gdi_crtc_destroy(libgamma_crtc_state_t *restrict this) +libgamma_w32_gdi_crtc_destroy(struct libgamma_crtc_state *restrict this) { if (this->data) ReleaseDC(NULL, this->data); diff --git a/libgamma_w32_gdi_crtc_get_gamma_ramps16.c b/libgamma_w32_gdi_crtc_get_gamma_ramps16.c index 6d62ded..a44b973 100644 --- a/libgamma_w32_gdi_crtc_get_gamma_ramps16.c +++ b/libgamma_w32_gdi_crtc_get_gamma_ramps16.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_w32_gdi_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps16_t *restrict ramps) +libgamma_w32_gdi_crtc_get_gamma_ramps16(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps16 *restrict ramps) { #ifdef DEBUG /* Windows GDI have fixed gamma ramp sizes */ diff --git a/libgamma_w32_gdi_crtc_initialise.c b/libgamma_w32_gdi_crtc_initialise.c index eafa61b..5b75e3a 100644 --- a/libgamma_w32_gdi_crtc_initialise.c +++ b/libgamma_w32_gdi_crtc_initialise.c @@ -14,8 +14,8 @@ * error identifier provided by this library */ int -libgamma_w32_gdi_crtc_initialise(libgamma_crtc_state_t *restrict this, - libgamma_partition_state_t *restrict partition, size_t crtc) +libgamma_w32_gdi_crtc_initialise(struct libgamma_crtc_state *restrict this, + struct libgamma_partition_state *restrict partition, size_t crtc) { DISPLAY_DEVICE display; HDC context; diff --git a/libgamma_w32_gdi_crtc_restore.c b/libgamma_w32_gdi_crtc_restore.c index 54b28b5..e50d0b6 100644 --- a/libgamma_w32_gdi_crtc_restore.c +++ b/libgamma_w32_gdi_crtc_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_w32_gdi_crtc_restore(libgamma_crtc_state_t *restrict this) +libgamma_w32_gdi_crtc_restore(struct libgamma_crtc_state *restrict this) { (void) this; errno = ENOTSUP; diff --git a/libgamma_w32_gdi_crtc_set_gamma_ramps16.c b/libgamma_w32_gdi_crtc_set_gamma_ramps16.c index a9a7624..081cc0e 100644 --- a/libgamma_w32_gdi_crtc_set_gamma_ramps16.c +++ b/libgamma_w32_gdi_crtc_set_gamma_ramps16.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_w32_gdi_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict this, const libgamma_gamma_ramps16_t *restrict ramps) +libgamma_w32_gdi_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_ramps16 *restrict ramps) { #ifdef DEBUG /* Windows GDI have fixed gamma ramp sizes */ diff --git a/libgamma_w32_gdi_get_crtc_information.c b/libgamma_w32_gdi_get_crtc_information.c index d7bda38..74c9d73 100644 --- a/libgamma_w32_gdi_get_crtc_information.c +++ b/libgamma_w32_gdi_get_crtc_information.c @@ -13,8 +13,8 @@ * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ int -libgamma_w32_gdi_get_crtc_information(libgamma_crtc_information_t *restrict this, - libgamma_crtc_state_t *restrict crtc, unsigned long long fields) +libgamma_w32_gdi_get_crtc_information(struct libgamma_crtc_information *restrict this, + struct libgamma_crtc_state *restrict crtc, unsigned long long fields) { #define KNOWN_FIELDS (LIBGAMMA_CRTC_INFO_GAMMA_SIZE | LIBGAMMA_CRTC_INFO_GAMMA_DEPTH) #define _E(FIELD) ((fields & FIELD) ? LIBGAMMA_CRTC_INFO_NOT_SUPPORTED : 0) diff --git a/libgamma_w32_gdi_method_capabilities.c b/libgamma_w32_gdi_method_capabilities.c index f6e5a23..163073b 100644 --- a/libgamma_w32_gdi_method_capabilities.c +++ b/libgamma_w32_gdi_method_capabilities.c @@ -9,7 +9,7 @@ * @param this The data structure to fill with the method's capabilities */ void -libgamma_w32_gdi_method_capabilities(libgamma_method_capabilities_t *restrict this) +libgamma_w32_gdi_method_capabilities(struct libgamma_method_capabilities *restrict this) { /* Gamma ramps size, depth and support can be queried */ this->crtc_information = LIBGAMMA_CRTC_INFO_GAMMA_SIZE | LIBGAMMA_CRTC_INFO_GAMMA_DEPTH; diff --git a/libgamma_w32_gdi_partition_destroy.c b/libgamma_w32_gdi_partition_destroy.c index 95445d8..0a85f36 100644 --- a/libgamma_w32_gdi_partition_destroy.c +++ b/libgamma_w32_gdi_partition_destroy.c @@ -9,7 +9,7 @@ * @param this The partition state */ void -libgamma_w32_gdi_partition_destroy(libgamma_partition_state_t *restrict this) +libgamma_w32_gdi_partition_destroy(struct libgamma_partition_state *restrict this) { (void) this; } diff --git a/libgamma_w32_gdi_partition_initialise.c b/libgamma_w32_gdi_partition_initialise.c index 1220f8f..1bd3f5c 100644 --- a/libgamma_w32_gdi_partition_initialise.c +++ b/libgamma_w32_gdi_partition_initialise.c @@ -14,8 +14,8 @@ * error identifier provided by this library */ int -libgamma_w32_gdi_partition_initialise(libgamma_partition_state_t *restrict this, - libgamma_site_state_t *restrict site, size_t partition) +libgamma_w32_gdi_partition_initialise(struct libgamma_partition_state *restrict this, + struct libgamma_site_state *restrict site, size_t partition) { DWORD n = 0; DISPLAY_DEVICE display; diff --git a/libgamma_w32_gdi_partition_restore.c b/libgamma_w32_gdi_partition_restore.c index d11de5c..3a8aead 100644 --- a/libgamma_w32_gdi_partition_restore.c +++ b/libgamma_w32_gdi_partition_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_w32_gdi_partition_restore(libgamma_partition_state_t *restrict this) +libgamma_w32_gdi_partition_restore(struct libgamma_partition_state *restrict this) { (void) this; errno = ENOTSUP; diff --git a/libgamma_w32_gdi_site_destroy.c b/libgamma_w32_gdi_site_destroy.c index 461958b..8acd443 100644 --- a/libgamma_w32_gdi_site_destroy.c +++ b/libgamma_w32_gdi_site_destroy.c @@ -9,7 +9,7 @@ * @param this The site state */ void -libgamma_w32_gdi_site_destroy(libgamma_site_state_t *restrict this) +libgamma_w32_gdi_site_destroy(struct libgamma_site_state *restrict this) { (void) this; } diff --git a/libgamma_w32_gdi_site_initialise.c b/libgamma_w32_gdi_site_initialise.c index 423e958..b6c6cc8 100644 --- a/libgamma_w32_gdi_site_initialise.c +++ b/libgamma_w32_gdi_site_initialise.c @@ -17,7 +17,7 @@ * error identifier provided by this library */ int -libgamma_w32_gdi_site_initialise(libgamma_site_state_t *restrict this, char* restrict site) +libgamma_w32_gdi_site_initialise(struct libgamma_site_state *restrict this, char *restrict site) { this->partitions_available = 1; return !site ? 0 : LIBGAMMA_NO_SUCH_SITE; diff --git a/libgamma_w32_gdi_site_restore.c b/libgamma_w32_gdi_site_restore.c index 4cf963f..8a530bb 100644 --- a/libgamma_w32_gdi_site_restore.c +++ b/libgamma_w32_gdi_site_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_w32_gdi_site_restore(libgamma_site_state_t *restrict this) +libgamma_w32_gdi_site_restore(struct libgamma_site_state *restrict this) { (void) this; errno = ENOTSUP; diff --git a/libgamma_x_randr_crtc_destroy.c b/libgamma_x_randr_crtc_destroy.c index 476aeaa..beda511 100644 --- a/libgamma_x_randr_crtc_destroy.c +++ b/libgamma_x_randr_crtc_destroy.c @@ -9,7 +9,7 @@ * @param this The CRTC state */ void -libgamma_x_randr_crtc_destroy(libgamma_crtc_state_t *restrict this) +libgamma_x_randr_crtc_destroy(struct libgamma_crtc_state *restrict this) { (void) this; } diff --git a/libgamma_x_randr_crtc_get_gamma_ramps16.c b/libgamma_x_randr_crtc_get_gamma_ramps16.c index 5e6ad5d..7cc737a 100644 --- a/libgamma_x_randr_crtc_get_gamma_ramps16.c +++ b/libgamma_x_randr_crtc_get_gamma_ramps16.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_x_randr_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps16_t *restrict ramps) +libgamma_x_randr_crtc_get_gamma_ramps16(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps16 *restrict ramps) { xcb_connection_t *restrict connection = this->partition->site->data; xcb_randr_get_crtc_gamma_cookie_t cookie; @@ -41,9 +41,9 @@ libgamma_x_randr_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict this, li green = xcb_randr_get_crtc_gamma_green(reply); blue = xcb_randr_get_crtc_gamma_blue(reply); /* Copy over the gamma ramps to our memory */ - memcpy(ramps->red, red, ramps->red_size * sizeof(uint16_t)); - memcpy(ramps->green, green, ramps->green_size * sizeof(uint16_t)); - memcpy(ramps->blue, blue, ramps->blue_size * sizeof(uint16_t)); + memcpy(ramps->red, red, ramps->red_size * sizeof(*red)); + memcpy(ramps->green, green, ramps->green_size * sizeof(*green)); + memcpy(ramps->blue, blue, ramps->blue_size * sizeof(*blue)); free(reply); return 0; diff --git a/libgamma_x_randr_crtc_initialise.c b/libgamma_x_randr_crtc_initialise.c index 808b2c2..150c390 100644 --- a/libgamma_x_randr_crtc_initialise.c +++ b/libgamma_x_randr_crtc_initialise.c @@ -13,10 +13,10 @@ * error identifier provided by this library */ int -libgamma_x_randr_crtc_initialise(libgamma_crtc_state_t *restrict this, - libgamma_partition_state_t *restrict partition, size_t crtc) +libgamma_x_randr_crtc_initialise(struct libgamma_crtc_state *restrict this, + struct libgamma_partition_state *restrict partition, size_t crtc) { - libgamma_x_randr_partition_data_t *restrict screen_data = partition->data; + struct libgamma_x_randr_partition_data *restrict screen_data = partition->data; xcb_randr_crtc_t *restrict crtc_ids = screen_data->crtcs; this->data = crtc_ids + crtc; return crtc < partition->crtcs_available ? 0 : LIBGAMMA_NO_SUCH_CRTC; diff --git a/libgamma_x_randr_crtc_restore.c b/libgamma_x_randr_crtc_restore.c index c8eb9b9..fe4836e 100644 --- a/libgamma_x_randr_crtc_restore.c +++ b/libgamma_x_randr_crtc_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_x_randr_crtc_restore(libgamma_crtc_state_t *restrict this) +libgamma_x_randr_crtc_restore(struct libgamma_crtc_state *restrict this) { (void) this; errno = ENOTSUP; diff --git a/libgamma_x_randr_crtc_set_gamma_ramps16.c b/libgamma_x_randr_crtc_set_gamma_ramps16.c index 5bb9bb3..9b2ed16 100644 --- a/libgamma_x_randr_crtc_set_gamma_ramps16.c +++ b/libgamma_x_randr_crtc_set_gamma_ramps16.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_x_randr_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict this, const libgamma_gamma_ramps16_t *ramps) +libgamma_x_randr_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict this, const struct libgamma_gamma_ramps16 *ramps) { xcb_connection_t *restrict connection = this->partition->site->data; xcb_void_cookie_t cookie; diff --git a/libgamma_x_randr_get_crtc_information.c b/libgamma_x_randr_get_crtc_information.c index c457bd6..8bf2e8f 100644 --- a/libgamma_x_randr_get_crtc_information.c +++ b/libgamma_x_randr_get_crtc_information.c @@ -11,7 +11,7 @@ * @return Non-zero on error */ static int -get_gamma_ramp_size(libgamma_crtc_information_t *restrict out, libgamma_crtc_state_t *restrict crtc) +get_gamma_ramp_size(struct libgamma_crtc_information *restrict out, struct libgamma_crtc_state *restrict crtc) { xcb_connection_t *restrict connection = crtc->partition->site->data; xcb_randr_crtc_t *restrict crtc_id = crtc->data; @@ -47,7 +47,7 @@ get_gamma_ramp_size(libgamma_crtc_information_t *restrict out, libgamma_crtc_sta * @return Non-zero if at least on error occured */ static int -read_output_data(libgamma_crtc_information_t *restrict out, xcb_randr_get_output_info_reply_t *restrict output) +read_output_data(struct libgamma_crtc_information *restrict out, xcb_randr_get_output_info_reply_t *restrict output) { switch (output->connection) { case XCB_RANDR_CONNECTION_CONNECTED: @@ -92,7 +92,7 @@ read_output_data(libgamma_crtc_information_t *restrict out, xcb_randr_get_output * @param Non-zero on error */ static int -get_connector_type(libgamma_crtc_information_t *restrict this) +get_connector_type(struct libgamma_crtc_information *restrict this) { /* Since we require the name of the output of get the type of the connected, * copy any reported error on the output's name to the connector's type, @@ -100,7 +100,7 @@ get_connector_type(libgamma_crtc_information_t *restrict this) if ((this->connector_type_error = this->connector_name_error)) return -1; -#define __select(name, type)\ +#define SELECT(name, type)\ do {\ if (strstr(this->connector_name, name "-") == this->connector_name) {\ this->connector_type = LIBGAMMA_CONNECTOR_TYPE_##type;\ @@ -109,21 +109,21 @@ get_connector_type(libgamma_crtc_information_t *restrict this) } while (0) /* Check begin on the name of the output to find out what type the connector is of */ - __select ("None", Unknown); - __select ("VGA", VGA); - __select ("DVI-I", DVII); - __select ("DVI-D", DVID); - __select ("DVI-A", DVIA); - __select ("DVI", DVI); - __select ("Composite", Composite); - __select ("S-Video", SVIDEO); - __select ("Component", Component); - __select ("LFP", LFP); - __select ("Proprietary", Unknown); - __select ("HDMI", HDMI); - __select ("DisplayPort", DisplayPort); - -#undef __select + SELECT ("None", Unknown); + SELECT ("VGA", VGA); + SELECT ("DVI-I", DVII); + SELECT ("DVI-D", DVID); + SELECT ("DVI-A", DVIA); + SELECT ("DVI", DVI); + SELECT ("Composite", Composite); + SELECT ("S-Video", SVIDEO); + SELECT ("Component", Component); + SELECT ("LFP", LFP); + SELECT ("Proprietary", Unknown); + SELECT ("HDMI", HDMI); + SELECT ("DisplayPort", DisplayPort); + +#undef SELECT /* If there was no matching output name pattern report that and exit with an error */ this->connector_name_error = LIBGAMMA_CONNECTOR_TYPE_NOT_RECOGNISED; @@ -139,7 +139,7 @@ get_connector_type(libgamma_crtc_information_t *restrict this) * @return Non-zero on error */ static int -get_output_name(libgamma_crtc_information_t *restrict out, xcb_randr_get_output_info_reply_t *restrict output) +get_output_name(struct libgamma_crtc_information *restrict out, xcb_randr_get_output_info_reply_t *restrict output) { char *restrict store; uint8_t *restrict name; @@ -178,7 +178,7 @@ get_output_name(libgamma_crtc_information_t *restrict out, xcb_randr_get_output_ * @return Non-zero on error */ static int -get_edid(libgamma_crtc_information_t *restrict out, libgamma_crtc_state_t *restrict crtc, xcb_randr_output_t output) +get_edid(struct libgamma_crtc_information *restrict out, struct libgamma_crtc_state *restrict crtc, xcb_randr_output_t output) { xcb_connection_t *restrict connection = crtc->partition->site->data; xcb_randr_list_output_properties_cookie_t prop_cookie; @@ -192,7 +192,7 @@ get_edid(libgamma_crtc_information_t *restrict out, libgamma_crtc_state_t *restr int atom_name_len; xcb_randr_get_output_property_cookie_t atom_cookie; xcb_randr_get_output_property_reply_t *restrict atom_reply; - unsigned char* restrict atom_data; + unsigned char *restrict atom_data; int length; /* Acquire a list of all properties of the output */ @@ -290,8 +290,8 @@ get_edid(libgamma_crtc_information_t *restrict out, libgamma_crtc_state_t *restr * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ int -libgamma_x_randr_get_crtc_information(libgamma_crtc_information_t *restrict this, - libgamma_crtc_state_t *restrict crtc, unsigned long long fields) +libgamma_x_randr_get_crtc_information(struct libgamma_crtc_information *restrict this, + struct libgamma_crtc_state *restrict crtc, unsigned long long fields) { #define _E(FIELD) ((fields & FIELD) ? LIBGAMMA_CRTC_INFO_NOT_SUPPORTED : 0) @@ -300,13 +300,13 @@ libgamma_x_randr_get_crtc_information(libgamma_crtc_information_t *restrict this xcb_randr_output_t output; int free_edid, free_name; xcb_connection_t *restrict connection; - libgamma_x_randr_partition_data_t *restrict screen_data; + struct libgamma_x_randr_partition_data *restrict screen_data; size_t output_index; xcb_randr_get_output_info_cookie_t cookie; xcb_generic_error_t *error; /* Wipe all error indicators */ - memset(this, 0, sizeof(libgamma_crtc_information_t)); + memset(this, 0, sizeof(*this)); /* We need to free the EDID after us if it is not explicitly requested */ free_edid = !(fields & LIBGAMMA_CRTC_INFO_EDID); diff --git a/libgamma_x_randr_internal_translate_error.c b/libgamma_x_randr_internal_translate_error.c index 7752c03..67356d9 100644 --- a/libgamma_x_randr_internal_translate_error.c +++ b/libgamma_x_randr_internal_translate_error.c @@ -16,13 +16,13 @@ libgamma_x_randr_internal_translate_error(int error_code, int default_error, int { int r = LIBGAMMA_ERRNO_SET; switch (error_code) { - case XCB_CONN_ERROR: errno = ECONNABORTED; break; - case XCB_CONN_CLOSED_EXT_NOTSUPPORTED: errno = ENOPROTOOPT; break; - case XCB_CONN_CLOSED_MEM_INSUFFICIENT: errno = ENOMEM; break; - case XCB_CONN_CLOSED_REQ_LEN_EXCEED: errno = EMSGSIZE; break; - case XCB_CONN_CLOSED_PARSE_ERR: r = LIBGAMMA_NO_SUCH_SITE; break; + case XCB_CONN_ERROR: errno = ECONNABORTED; break; + case XCB_CONN_CLOSED_EXT_NOTSUPPORTED: errno = ENOPROTOOPT; break; + case XCB_CONN_CLOSED_MEM_INSUFFICIENT: errno = ENOMEM; break; + case XCB_CONN_CLOSED_REQ_LEN_EXCEED: errno = EMSGSIZE; break; + case XCB_CONN_CLOSED_PARSE_ERR: r = LIBGAMMA_NO_SUCH_SITE; break; case XCB_CONN_CLOSED_INVALID_SCREEN: r = LIBGAMMA_NO_SUCH_PARTITION; break; - case XCB_CONN_CLOSED_FDPASSING_FAILED: errno = EIO; break; + case XCB_CONN_CLOSED_FDPASSING_FAILED: errno = EIO; break; default: r = default_error; break; diff --git a/libgamma_x_randr_method_capabilities.c b/libgamma_x_randr_method_capabilities.c index 4371ecc..17e9b0e 100644 --- a/libgamma_x_randr_method_capabilities.c +++ b/libgamma_x_randr_method_capabilities.c @@ -9,7 +9,7 @@ * @param this The data structure to fill with the method's capabilities */ void -libgamma_x_randr_method_capabilities(libgamma_method_capabilities_t *restrict this) +libgamma_x_randr_method_capabilities(struct libgamma_method_capabilities *restrict this) { char *display = getenv("DISPLAY"); /* Support for all information except active status and gamma ramp support. diff --git a/libgamma_x_randr_partition_destroy.c b/libgamma_x_randr_partition_destroy.c index a48a02d..996149b 100644 --- a/libgamma_x_randr_partition_destroy.c +++ b/libgamma_x_randr_partition_destroy.c @@ -9,9 +9,9 @@ * @param this The partition state */ void -libgamma_x_randr_partition_destroy(libgamma_partition_state_t *restrict this) +libgamma_x_randr_partition_destroy(struct libgamma_partition_state *restrict this) { - libgamma_x_randr_partition_data_t *restrict data = this->data; + struct libgamma_x_randr_partition_data *restrict data = this->data; free(data->crtcs); free(data->outputs); free(data->crtc_to_output); diff --git a/libgamma_x_randr_partition_initialise.c b/libgamma_x_randr_partition_initialise.c index aa5df50..fae2442 100644 --- a/libgamma_x_randr_partition_initialise.c +++ b/libgamma_x_randr_partition_initialise.c @@ -34,8 +34,8 @@ xmemdup(void *restrict ptr, size_t bytes) * error identifier provided by this library */ int -libgamma_x_randr_partition_initialise(libgamma_partition_state_t *restrict this, - libgamma_site_state_t *restrict site, size_t partition) +libgamma_x_randr_partition_initialise(struct libgamma_partition_state *restrict this, + struct libgamma_site_state *restrict site, size_t partition) { int fail_rc = LIBGAMMA_ERRNO_SET; xcb_connection_t *restrict connection = site->data; @@ -47,7 +47,7 @@ libgamma_x_randr_partition_initialise(libgamma_partition_state_t *restrict this, xcb_randr_get_screen_resources_current_reply_t *restrict reply; xcb_randr_crtc_t *restrict crtcs; xcb_randr_output_t *restrict outputs; - libgamma_x_randr_partition_data_t *restrict data; + struct libgamma_x_randr_partition_data *restrict data; xcb_randr_get_output_info_cookie_t out_cookie; xcb_randr_get_output_info_reply_t *out_reply; size_t i; @@ -92,17 +92,17 @@ libgamma_x_randr_partition_initialise(libgamma_partition_state_t *restrict this, /* Allocate adjustment method dependent data memory area. We use `calloc` because we want `data`'s pointers to be `NULL` if not allocated at `fail`. */ - data = calloc(1, sizeof(libgamma_x_randr_partition_data_t)); + data = calloc(1, sizeof(*data)); if (!data) goto fail; /* Copy the CRTC:s, just so we do not have to keep the reply in memory */ - data->crtcs = xmemdup(crtcs, (size_t)(reply->num_crtcs) * sizeof(xcb_randr_crtc_t)); + data->crtcs = xmemdup(crtcs, (size_t)reply->num_crtcs * sizeof(*crtcs)); if (!data->crtcs && reply->num_crtcs > 0) goto fail; /* Copy the outputs as well */ - data->outputs = xmemdup(outputs, (size_t)reply->num_outputs * sizeof(xcb_randr_output_t)); + data->outputs = xmemdup(outputs, (size_t)reply->num_outputs * sizeof(*outputs)); if (!data->outputs && reply->num_outputs > 0) goto fail; @@ -110,7 +110,7 @@ libgamma_x_randr_partition_initialise(libgamma_partition_state_t *restrict this, data->outputs_count = (size_t)reply->num_outputs; /* Create mapping table from CRTC indices to output indicies. (injection) */ - data->crtc_to_output = malloc((size_t)reply->num_crtcs * sizeof(size_t)); + data->crtc_to_output = malloc((size_t)reply->num_crtcs * sizeof(*data->crtc_to_output)); if (!data->crtc_to_output) goto fail; /* All CRTC:s should be mapped, but incase they are not, all unmapped CRTC:s should have diff --git a/libgamma_x_randr_partition_restore.c b/libgamma_x_randr_partition_restore.c index ebe16c9..5236433 100644 --- a/libgamma_x_randr_partition_restore.c +++ b/libgamma_x_randr_partition_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_x_randr_partition_restore(libgamma_partition_state_t *restrict this) +libgamma_x_randr_partition_restore(struct libgamma_partition_state *restrict this) { (void) this; errno = ENOTSUP; diff --git a/libgamma_x_randr_site_destroy.c b/libgamma_x_randr_site_destroy.c index ba4d836..96a40df 100644 --- a/libgamma_x_randr_site_destroy.c +++ b/libgamma_x_randr_site_destroy.c @@ -9,7 +9,7 @@ * @param this The site state */ void -libgamma_x_randr_site_destroy(libgamma_site_state_t *restrict this) +libgamma_x_randr_site_destroy(struct libgamma_site_state *restrict this) { xcb_disconnect((xcb_connection_t *)this->data); } diff --git a/libgamma_x_randr_site_initialise.c b/libgamma_x_randr_site_initialise.c index 61c011b..f582748 100644 --- a/libgamma_x_randr_site_initialise.c +++ b/libgamma_x_randr_site_initialise.c @@ -17,7 +17,7 @@ * error identifier provided by this library */ int -libgamma_x_randr_site_initialise(libgamma_site_state_t *restrict this, char *restrict site) +libgamma_x_randr_site_initialise(struct libgamma_site_state *restrict this, char *restrict site) { xcb_generic_error_t *error = NULL; xcb_connection_t *restrict connection; diff --git a/libgamma_x_randr_site_restore.c b/libgamma_x_randr_site_restore.c index 5cf5d07..6b96b58 100644 --- a/libgamma_x_randr_site_restore.c +++ b/libgamma_x_randr_site_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_x_randr_site_restore(libgamma_site_state_t *restrict this) +libgamma_x_randr_site_restore(struct libgamma_site_state *restrict this) { (void) this; errno = ENOTSUP; diff --git a/libgamma_x_vidmode_crtc_destroy.c b/libgamma_x_vidmode_crtc_destroy.c index 3c1facc..7be52ad 100644 --- a/libgamma_x_vidmode_crtc_destroy.c +++ b/libgamma_x_vidmode_crtc_destroy.c @@ -9,7 +9,7 @@ * @param this The CRTC state */ void -libgamma_x_vidmode_crtc_destroy(libgamma_crtc_state_t *restrict this) +libgamma_x_vidmode_crtc_destroy(struct libgamma_crtc_state *restrict this) { (void) this; } diff --git a/libgamma_x_vidmode_crtc_get_gamma_ramps16.c b/libgamma_x_vidmode_crtc_get_gamma_ramps16.c index ca52556..3667624 100644 --- a/libgamma_x_vidmode_crtc_get_gamma_ramps16.c +++ b/libgamma_x_vidmode_crtc_get_gamma_ramps16.c @@ -12,7 +12,7 @@ * error identifier provided by this library */ int -libgamma_x_vidmode_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict this, libgamma_gamma_ramps16_t *restrict ramps) +libgamma_x_vidmode_crtc_get_gamma_ramps16(struct libgamma_crtc_state *restrict this, struct libgamma_gamma_ramps16 *restrict ramps) { #ifdef DEBUG /* Gamma ramp sizes are identical but not fixed */ diff --git a/libgamma_x_vidmode_crtc_initialise.c b/libgamma_x_vidmode_crtc_initialise.c index 8e4e59f..99ca574 100644 --- a/libgamma_x_vidmode_crtc_initialise.c +++ b/libgamma_x_vidmode_crtc_initialise.c @@ -13,8 +13,8 @@ * error identifier provided by this library */ int -libgamma_x_vidmode_crtc_initialise(libgamma_crtc_state_t *restrict this, - libgamma_partition_state_t *restrict partition, size_t crtc) +libgamma_x_vidmode_crtc_initialise(struct libgamma_crtc_state *restrict this, + struct libgamma_partition_state *restrict partition, size_t crtc) { (void) this; (void) partition; diff --git a/libgamma_x_vidmode_crtc_restore.c b/libgamma_x_vidmode_crtc_restore.c index 22cec37..861b447 100644 --- a/libgamma_x_vidmode_crtc_restore.c +++ b/libgamma_x_vidmode_crtc_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_x_vidmode_crtc_restore(libgamma_crtc_state_t *restrict this) +libgamma_x_vidmode_crtc_restore(struct libgamma_crtc_state *restrict this) { (void) this; errno = ENOTSUP; diff --git a/libgamma_x_vidmode_crtc_set_gamma_ramps16.c b/libgamma_x_vidmode_crtc_set_gamma_ramps16.c index c6d391d..6d83753 100644 --- a/libgamma_x_vidmode_crtc_set_gamma_ramps16.c +++ b/libgamma_x_vidmode_crtc_set_gamma_ramps16.c @@ -12,7 +12,8 @@ * error identifier provided by this library */ int -libgamma_x_vidmode_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict this, const libgamma_gamma_ramps16_t *restrict ramps) +libgamma_x_vidmode_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict this, + const struct libgamma_gamma_ramps16 *restrict ramps) { #ifdef DEBUG /* Gamma ramp sizes are identical but not fixed */ diff --git a/libgamma_x_vidmode_get_crtc_information.c b/libgamma_x_vidmode_get_crtc_information.c index 60b0a89..24d35c2 100644 --- a/libgamma_x_vidmode_get_crtc_information.c +++ b/libgamma_x_vidmode_get_crtc_information.c @@ -12,8 +12,8 @@ * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ int -libgamma_x_vidmode_get_crtc_information(libgamma_crtc_information_t *restrict this, - libgamma_crtc_state_t *restrict crtc, unsigned long long fields) +libgamma_x_vidmode_get_crtc_information(struct libgamma_crtc_information *restrict this, + struct libgamma_crtc_state *restrict crtc, unsigned long long fields) { #define _E(FIELD) ((fields & FIELD) ? LIBGAMMA_CRTC_INFO_NOT_SUPPORTED : 0) diff --git a/libgamma_x_vidmode_method_capabilities.c b/libgamma_x_vidmode_method_capabilities.c index c7893ba..29baa7c 100644 --- a/libgamma_x_vidmode_method_capabilities.c +++ b/libgamma_x_vidmode_method_capabilities.c @@ -9,7 +9,7 @@ * @param this The data structure to fill with the method's capabilities */ void -libgamma_x_vidmode_method_capabilities(libgamma_method_capabilities_t *restrict this) +libgamma_x_vidmode_method_capabilities(struct libgamma_method_capabilities *restrict this) { char *restrict display = getenv("DISPLAY"); /* Gamma ramps size and depth can be queried */ diff --git a/libgamma_x_vidmode_partition_destroy.c b/libgamma_x_vidmode_partition_destroy.c index 57fcf62..fc3c490 100644 --- a/libgamma_x_vidmode_partition_destroy.c +++ b/libgamma_x_vidmode_partition_destroy.c @@ -9,7 +9,7 @@ * @param this The partition state */ void -libgamma_x_vidmode_partition_destroy(libgamma_partition_state_t *restrict this) +libgamma_x_vidmode_partition_destroy(struct libgamma_partition_state *restrict this) { (void) this; } diff --git a/libgamma_x_vidmode_partition_initialise.c b/libgamma_x_vidmode_partition_initialise.c index e22d380..19c2823 100644 --- a/libgamma_x_vidmode_partition_initialise.c +++ b/libgamma_x_vidmode_partition_initialise.c @@ -13,8 +13,8 @@ * error identifier provided by this library */ int -libgamma_x_vidmode_partition_initialise(libgamma_partition_state_t *restrict this, - libgamma_site_state_t *restrict site, size_t partition) +libgamma_x_vidmode_partition_initialise(struct libgamma_partition_state *restrict this, + struct libgamma_site_state *restrict site, size_t partition) { this->crtcs_available = 1; return partition < site->partitions_available ? 0 : LIBGAMMA_NO_SUCH_PARTITION; diff --git a/libgamma_x_vidmode_partition_restore.c b/libgamma_x_vidmode_partition_restore.c index 0d04c71..337605b 100644 --- a/libgamma_x_vidmode_partition_restore.c +++ b/libgamma_x_vidmode_partition_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_x_vidmode_partition_restore(libgamma_partition_state_t *restrict this) +libgamma_x_vidmode_partition_restore(struct libgamma_partition_state *restrict this) { (void) this; errno = ENOTSUP; diff --git a/libgamma_x_vidmode_site_destroy.c b/libgamma_x_vidmode_site_destroy.c index a4a8bc2..8f716b3 100644 --- a/libgamma_x_vidmode_site_destroy.c +++ b/libgamma_x_vidmode_site_destroy.c @@ -9,7 +9,7 @@ * @param this The site state */ void -libgamma_x_vidmode_site_destroy(libgamma_site_state_t *restrict this) +libgamma_x_vidmode_site_destroy(struct libgamma_site_state *restrict this) { XCloseDisplay((Display *)this->data); } diff --git a/libgamma_x_vidmode_site_initialise.c b/libgamma_x_vidmode_site_initialise.c index 7d185ab..02b57df 100644 --- a/libgamma_x_vidmode_site_initialise.c +++ b/libgamma_x_vidmode_site_initialise.c @@ -17,7 +17,7 @@ * error identifier provided by this library */ int -libgamma_x_vidmode_site_initialise(libgamma_site_state_t *restrict this, char *restrict site) +libgamma_x_vidmode_site_initialise(struct libgamma_site_state *restrict this, char *restrict site) { /* Connect to the display */ Display *restrict connection; diff --git a/libgamma_x_vidmode_site_restore.c b/libgamma_x_vidmode_site_restore.c index ce0d768..67df206 100644 --- a/libgamma_x_vidmode_site_restore.c +++ b/libgamma_x_vidmode_site_restore.c @@ -11,7 +11,7 @@ * error identifier provided by this library */ int -libgamma_x_vidmode_site_restore(libgamma_site_state_t *restrict this) +libgamma_x_vidmode_site_restore(struct libgamma_site_state *restrict this) { (void) this; errno = ENOTSUP; diff --git a/method-dummy.h b/method-dummy.h index 8d84f05..fa50b18 100644 --- a/method-dummy.h +++ b/method-dummy.h @@ -6,7 +6,7 @@ /** * Configuration set for the dummy adjustment method */ -typedef struct libgamma_dummy_configurations { +struct libgamma_dummy_configurations { /** * The method's capabilities * @@ -14,7 +14,7 @@ typedef struct libgamma_dummy_configurations { * - real * - fake */ - libgamma_method_capabilities_t capabilities; + struct libgamma_method_capabilities capabilities; /** * Template for CRTC:s information @@ -29,7 +29,7 @@ typedef struct libgamma_dummy_configurations { * - gamma_blue * - gamma_error */ - libgamma_crtc_information_t crtc_info_template; + struct libgamma_crtc_information crtc_info_template; /** * The adjustment method to use @@ -88,14 +88,13 @@ typedef struct libgamma_dummy_configurations { * Whether to print what is going on in the phony system */ unsigned verbose : 1; - -} libgamma_dummy_configurations_t; +}; /** * Dummy adjustment method internal data for a CRTC */ -typedef struct libgamma_dummy_crtc { +struct libgamma_dummy_crtc { /** * The gamma ramp for the red channel */ @@ -124,24 +123,23 @@ typedef struct libgamma_dummy_crtc { * - gamma_blue * - gamma_error */ - libgamma_crtc_information_t info; + struct libgamma_crtc_information info; /** * Partition state that contains this information */ - libgamma_crtc_state_t *state; - -} libgamma_dummy_crtc_t; + struct libgamma_crtc_state *state; +}; /** * Dummy adjustment method internal data for a partition */ -typedef struct libgamma_dummy_partition { +struct libgamma_dummy_partition { /** * The CRTC:s on the system */ - libgamma_dummy_crtc_t *crtcs; + struct libgamma_dummy_crtc *crtcs; /** * The number of CRTC:s on the system @@ -151,19 +149,18 @@ typedef struct libgamma_dummy_partition { /** * Partition state that contains this information */ - libgamma_partition_state_t *state; - -} libgamma_dummy_partition_t; + struct libgamma_partition_state *state; +}; /** * Dummy adjustment method internal data for a site */ -typedef struct libgamma_dummy_site { +struct libgamma_dummy_site { /** * The partitions on the system */ - libgamma_dummy_partition_t *partitions; + struct libgamma_dummy_partition *partitions; /** * The number of partitions on the system @@ -173,16 +170,15 @@ typedef struct libgamma_dummy_site { /** * Site state that contains this information */ - libgamma_site_state_t *state; - -} libgamma_dummy_site_t; + struct libgamma_site_state *state; +}; /** * Configurations for the dummy adjustment method */ -extern libgamma_dummy_configurations_t libgamma_dummy_internal_configurations; +extern struct libgamma_dummy_configurations libgamma_dummy_internal_configurations; #endif @@ -193,7 +189,7 @@ extern libgamma_dummy_configurations_t libgamma_dummy_internal_configurations; * @param this The data structure to fill with the method's capabilities */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_dummy_method_capabilities(libgamma_method_capabilities_t *restrict); +void libgamma_dummy_method_capabilities(struct libgamma_method_capabilities *restrict); /** * Initialise an allocated site state @@ -209,7 +205,7 @@ void libgamma_dummy_method_capabilities(libgamma_method_capabilities_t *restrict * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__))) -int libgamma_dummy_site_initialise(libgamma_site_state_t *restrict, char *restrict); +int libgamma_dummy_site_initialise(struct libgamma_site_state *restrict, char *restrict); /** * Release all resources held by a site state @@ -217,7 +213,7 @@ int libgamma_dummy_site_initialise(libgamma_site_state_t *restrict, char *restri * @param this The site state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_dummy_site_destroy(libgamma_site_state_t *restrict); +void libgamma_dummy_site_destroy(struct libgamma_site_state *restrict); /** * Restore the gamma ramps all CRTC:s with a site to the system settings @@ -227,7 +223,7 @@ void libgamma_dummy_site_destroy(libgamma_site_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_site_restore(libgamma_site_state_t *restrict); +int libgamma_dummy_site_restore(struct libgamma_site_state *restrict); /** @@ -240,7 +236,7 @@ int libgamma_dummy_site_restore(libgamma_site_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_partition_initialise(libgamma_partition_state_t *restrict, libgamma_site_state_t *restrict, size_t); +int libgamma_dummy_partition_initialise(struct libgamma_partition_state *restrict, struct libgamma_site_state *restrict, size_t); /** * Release all resources held by a partition state @@ -248,7 +244,7 @@ int libgamma_dummy_partition_initialise(libgamma_partition_state_t *restrict, li * @param this The partition state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_dummy_partition_destroy(libgamma_partition_state_t *restrict); +void libgamma_dummy_partition_destroy(struct libgamma_partition_state *restrict); /** * Restore the gamma ramps all CRTC:s with a partition to the system settings @@ -258,7 +254,7 @@ void libgamma_dummy_partition_destroy(libgamma_partition_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_partition_restore(libgamma_partition_state_t *restrict); +int libgamma_dummy_partition_restore(struct libgamma_partition_state *restrict); /** @@ -271,7 +267,7 @@ int libgamma_dummy_partition_restore(libgamma_partition_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma_partition_state_t *restrict, size_t); +int libgamma_dummy_crtc_initialise(struct libgamma_crtc_state *restrict, struct libgamma_partition_state *restrict, size_t); /** * Release all resources held by a CRTC state @@ -279,7 +275,7 @@ int libgamma_dummy_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma_par * @param this The CRTC state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_dummy_crtc_destroy(libgamma_crtc_state_t *restrict); +void libgamma_dummy_crtc_destroy(struct libgamma_crtc_state *restrict); /** * Restore the gamma ramps for a CRTC to the system settings for that CRTC @@ -289,7 +285,7 @@ void libgamma_dummy_crtc_destroy(libgamma_crtc_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_restore(libgamma_crtc_state_t *restrict); +int libgamma_dummy_crtc_restore(struct libgamma_crtc_state *restrict); /** @@ -301,7 +297,8 @@ int libgamma_dummy_crtc_restore(libgamma_crtc_state_t *restrict); * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_get_crtc_information(libgamma_crtc_information_t *restrict, libgamma_crtc_state_t *restrict, unsigned long long); +int libgamma_dummy_get_crtc_information(struct libgamma_crtc_information *restrict, + struct libgamma_crtc_state *restrict, unsigned long long); /** @@ -313,7 +310,7 @@ int libgamma_dummy_get_crtc_information(libgamma_crtc_information_t *restrict, l * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_get_gamma_ramps8(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps8_t *restrict); +int libgamma_dummy_crtc_get_gamma_ramps8(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps8 *restrict); /** * Set the gamma ramps for a CRTC, 8-bit gamma-depth version @@ -324,7 +321,7 @@ int libgamma_dummy_crtc_get_gamma_ramps8(libgamma_crtc_state_t *restrict, libgam * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_set_gamma_ramps8(libgamma_crtc_state_t *restrict, const libgamma_gamma_ramps8_t *restrict); +int libgamma_dummy_crtc_set_gamma_ramps8(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_ramps8 *restrict); /** @@ -336,7 +333,7 @@ int libgamma_dummy_crtc_set_gamma_ramps8(libgamma_crtc_state_t *restrict, const * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps16_t *restrict); +int libgamma_dummy_crtc_get_gamma_ramps16(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps16 *restrict); /** * Set the gamma ramps for a CRTC, 16-bit gamma-depth version @@ -347,7 +344,7 @@ int libgamma_dummy_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict, libga * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict, const libgamma_gamma_ramps16_t *restrict); +int libgamma_dummy_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_ramps16 *restrict); /** @@ -359,7 +356,7 @@ int libgamma_dummy_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict, const * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_get_gamma_ramps32(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps32_t *restrict); +int libgamma_dummy_crtc_get_gamma_ramps32(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps32 *restrict); /** * Set the gamma ramps for a CRTC, 32-bit gamma-depth version @@ -370,7 +367,7 @@ int libgamma_dummy_crtc_get_gamma_ramps32(libgamma_crtc_state_t *restrict, libga * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_set_gamma_ramps32(libgamma_crtc_state_t *restrict, const libgamma_gamma_ramps32_t *restrict); +int libgamma_dummy_crtc_set_gamma_ramps32(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_ramps32 *restrict); /** @@ -382,7 +379,7 @@ int libgamma_dummy_crtc_set_gamma_ramps32(libgamma_crtc_state_t *restrict, const * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_get_gamma_ramps64(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps64_t *restrict); +int libgamma_dummy_crtc_get_gamma_ramps64(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps64 *restrict); /** * Set the gamma ramps for a CRTC, 64-bit gamma-depth version @@ -393,7 +390,7 @@ int libgamma_dummy_crtc_get_gamma_ramps64(libgamma_crtc_state_t *restrict, libga * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_set_gamma_ramps64(libgamma_crtc_state_t *restrict, const libgamma_gamma_ramps64_t *restrict); +int libgamma_dummy_crtc_set_gamma_ramps64(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_ramps64 *restrict); /** @@ -405,7 +402,7 @@ int libgamma_dummy_crtc_set_gamma_ramps64(libgamma_crtc_state_t *restrict, const * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_get_gamma_rampsf(libgamma_crtc_state_t *restrict, libgamma_gamma_rampsf_t *restrict); +int libgamma_dummy_crtc_get_gamma_rampsf(struct libgamma_crtc_state *restrict, struct libgamma_gamma_rampsf *restrict); /** * Set the gamma ramps for a CRTC, `float` version @@ -416,7 +413,7 @@ int libgamma_dummy_crtc_get_gamma_rampsf(libgamma_crtc_state_t *restrict, libgam * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_set_gamma_rampsf(libgamma_crtc_state_t *restrict, const libgamma_gamma_rampsf_t *restrict); +int libgamma_dummy_crtc_set_gamma_rampsf(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_rampsf *restrict); /** * Get the current gamma ramps for a CRTC, `double` version @@ -427,7 +424,7 @@ int libgamma_dummy_crtc_set_gamma_rampsf(libgamma_crtc_state_t *restrict, const * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_get_gamma_rampsd(libgamma_crtc_state_t *restrict, libgamma_gamma_rampsd_t *restrict); +int libgamma_dummy_crtc_get_gamma_rampsd(struct libgamma_crtc_state *restrict, struct libgamma_gamma_rampsd *restrict); /** * Set the gamma ramps for a CRTC, `double` version @@ -438,7 +435,7 @@ int libgamma_dummy_crtc_get_gamma_rampsd(libgamma_crtc_state_t *restrict, libgam * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_crtc_set_gamma_rampsd(libgamma_crtc_state_t *restrict, const libgamma_gamma_rampsd_t *restrict); +int libgamma_dummy_crtc_set_gamma_rampsd(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_rampsd *restrict); @@ -452,14 +449,14 @@ int libgamma_dummy_crtc_set_gamma_rampsd(libgamma_crtc_state_t *restrict, const * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_dummy_internal_crtc_restore_forced(libgamma_dummy_crtc_t *restrict); +int libgamma_dummy_internal_crtc_restore_forced(struct libgamma_dummy_crtc *restrict); #endif #else -libgamma_dummy_crtc_t *data = this->data; -gamma_ramps_any_t ramps_; +struct libgamma_dummy_crtc *data = this->data; +union gamma_ramps_any ramps_; TYPE *r_ramp = data->gamma_red; TYPE *g_ramp = data->gamma_green; TYPE *b_ramp = data->gamma_blue; @@ -481,7 +478,7 @@ if (!data->info.gamma_support) return LIBGAMMA_GAMMA_RAMP_READ_FAILED; #ifdef LIBGAMMA_DUMMY_GET_RAMPS -# define __trans(TDEPTH, SUFFIX)\ +# define TRANSLATE(TDEPTH, SUFFIX)\ do {\ if (data->info.gamma_depth == DEPTH) {\ ramps_.FIELD = *ramps;\ @@ -489,7 +486,7 @@ do {\ }\ } while (0) #else -# define __trans(TDEPTH, SUFFIX)\ +# define TRANSLATE(TDEPTH, SUFFIX)\ do {\ if (data->info.gamma_depth == DEPTH) {\ ramps_.FIELD = *ramps;\ @@ -499,25 +496,25 @@ do {\ #endif #if DEPTH != 8 -__trans(8, 8); +TRANSLATE(8, 8); #endif #if DEPTH != 16 -__trans(16, 16); +TRANSLATE(16, 16); #endif #if DEPTH != 32 -__trans(32, 32); +TRANSLATE(32, 32); #endif #if DEPTH != 64 -__trans(64, 64); +TRANSLATE(64, 64); #endif #if DEPTH != -1 -__trans(-1, f); +TRANSLATE(-1, f); #endif #if DEPTH != -2 -__trans(-2, d); +TRANSLATE(-2, d); #endif -#undef __trans +#undef TRANSLATE #ifdef LIBGAMMA_DUMMY_GET_RAMPS for (i = 0; i < rn; i++) ramps->red[i] = r_ramp[i]; diff --git a/method-linux-drm.h b/method-linux-drm.h index 1e8de08..9e98412 100644 --- a/method-linux-drm.h +++ b/method-linux-drm.h @@ -7,7 +7,7 @@ /** * Graphics card data for the Direct Rendering Manager adjustment method */ -typedef struct libgamma_drm_card_data { +struct libgamma_drm_card_data { /** * File descriptor for the connection to the graphics card */ @@ -27,8 +27,7 @@ typedef struct libgamma_drm_card_data { * Resources for open encoders */ drmModeEncoder **encoders; - -} libgamma_drm_card_data_t; +}; #endif @@ -39,7 +38,7 @@ typedef struct libgamma_drm_card_data { * @param this The data structure to fill with the method's capabilities */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_linux_drm_method_capabilities(libgamma_method_capabilities_t *restrict); +void libgamma_linux_drm_method_capabilities(struct libgamma_method_capabilities *restrict); /** * Initialise an allocated site state @@ -55,7 +54,7 @@ void libgamma_linux_drm_method_capabilities(libgamma_method_capabilities_t *rest * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__))) -int libgamma_linux_drm_site_initialise(libgamma_site_state_t *restrict, char *restrict); +int libgamma_linux_drm_site_initialise(struct libgamma_site_state *restrict, char *restrict); /** * Release all resources held by a site state @@ -63,7 +62,7 @@ int libgamma_linux_drm_site_initialise(libgamma_site_state_t *restrict, char *re * @param this The site state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_linux_drm_site_destroy(libgamma_site_state_t *restrict); +void libgamma_linux_drm_site_destroy(struct libgamma_site_state *restrict); /** * Restore the gamma ramps all CRTC:s with a site to the system settings @@ -73,7 +72,7 @@ void libgamma_linux_drm_site_destroy(libgamma_site_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_linux_drm_site_restore(libgamma_site_state_t *restrict); +int libgamma_linux_drm_site_restore(struct libgamma_site_state *restrict); /** @@ -86,7 +85,7 @@ int libgamma_linux_drm_site_restore(libgamma_site_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_linux_drm_partition_initialise(libgamma_partition_state_t *restrict, libgamma_site_state_t *restrict, size_t); +int libgamma_linux_drm_partition_initialise(struct libgamma_partition_state *restrict, struct libgamma_site_state *restrict, size_t); /** * Release all resources held by a partition state @@ -94,7 +93,7 @@ int libgamma_linux_drm_partition_initialise(libgamma_partition_state_t *restrict * @param this The partition state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_linux_drm_partition_destroy(libgamma_partition_state_t *restrict); +void libgamma_linux_drm_partition_destroy(struct libgamma_partition_state *restrict); /** * Restore the gamma ramps all CRTC:s with a partition to the system settings @@ -104,7 +103,7 @@ void libgamma_linux_drm_partition_destroy(libgamma_partition_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_linux_drm_partition_restore(libgamma_partition_state_t *restrict); +int libgamma_linux_drm_partition_restore(struct libgamma_partition_state *restrict); /** @@ -117,7 +116,7 @@ int libgamma_linux_drm_partition_restore(libgamma_partition_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_linux_drm_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma_partition_state_t *restrict, size_t); +int libgamma_linux_drm_crtc_initialise(struct libgamma_crtc_state *restrict, struct libgamma_partition_state *restrict, size_t); /** * Release all resources held by a CRTC state @@ -125,7 +124,7 @@ int libgamma_linux_drm_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma * @param this The CRTC state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_linux_drm_crtc_destroy(libgamma_crtc_state_t *restrict); +void libgamma_linux_drm_crtc_destroy(struct libgamma_crtc_state *restrict); /** * Restore the gamma ramps for a CRTC to the system settings for that CRTC @@ -135,7 +134,7 @@ void libgamma_linux_drm_crtc_destroy(libgamma_crtc_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_linux_drm_crtc_restore(libgamma_crtc_state_t *restrict); +int libgamma_linux_drm_crtc_restore(struct libgamma_crtc_state *restrict); /** @@ -147,8 +146,8 @@ int libgamma_linux_drm_crtc_restore(libgamma_crtc_state_t *restrict); * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_linux_drm_get_crtc_information(libgamma_crtc_information_t *restrict, - libgamma_crtc_state_t *restrict, unsigned long long); +int libgamma_linux_drm_get_crtc_information(struct libgamma_crtc_information *restrict, + struct libgamma_crtc_state *restrict, unsigned long long); /** * Get the current gamma ramps for a CRTC, 16-bit gamma-depth version @@ -159,7 +158,7 @@ int libgamma_linux_drm_get_crtc_information(libgamma_crtc_information_t *restric * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_linux_drm_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps16_t *restrict); +int libgamma_linux_drm_crtc_get_gamma_ramps16(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps16 *restrict); /** * Set the gamma ramps for a CRTC, 16-bit gamma-depth version @@ -170,7 +169,7 @@ int libgamma_linux_drm_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict, l * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_linux_drm_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict, const libgamma_gamma_ramps16_t *restrict); +int libgamma_linux_drm_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_ramps16 *restrict); @@ -181,5 +180,5 @@ int libgamma_linux_drm_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict, c * @param this The graphics card data */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_linux_drm_internal_release_connectors_and_encoders(libgamma_drm_card_data_t *restrict); +void libgamma_linux_drm_internal_release_connectors_and_encoders(struct libgamma_drm_card_data *restrict); #endif diff --git a/method-quartz-cg.h b/method-quartz-cg.h index 177378e..e37e3e4 100644 --- a/method-quartz-cg.h +++ b/method-quartz-cg.h @@ -16,7 +16,7 @@ * @param this The data structure to fill with the method's capabilities */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_quartz_cg_method_capabilities(libgamma_method_capabilities_t *restrict); +void libgamma_quartz_cg_method_capabilities(struct libgamma_method_capabilities *restrict); /** * Initialise an allocated site state @@ -32,7 +32,7 @@ void libgamma_quartz_cg_method_capabilities(libgamma_method_capabilities_t *rest * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__))) -int libgamma_quartz_cg_site_initialise(libgamma_site_state_t *restrict, char *restrict); +int libgamma_quartz_cg_site_initialise(struct libgamma_site_state *restrict, char *restrict); /** * Release all resources held by a site state @@ -40,7 +40,7 @@ int libgamma_quartz_cg_site_initialise(libgamma_site_state_t *restrict, char *re * @param this The site state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_quartz_cg_site_destroy(libgamma_site_state_t *restrict); +void libgamma_quartz_cg_site_destroy(struct libgamma_site_state *restrict); /** * Restore the gamma ramps all CRTC:s with a site to the system settings @@ -50,7 +50,7 @@ void libgamma_quartz_cg_site_destroy(libgamma_site_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_quartz_cg_site_restore(libgamma_site_state_t *restrict); +int libgamma_quartz_cg_site_restore(struct libgamma_site_state *restrict); /** @@ -63,7 +63,7 @@ int libgamma_quartz_cg_site_restore(libgamma_site_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_quartz_cg_partition_initialise(libgamma_partition_state_t *restrict, libgamma_site_state_t *restrict, size_t); +int libgamma_quartz_cg_partition_initialise(struct libgamma_partition_state *restrict, struct libgamma_site_state *restrict, size_t); /** * Release all resources held by a partition state @@ -71,7 +71,7 @@ int libgamma_quartz_cg_partition_initialise(libgamma_partition_state_t *restrict * @param this The partition state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_quartz_cg_partition_destroy(libgamma_partition_state_t *restrict); +void libgamma_quartz_cg_partition_destroy(struct libgamma_partition_state *restrict); /** * Restore the gamma ramps all CRTC:s with a partition to the system settings @@ -81,7 +81,7 @@ void libgamma_quartz_cg_partition_destroy(libgamma_partition_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_quartz_cg_partition_restore(libgamma_partition_state_t *restrict); +int libgamma_quartz_cg_partition_restore(struct libgamma_partition_state *restrict); /** @@ -94,7 +94,7 @@ int libgamma_quartz_cg_partition_restore(libgamma_partition_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__, __pure__))) -int libgamma_quartz_cg_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma_partition_state_t *restrict, size_t); +int libgamma_quartz_cg_crtc_initialise(struct libgamma_crtc_state *restrict, struct libgamma_partition_state *restrict, size_t); /** * Release all resources held by a CRTC state @@ -102,7 +102,7 @@ int libgamma_quartz_cg_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma * @param this The CRTC state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_quartz_cg_crtc_destroy(libgamma_crtc_state_t *restrict); +void libgamma_quartz_cg_crtc_destroy(struct libgamma_crtc_state *restrict); /** * Restore the gamma ramps for a CRTC to the system settings for that CRTC @@ -112,7 +112,7 @@ void libgamma_quartz_cg_crtc_destroy(libgamma_crtc_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_quartz_cg_crtc_restore(libgamma_crtc_state_t *restrict); +int libgamma_quartz_cg_crtc_restore(struct libgamma_crtc_state *restrict); /** @@ -124,8 +124,8 @@ int libgamma_quartz_cg_crtc_restore(libgamma_crtc_state_t *restrict); * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_quartz_cg_get_crtc_information(libgamma_crtc_information_t *restrict, - libgamma_crtc_state_t *restrict, unsigned long long); +int libgamma_quartz_cg_get_crtc_information(struct libgamma_crtc_information *restrict, + struct libgamma_crtc_state *restrict, unsigned long long); /** * Get the current gamma ramps for a CRTC, `float` version @@ -136,7 +136,7 @@ int libgamma_quartz_cg_get_crtc_information(libgamma_crtc_information_t *restric * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_quartz_cg_crtc_get_gamma_rampsf(libgamma_crtc_state_t *restrict, libgamma_gamma_rampsf_t *restrict); +int libgamma_quartz_cg_crtc_get_gamma_rampsf(struct libgamma_crtc_state *restrict, struct libgamma_gamma_rampsf *restrict); /** * Set the gamma ramps for a CRTC, `float` version @@ -147,4 +147,4 @@ int libgamma_quartz_cg_crtc_get_gamma_rampsf(libgamma_crtc_state_t *restrict, li * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_quartz_cg_crtc_set_gamma_rampsf(libgamma_crtc_state_t *restrict, const libgamma_gamma_rampsf_t *restrict); +int libgamma_quartz_cg_crtc_set_gamma_rampsf(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_rampsf *restrict); diff --git a/method-w32-gdi.h b/method-w32-gdi.h index 43f1dcc..3815bdb 100644 --- a/method-w32-gdi.h +++ b/method-w32-gdi.h @@ -26,7 +26,7 @@ * @param this The data structure to fill with the method's capabilities */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_w32_gdi_method_capabilities(libgamma_method_capabilities_t *restrict); +void libgamma_w32_gdi_method_capabilities(struct libgamma_method_capabilities *restrict); /** * Initialise an allocated site state @@ -42,7 +42,7 @@ void libgamma_w32_gdi_method_capabilities(libgamma_method_capabilities_t *restri * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__(1)))) -int libgamma_w32_gdi_site_initialise(libgamma_site_state_t *restrict, char *restrict); +int libgamma_w32_gdi_site_initialise(struct libgamma_site_state *restrict, char *restrict); /** * Release all resources held by a site state @@ -50,7 +50,7 @@ int libgamma_w32_gdi_site_initialise(libgamma_site_state_t *restrict, char *rest * @param this The site state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_w32_gdi_site_destroy(libgamma_site_state_t *restrict); +void libgamma_w32_gdi_site_destroy(struct libgamma_site_state *restrict); /** * Restore the gamma ramps all CRTC:s with a site to the system settings @@ -60,7 +60,7 @@ void libgamma_w32_gdi_site_destroy(libgamma_site_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_w32_gdi_site_restore(libgamma_site_state_t *restrict); +int libgamma_w32_gdi_site_restore(struct libgamma_site_state *restrict); /** @@ -73,7 +73,7 @@ int libgamma_w32_gdi_site_restore(libgamma_site_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_w32_gdi_partition_initialise(libgamma_partition_state_t *restrict, libgamma_site_state_t *restrict, size_t); +int libgamma_w32_gdi_partition_initialise(struct libgamma_partition_state *restrict, struct libgamma_site_state *restrict, size_t); /** * Release all resources held by a partition state @@ -81,7 +81,7 @@ int libgamma_w32_gdi_partition_initialise(libgamma_partition_state_t *restrict, * @param this The partition state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_w32_gdi_partition_destroy(libgamma_partition_state_t *restrict); +void libgamma_w32_gdi_partition_destroy(struct libgamma_partition_state *restrict); /** * Restore the gamma ramps all CRTC:s with a partition to the system settings @@ -91,7 +91,7 @@ void libgamma_w32_gdi_partition_destroy(libgamma_partition_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_w32_gdi_partition_restore(libgamma_partition_state_t *restrict); +int libgamma_w32_gdi_partition_restore(struct libgamma_partition_state *restrict); /** @@ -104,7 +104,7 @@ int libgamma_w32_gdi_partition_restore(libgamma_partition_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_w32_gdi_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma_partition_state_t *restrict, size_t); +int libgamma_w32_gdi_crtc_initialise(struct libgamma_crtc_state *restrict, struct libgamma_partition_state *restrict, size_t); /** * Release all resources held by a CRTC state @@ -112,7 +112,7 @@ int libgamma_w32_gdi_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma_p * @param this The CRTC state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_w32_gdi_crtc_destroy(libgamma_crtc_state_t *restrict); +void libgamma_w32_gdi_crtc_destroy(struct libgamma_crtc_state *restrict); /** * Restore the gamma ramps for a CRTC to the system settings for that CRTC @@ -122,7 +122,7 @@ void libgamma_w32_gdi_crtc_destroy(libgamma_crtc_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_w32_gdi_crtc_restore(libgamma_crtc_state_t *restrict); +int libgamma_w32_gdi_crtc_restore(struct libgamma_crtc_state *restrict); /** @@ -134,7 +134,8 @@ int libgamma_w32_gdi_crtc_restore(libgamma_crtc_state_t *restrict); * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_w32_gdi_get_crtc_information(libgamma_crtc_information_t *restrict, libgamma_crtc_state_t *restrict, unsigned long long); +int libgamma_w32_gdi_get_crtc_information(struct libgamma_crtc_information *restrict, + struct libgamma_crtc_state *restrict, unsigned long long); /** * Get the current gamma ramps for a CRTC, 16-bit gamma-depth version @@ -145,7 +146,7 @@ int libgamma_w32_gdi_get_crtc_information(libgamma_crtc_information_t *restrict, * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_w32_gdi_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps16_t *restrict); +int libgamma_w32_gdi_crtc_get_gamma_ramps16(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps16 *restrict); /** * Set the gamma ramps for a CRTC, 16-bit gamma-depth version @@ -156,4 +157,4 @@ int libgamma_w32_gdi_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict, lib * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_w32_gdi_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict, const libgamma_gamma_ramps16_t *restrict); +int libgamma_w32_gdi_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_ramps16 *restrict); diff --git a/method-x-randr.h b/method-x-randr.h index 047498b..e331912 100644 --- a/method-x-randr.h +++ b/method-x-randr.h @@ -20,7 +20,7 @@ /** * Data structure for partition data */ -typedef struct libgamma_x_randr_partition_data { +struct libgamma_x_randr_partition_data { /** * Mapping from CRTC indices to CRTC identifiers */ @@ -48,8 +48,7 @@ typedef struct libgamma_x_randr_partition_data { * Screen configuration timestamp */ xcb_timestamp_t config_timestamp; - -} libgamma_x_randr_partition_data_t; +}; #endif @@ -60,7 +59,7 @@ typedef struct libgamma_x_randr_partition_data { * @param this The data structure to fill with the method's capabilities */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_x_randr_method_capabilities(libgamma_method_capabilities_t *restrict); +void libgamma_x_randr_method_capabilities(struct libgamma_method_capabilities *restrict); /** * Initialise an allocated site state @@ -76,7 +75,7 @@ void libgamma_x_randr_method_capabilities(libgamma_method_capabilities_t *restri * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__))) -int libgamma_x_randr_site_initialise(libgamma_site_state_t *restrict, char *restrict); +int libgamma_x_randr_site_initialise(struct libgamma_site_state *restrict, char *restrict); /** * Release all resources held by a site state. @@ -84,7 +83,7 @@ int libgamma_x_randr_site_initialise(libgamma_site_state_t *restrict, char *rest * @param this The site state. */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_x_randr_site_destroy(libgamma_site_state_t *restrict); +void libgamma_x_randr_site_destroy(struct libgamma_site_state *restrict); /** * Restore the gamma ramps all CRTC:s with a site to the system settings @@ -94,7 +93,7 @@ void libgamma_x_randr_site_destroy(libgamma_site_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_randr_site_restore(libgamma_site_state_t *restrict); +int libgamma_x_randr_site_restore(struct libgamma_site_state *restrict); /** @@ -107,7 +106,7 @@ int libgamma_x_randr_site_restore(libgamma_site_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_randr_partition_initialise(libgamma_partition_state_t *restrict, libgamma_site_state_t *restrict, size_t); +int libgamma_x_randr_partition_initialise(struct libgamma_partition_state *restrict, struct libgamma_site_state *restrict, size_t); /** * Release all resources held by a partition state @@ -115,7 +114,7 @@ int libgamma_x_randr_partition_initialise(libgamma_partition_state_t *restrict, * @param this The partition state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_x_randr_partition_destroy(libgamma_partition_state_t *restrict); +void libgamma_x_randr_partition_destroy(struct libgamma_partition_state *restrict); /** * Restore the gamma ramps all CRTC:s with a partition to the system settings @@ -125,7 +124,7 @@ void libgamma_x_randr_partition_destroy(libgamma_partition_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_randr_partition_restore(libgamma_partition_state_t *restrict); +int libgamma_x_randr_partition_restore(struct libgamma_partition_state *restrict); /** @@ -138,7 +137,7 @@ int libgamma_x_randr_partition_restore(libgamma_partition_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_randr_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma_partition_state_t *restrict, size_t); +int libgamma_x_randr_crtc_initialise(struct libgamma_crtc_state *restrict, struct libgamma_partition_state *restrict, size_t); /** * Release all resources held by a CRTC state @@ -146,7 +145,7 @@ int libgamma_x_randr_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma_p * @param this The CRTC state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_x_randr_crtc_destroy(libgamma_crtc_state_t *restrict); +void libgamma_x_randr_crtc_destroy(struct libgamma_crtc_state *restrict); /** * Restore the gamma ramps for a CRTC to the system settings for that CRTC @@ -156,7 +155,7 @@ void libgamma_x_randr_crtc_destroy(libgamma_crtc_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_randr_crtc_restore(libgamma_crtc_state_t *restrict); +int libgamma_x_randr_crtc_restore(struct libgamma_crtc_state *restrict); /** @@ -168,7 +167,8 @@ int libgamma_x_randr_crtc_restore(libgamma_crtc_state_t *restrict); * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_randr_get_crtc_information(libgamma_crtc_information_t *restrict, libgamma_crtc_state_t *restrict, unsigned long long); +int libgamma_x_randr_get_crtc_information(struct libgamma_crtc_information *restrict, + struct libgamma_crtc_state *restrict, unsigned long long); /** * Get the current gamma ramps for a CRTC, 16-bit gamma-depth version @@ -179,7 +179,7 @@ int libgamma_x_randr_get_crtc_information(libgamma_crtc_information_t *restrict, * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_randr_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps16_t *restrict); +int libgamma_x_randr_crtc_get_gamma_ramps16(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps16 *restrict); /** * Set the gamma ramps for a CRTC, 16-bit gamma-depth version @@ -190,7 +190,7 @@ int libgamma_x_randr_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict, lib * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_randr_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict, const libgamma_gamma_ramps16_t *restrict); +int libgamma_x_randr_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_ramps16 *restrict); diff --git a/method-x-vidmode.h b/method-x-vidmode.h index 0fe3d09..48dec39 100644 --- a/method-x-vidmode.h +++ b/method-x-vidmode.h @@ -12,7 +12,7 @@ * @param this The data structure to fill with the method's capabilities */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_x_vidmode_method_capabilities(libgamma_method_capabilities_t *restrict); +void libgamma_x_vidmode_method_capabilities(struct libgamma_method_capabilities *restrict); /** * Initialise an allocated site state @@ -28,7 +28,7 @@ void libgamma_x_vidmode_method_capabilities(libgamma_method_capabilities_t *rest * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__))) -int libgamma_x_vidmode_site_initialise(libgamma_site_state_t *restrict, char *restrict); +int libgamma_x_vidmode_site_initialise(struct libgamma_site_state *restrict, char *restrict); /** * Release all resources held by a site state @@ -36,7 +36,7 @@ int libgamma_x_vidmode_site_initialise(libgamma_site_state_t *restrict, char *re * @param this The site state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_x_vidmode_site_destroy(libgamma_site_state_t *restrict); +void libgamma_x_vidmode_site_destroy(struct libgamma_site_state *restrict); /** * Restore the gamma ramps all CRTC:s with a site to the system settings @@ -46,7 +46,7 @@ void libgamma_x_vidmode_site_destroy(libgamma_site_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_vidmode_site_restore(libgamma_site_state_t *restrict); +int libgamma_x_vidmode_site_restore(struct libgamma_site_state *restrict); /** @@ -59,7 +59,7 @@ int libgamma_x_vidmode_site_restore(libgamma_site_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_vidmode_partition_initialise(libgamma_partition_state_t *restrict, libgamma_site_state_t *restrict, size_t); +int libgamma_x_vidmode_partition_initialise(struct libgamma_partition_state *restrict, struct libgamma_site_state *restrict, size_t); /** * Release all resources held by a partition state @@ -67,7 +67,7 @@ int libgamma_x_vidmode_partition_initialise(libgamma_partition_state_t *restrict * @param this The partition state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_x_vidmode_partition_destroy(libgamma_partition_state_t *restrict); +void libgamma_x_vidmode_partition_destroy(struct libgamma_partition_state *restrict); /** * Restore the gamma ramps all CRTC:s with a partition to the system settings @@ -77,7 +77,7 @@ void libgamma_x_vidmode_partition_destroy(libgamma_partition_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_vidmode_partition_restore(libgamma_partition_state_t *restrict); +int libgamma_x_vidmode_partition_restore(struct libgamma_partition_state *restrict); /** @@ -90,7 +90,7 @@ int libgamma_x_vidmode_partition_restore(libgamma_partition_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__, __const__))) -int libgamma_x_vidmode_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma_partition_state_t *restrict, size_t); +int libgamma_x_vidmode_crtc_initialise(struct libgamma_crtc_state *restrict, struct libgamma_partition_state *restrict, size_t); /** * Release all resources held by a CRTC state @@ -98,7 +98,7 @@ int libgamma_x_vidmode_crtc_initialise(libgamma_crtc_state_t *restrict, libgamma * @param this The CRTC state */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__))) -void libgamma_x_vidmode_crtc_destroy(libgamma_crtc_state_t *restrict); +void libgamma_x_vidmode_crtc_destroy(struct libgamma_crtc_state *restrict); /** * Restore the gamma ramps for a CRTC to the system settings for that CRTC @@ -108,7 +108,7 @@ void libgamma_x_vidmode_crtc_destroy(libgamma_crtc_state_t *restrict); * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_vidmode_crtc_restore(libgamma_crtc_state_t *restrict); +int libgamma_x_vidmode_crtc_restore(struct libgamma_crtc_state *restrict); /** @@ -120,8 +120,8 @@ int libgamma_x_vidmode_crtc_restore(libgamma_crtc_state_t *restrict); * @return Zero on success, -1 on error; on error refer to the error reports in `this` */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_vidmode_get_crtc_information(libgamma_crtc_information_t *restrict, - libgamma_crtc_state_t *restrict, unsigned long long); +int libgamma_x_vidmode_get_crtc_information(struct libgamma_crtc_information *restrict, + struct libgamma_crtc_state *restrict, unsigned long long); /** * Get the current gamma ramps for a CRTC, 16-bit gamma-depth version @@ -132,7 +132,7 @@ int libgamma_x_vidmode_get_crtc_information(libgamma_crtc_information_t *restric * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_vidmode_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict, libgamma_gamma_ramps16_t *restrict); +int libgamma_x_vidmode_crtc_get_gamma_ramps16(struct libgamma_crtc_state *restrict, struct libgamma_gamma_ramps16 *restrict); /** * Set the gamma ramps for a CRTC, 16-bit gamma-depth version @@ -143,4 +143,4 @@ int libgamma_x_vidmode_crtc_get_gamma_ramps16(libgamma_crtc_state_t *restrict, l * error identifier provided by this library */ LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__))) -int libgamma_x_vidmode_crtc_set_gamma_ramps16(libgamma_crtc_state_t *restrict, const libgamma_gamma_ramps16_t *restrict); +int libgamma_x_vidmode_crtc_set_gamma_ramps16(struct libgamma_crtc_state *restrict, const struct libgamma_gamma_ramps16 *restrict); diff --git a/set_ramps.h b/set_ramps.h index 6f564c3..1ef08e8 100644 --- a/set_ramps.h +++ b/set_ramps.h @@ -6,7 +6,7 @@ */ -gamma_ramps_any_t ramps_; +union gamma_ramps_any ramps_; switch (this->partition->site->method) { #define X(CONST, CNAME, MDEPTH, MRAMPS)\ case CONST:\ diff --git a/set_ramps_fun.h b/set_ramps_fun.h index a177568..ecbb75d 100644 --- a/set_ramps_fun.h +++ b/set_ramps_fun.h @@ -6,7 +6,7 @@ */ -libgamma_crtc_information_t info; +struct libgamma_crtc_information info; struct APPEND_RAMPS(libgamma_gamma_) ramps; size_t i, n; int e; @@ -203,8 +203,6 @@ list_methods_lists(void) /* Allocate a list for adjustment methods that is large * enough if the program is up to date with the library */ int methods[LIBGAMMA_METHOD_COUNT]; - /* Get a list of all adjustment methods */ - size_t n = libgamma_list_methods(methods, LIBGAMMA_METHOD_COUNT, 4); /* Print adjustment method lists. */ list_methods("Available adjustment methods", methods, 4); @@ -271,7 +269,7 @@ list_default_sites(void) static void method_capabilities(void) { - libgamma_method_capabilities_t caps; + struct libgamma_method_capabilities caps; int method; for (method = 0; method < LIBGAMMA_METHOD_COUNT; method++) { if (libgamma_is_method_available(method)) { @@ -288,21 +286,21 @@ method_capabilities(void) * capabilities is printed hexadecimal. See * the `LIBGAMMA_CRTC_INFO_*` definitions in * `libgamma.h` for what each bit represents. */ - printf(" %s: %X\n", "CRTC information", caps.crtc_information); - printf(" %s: %s\n", "Default site known", caps.default_site_known ? "yes" : "no"); - printf(" %s: %s\n", "Multiple sites", caps.multiple_sites ? "yes" : "no"); - printf(" %s: %s\n", "Multiple partitions", caps.multiple_partitions ? "yes" : "no"); - printf(" %s: %s\n", "Multiple crtcs", caps.multiple_crtcs ? "yes" : "no"); - printf(" %s: %s\n", "Graphics cards", caps.partitions_are_graphics_cards ? "yes" : "no"); - printf(" %s: %s\n", "Site restore", caps.site_restore ? "yes" : "no"); - printf(" %s: %s\n", "Partition restore", caps.partition_restore ? "yes" : "no"); - printf(" %s: %s\n", "CRTC restore", caps.crtc_restore ? "yes" : "no"); - printf(" %s: %s\n", "Identical gamma sizes", caps.identical_gamma_sizes ? "yes" : "no"); - printf(" %s: %s\n", "Fixed gamma size", caps.fixed_gamma_size ? "yes" : "no"); - printf(" %s: %s\n", "Fixed gamma depth", caps.fixed_gamma_depth ? "yes" : "no"); - printf(" %s: %s\n", "Real method", caps.real ? "yes" : "no"); - printf(" %s: %s\n", "Fake method", caps.fake ? "yes" : "no"); - printf(" %s: %s\n", "Auto restore", caps.auto_restore ? "yes" : "no"); + printf(" %s: %llx\n", "CRTC information", caps.crtc_information); + printf(" %s: %s\n", "Default site known", caps.default_site_known ? "yes" : "no"); + printf(" %s: %s\n", "Multiple sites", caps.multiple_sites ? "yes" : "no"); + printf(" %s: %s\n", "Multiple partitions", caps.multiple_partitions ? "yes" : "no"); + printf(" %s: %s\n", "Multiple crtcs", caps.multiple_crtcs ? "yes" : "no"); + printf(" %s: %s\n", "Graphics cards", caps.partitions_are_graphics_cards ? "yes" : "no"); + printf(" %s: %s\n", "Site restore", caps.site_restore ? "yes" : "no"); + printf(" %s: %s\n", "Partition restore", caps.partition_restore ? "yes" : "no"); + printf(" %s: %s\n", "CRTC restore", caps.crtc_restore ? "yes" : "no"); + printf(" %s: %s\n", "Identical gamma sizes", caps.identical_gamma_sizes ? "yes" : "no"); + printf(" %s: %s\n", "Fixed gamma size", caps.fixed_gamma_size ? "yes" : "no"); + printf(" %s: %s\n", "Fixed gamma depth", caps.fixed_gamma_depth ? "yes" : "no"); + printf(" %s: %s\n", "Real method", caps.real ? "yes" : "no"); + printf(" %s: %s\n", "Fake method", caps.fake ? "yes" : "no"); + printf(" %s: %s\n", "Auto restore", caps.auto_restore ? "yes" : "no"); printf("\n"); } } @@ -319,7 +317,8 @@ method_capabilities(void) * @return Zero on and only on success */ static int -select_monitor(libgamma_site_state_t *site_state, libgamma_partition_state_t *part_state, libgamma_crtc_state_t *crtc_state) +select_monitor(struct libgamma_site_state *site_state, struct libgamma_partition_state *part_state, + struct libgamma_crtc_state *crtc_state) { int method; char *site; @@ -425,7 +424,7 @@ select_monitor(libgamma_site_state_t *site_state, libgamma_partition_state_t *pa * @param error The error of the information field * @param value The value of the information field */ -#define print_crtc_information_(type, notation)\ +#define PRINT_CRTC_INFORMATION(type, notation)\ static void\ print_crtc_information_##type(int do_print, const char *description, int error, type value)\ {\ @@ -447,19 +446,19 @@ select_monitor(libgamma_site_state_t *site_state, libgamma_partition_state_t *pa */ typedef const char *str; /* Create `print_crtc_information_*` variants */ -print_crtc_information_(size_t, "lu") -print_crtc_information_(signed, "i") -print_crtc_information_(int, "i") -#ifdef __GCC__ +PRINT_CRTC_INFORMATION(size_t, "lu") +PRINT_CRTC_INFORMATION(signed, "i") +PRINT_CRTC_INFORMATION(int, "i") +#ifdef __GNUC__ # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wdouble-promotion" #endif -print_crtc_information_(float, "f") -#ifdef __GCC__ +PRINT_CRTC_INFORMATION(float, "f") +#ifdef __GNUC__ # pragma GCC diagnostic pop #endif -print_crtc_information_(str, "s") -#undef print_crtc_information_ +PRINT_CRTC_INFORMATION(str, "s") +#undef PRINT_CRTC_INFORMATION /** @@ -469,7 +468,7 @@ print_crtc_information_(str, "s") * @return String representation */ static const char * -subpixel_order_str(libgamma_subpixel_order_t value) +subpixel_order_str(enum libgamma_subpixel_order value) { const char *r = libgamma_name_of_subpixel_order(value); return r ? r : "(unknown)"; @@ -483,7 +482,7 @@ subpixel_order_str(libgamma_subpixel_order_t value) * @return String representation */ static const char * -connector_type_str(libgamma_connector_type_t value) +connector_type_str(enum libgamma_connector_type value) { const char *r = libgamma_name_of_connector_type(value); return r ? r : "(unknown)"; @@ -497,7 +496,7 @@ connector_type_str(libgamma_connector_type_t value) * @return String representation */ static const char * -decision_str(libgamma_decision_t value) +decision_str(enum libgamma_decision value) { switch (value) { case LIBGAMMA_NO: return "LIBGAMMA_NO"; @@ -515,11 +514,11 @@ decision_str(libgamma_decision_t value) * @param crtc The CRTC */ static void -crtc_information(libgamma_crtc_state_t *restrict crtc) +crtc_information(struct libgamma_crtc_state *restrict crtc) { - libgamma_method_capabilities_t caps; - libgamma_crtc_information_t info; - unsigned long long int fields, field; + struct libgamma_method_capabilities caps; + struct libgamma_crtc_information info; + unsigned long long fields, field; char *edid_lc, *edid_uc; unsigned char *edid_raw; @@ -533,7 +532,7 @@ crtc_information(libgamma_crtc_state_t *restrict crtc) /* List unsupport information fields by testing them one by one */ for (fields = caps.crtc_information; field = fields & -fields, fields; fields ^= field) { if (libgamma_get_crtc_information(&info, sizeof(info), crtc, field)) - printf("Could not read CRTC information field %i\n", field); + printf("Could not read CRTC information field %llu\n", field); free(info.edid); free(info.connector_name); } @@ -548,10 +547,10 @@ crtc_information(libgamma_crtc_state_t *restrict crtc) } /* Macros for printing CRTC information */ -#define print2(TYPE, FIELD_ID, DESCRIPTION, FIELD_VAR, ERROR_VAR)\ +#define PRINT2(TYPE, FIELD_ID, DESCRIPTION, FIELD_VAR, ERROR_VAR)\ print_crtc_information_##TYPE(fields & FIELD_ID, DESCRIPTION, info.ERROR_VAR, info.FIELD_VAR); -#define print(TYPE, FIELD_ID, DESCRIPTION, FIELD_VAR)\ - print2(TYPE, FIELD_ID, DESCRIPTION, FIELD_VAR, FIELD_VAR##_error); +#define PRINT(TYPE, FIELD_ID, DESCRIPTION, FIELD_VAR)\ + PRINT2(TYPE, FIELD_ID, DESCRIPTION, FIELD_VAR, FIELD_VAR##_error); /* Print CRTC information */ @@ -575,15 +574,15 @@ crtc_information(libgamma_crtc_state_t *restrict crtc) } } /* Print physical dimensions of the monitor */ - print(size_t, LIBGAMMA_CRTC_INFO_WIDTH_MM, "width", width_mm); - print(size_t, LIBGAMMA_CRTC_INFO_HEIGHT_MM, "height", height_mm); - print(size_t, LIBGAMMA_CRTC_INFO_WIDTH_MM_EDID, "width per EDID", width_mm_edid); - print(size_t, LIBGAMMA_CRTC_INFO_HEIGHT_MM_EDID, "height per EDID", height_mm_edid); + PRINT(size_t, LIBGAMMA_CRTC_INFO_WIDTH_MM, "width", width_mm); + PRINT(size_t, LIBGAMMA_CRTC_INFO_HEIGHT_MM, "height", height_mm); + PRINT(size_t, LIBGAMMA_CRTC_INFO_WIDTH_MM_EDID, "width per EDID", width_mm_edid); + PRINT(size_t, LIBGAMMA_CRTC_INFO_HEIGHT_MM_EDID, "height per EDID", height_mm_edid); /* Print gamma ramp information */ - print2(size_t, LIBGAMMA_CRTC_INFO_GAMMA_SIZE, "red gamma ramp size", red_gamma_size, gamma_size_error); - print2(size_t, LIBGAMMA_CRTC_INFO_GAMMA_SIZE, "green gamma ramp size", green_gamma_size, gamma_size_error); - print2(size_t, LIBGAMMA_CRTC_INFO_GAMMA_SIZE, "blue gamma ramp size", blue_gamma_size, gamma_size_error); - print(signed, LIBGAMMA_CRTC_INFO_GAMMA_DEPTH, "gamma ramp depth", gamma_depth); + PRINT2(size_t, LIBGAMMA_CRTC_INFO_GAMMA_SIZE, "red gamma ramp size", red_gamma_size, gamma_size_error); + PRINT2(size_t, LIBGAMMA_CRTC_INFO_GAMMA_SIZE, "green gamma ramp size", green_gamma_size, gamma_size_error); + PRINT2(size_t, LIBGAMMA_CRTC_INFO_GAMMA_SIZE, "blue gamma ramp size", blue_gamma_size, gamma_size_error); + PRINT(signed, LIBGAMMA_CRTC_INFO_GAMMA_DEPTH, "gamma ramp depth", gamma_depth); /* Print gamma ramp support */ if (fields & LIBGAMMA_CRTC_INFO_GAMMA_SUPPORT) { if (info.gamma_support_error) @@ -599,8 +598,8 @@ crtc_information(libgamma_crtc_state_t *restrict crtc) printf(" subpixel order: %s\n", subpixel_order_str(info.subpixel_order)); } /* Print connector information */ - print(int, LIBGAMMA_CRTC_INFO_ACTIVE, "active", active); - print(str, LIBGAMMA_CRTC_INFO_CONNECTOR_NAME, "connector name", connector_name); + PRINT(int, LIBGAMMA_CRTC_INFO_ACTIVE, "active", active); + PRINT(str, LIBGAMMA_CRTC_INFO_CONNECTOR_NAME, "connector name", connector_name); if (fields & LIBGAMMA_CRTC_INFO_CONNECTOR_TYPE) { if (info.connector_type_error) libgamma_perror(" (error) subpixel order", info.connector_type_error); @@ -608,24 +607,24 @@ crtc_information(libgamma_crtc_state_t *restrict crtc) printf(" subpixel order: %s\n", connector_type_str(info.connector_type)); } /* Print the gamma characteristics of the monitor */ - print2(float, LIBGAMMA_CRTC_INFO_GAMMA, "red gamma characteristics", gamma_red, gamma_error); - print2(float, LIBGAMMA_CRTC_INFO_GAMMA, "green gamma characteristics", gamma_green, gamma_error); - print2(float, LIBGAMMA_CRTC_INFO_GAMMA, "blue gamma characteristics", gamma_blue, gamma_error); + PRINT2(float, LIBGAMMA_CRTC_INFO_GAMMA, "red gamma characteristics", gamma_red, gamma_error); + PRINT2(float, LIBGAMMA_CRTC_INFO_GAMMA, "green gamma characteristics", gamma_green, gamma_error); + PRINT2(float, LIBGAMMA_CRTC_INFO_GAMMA, "blue gamma characteristics", gamma_blue, gamma_error); /* Print the colour space of the monitor */ - print2(float, LIBGAMMA_CRTC_INFO_CHROMA, "red chroma x", red_chroma_x, chroma_error); - print2(float, LIBGAMMA_CRTC_INFO_CHROMA, "red chroma y", red_chroma_y, chroma_error); - print2(float, LIBGAMMA_CRTC_INFO_CHROMA, "green chroma x", green_chroma_x, chroma_error); - print2(float, LIBGAMMA_CRTC_INFO_CHROMA, "green chroma y", green_chroma_y, chroma_error); - print2(float, LIBGAMMA_CRTC_INFO_CHROMA, "blue chroma x", blue_chroma_x, chroma_error); - print2(float, LIBGAMMA_CRTC_INFO_CHROMA, "blue chroma y", blue_chroma_y, chroma_error); - print2(float, LIBGAMMA_CRTC_INFO_WHITE_POINT, "white point x", white_point_x, white_point_error); - print2(float, LIBGAMMA_CRTC_INFO_WHITE_POINT, "white point y", white_point_y, white_point_error); + PRINT2(float, LIBGAMMA_CRTC_INFO_CHROMA, "red chroma x", red_chroma_x, chroma_error); + PRINT2(float, LIBGAMMA_CRTC_INFO_CHROMA, "red chroma y", red_chroma_y, chroma_error); + PRINT2(float, LIBGAMMA_CRTC_INFO_CHROMA, "green chroma x", green_chroma_x, chroma_error); + PRINT2(float, LIBGAMMA_CRTC_INFO_CHROMA, "green chroma y", green_chroma_y, chroma_error); + PRINT2(float, LIBGAMMA_CRTC_INFO_CHROMA, "blue chroma x", blue_chroma_x, chroma_error); + PRINT2(float, LIBGAMMA_CRTC_INFO_CHROMA, "blue chroma y", blue_chroma_y, chroma_error); + PRINT2(float, LIBGAMMA_CRTC_INFO_WHITE_POINT, "white point x", white_point_x, white_point_error); + PRINT2(float, LIBGAMMA_CRTC_INFO_WHITE_POINT, "white point y", white_point_y, white_point_error); printf("\n"); -#undef print -#undef print2 +#undef PRINT +#undef PRINT2 /* Release resouces */ free(info.edid); @@ -636,7 +635,7 @@ crtc_information(libgamma_crtc_state_t *restrict crtc) /** * Test that count macros are set to the same values as the count variables */ -void +static void test_count_consts(void) { if (LIBGAMMA_ERROR_MIN != libgamma_error_min) { @@ -661,7 +660,7 @@ test_count_consts(void) /** * Test functions for connector types */ -void +static void test_connector_types(void) { size_t n = 0; @@ -765,7 +764,7 @@ test_connector_types(void) /** * Test functions for subpixel orders */ -void +static void test_subpixel_orders(void) { size_t n = 0; @@ -851,7 +850,7 @@ test_subpixel_orders(void) /** * Test functions for errors */ -void +static void test_errors(void) { int n = 0, fds[2], flags; @@ -1288,16 +1287,16 @@ test_errors(void) fflush(fp); r = read(fds[0], buf, sizeof(buf)); if (r <= 0 || buf[r - 1] != '\n') { - fprintf(stderr, "libgamma_perror(\"prefix\", %s) failed\n", LIBGAMMA_DEVICE_REQUIRE_GROUP); + fprintf(stderr, "libgamma_perror(\"prefix\", LIBGAMMA_DEVICE_REQUIRE_GROUP) failed\n"); exit(1); } buf[r - 1] = '\0'; if (strncmp(buf, "prefix: ", 8)) { - fprintf(stderr, "libgamma_perror(\"prefix\", %s) failed\n", LIBGAMMA_DEVICE_REQUIRE_GROUP); + fprintf(stderr, "libgamma_perror(\"prefix\", LIBGAMMA_DEVICE_REQUIRE_GROUP) failed\n"); exit(1); } if (strcmp(&buf[8], buf2)) { - fprintf(stderr, "libgamma_perror(\"prefix\", %s) failed\n", LIBGAMMA_DEVICE_REQUIRE_GROUP); + fprintf(stderr, "libgamma_perror(\"prefix\", LIBGAMMA_DEVICE_REQUIRE_GROUP) failed\n"); exit(1); } @@ -1341,16 +1340,16 @@ test_errors(void) fflush(fp); r = read(fds[0], buf, sizeof(buf)); if (r <= 0 || buf[r - 1] != '\n') { - fprintf(stderr, "libgamma_perror(\"prefix\", %s) failed\n", LIBGAMMA_DEVICE_REQUIRE_GROUP); + fprintf(stderr, "libgamma_perror(\"prefix\", LIBGAMMA_DEVICE_REQUIRE_GROUP) failed\n"); exit(1); } buf[r - 1] = '\0'; if (strncmp(buf, "prefix: ", 8)) { - fprintf(stderr, "libgamma_perror(\"prefix\", %s) failed\n", LIBGAMMA_DEVICE_REQUIRE_GROUP); + fprintf(stderr, "libgamma_perror(\"prefix\", LIBGAMMA_DEVICE_REQUIRE_GROUP) failed\n"); exit(1); } if (strcmp(&buf[8], buf2)) { - fprintf(stderr, "libgamma_perror(\"prefix\", %s) failed\n", LIBGAMMA_DEVICE_REQUIRE_GROUP); + fprintf(stderr, "libgamma_perror(\"prefix\", LIBGAMMA_DEVICE_REQUIRE_GROUP) failed\n"); exit(1); } @@ -1372,13 +1371,13 @@ test_errors(void) int main(void) { - libgamma_site_state_t *site_state = malloc(sizeof(libgamma_site_state_t)); - libgamma_partition_state_t *part_state = malloc(sizeof(libgamma_partition_state_t)); - libgamma_crtc_state_t *crtc_state = malloc(sizeof(libgamma_crtc_state_t)); - libgamma_crtc_information_t info; + struct libgamma_site_state *site_state = malloc(sizeof(*site_state)); + struct libgamma_partition_state *part_state = malloc(sizeof(*part_state)); + struct libgamma_crtc_state *crtc_state = malloc(sizeof(*crtc_state)); + struct libgamma_crtc_information info; #define X(RAMPS)\ - libgamma_gamma_##RAMPS##_t old_##RAMPS, RAMPS;\ - libgamma_gamma_##RAMPS##_fun* f_##RAMPS = dim_##RAMPS; + struct libgamma_gamma_##RAMPS old_##RAMPS, RAMPS;\ + libgamma_gamma_##RAMPS##_fun *f_##RAMPS = dim_##RAMPS; LIST_RAMPS(X) #undef X size_t i, n; @@ -1476,27 +1475,27 @@ main(void) #define Y(R, C) printf(" \033[3" C "m%1.8lf\033[00m", (double)(R[i])) LIST_FLOAT_RAMPS(X) #undef Y -#define Y(R, C) printf(" \033[3" C "m%16llX\033[00m", (uint64_t)(R[i])) +#define Y(R, C) printf(" \033[3" C "m%16llX\033[00m", (unsigned long long int)(R[i])) LIST_INTEGER_RAMPS(X) #undef Y #undef X /* Test order of gamma ramps */ - memcpy(ramps16.red, old_ramps16.red, ramps16.red_size * sizeof(uint16_t)); - memset(ramps16.green, 0, ramps16.green_size * sizeof(uint16_t)); - memset(ramps16.blue, 0, ramps16.blue_size * sizeof(uint16_t)); + memcpy(ramps16.red, old_ramps16.red, ramps16.red_size * sizeof(*ramps16.red)); + memset(ramps16.green, 0, ramps16.green_size * sizeof(*ramps16.green)); + memset(ramps16.blue, 0, ramps16.blue_size * sizeof(*ramps16.blue)); printf("Making the monitor red-only for 1 second...\n"); if ((rr |= r = libgamma_crtc_set_gamma_ramps16(crtc_state, &ramps16))) libgamma_perror("libgamma_crtc_set_gamma_ramps16", r); sleep(1); - memset(ramps16.red, 0, ramps16.red_size * sizeof(uint16_t)); - memcpy(ramps16.green, old_ramps16.green, ramps16.green_size * sizeof(uint16_t)); + memset(ramps16.red, 0, ramps16.red_size * sizeof(*ramps16.red)); + memcpy(ramps16.green, old_ramps16.green, ramps16.green_size * sizeof(*ramps16.green)); printf("Making the monitor green-only for 1 second...\n"); if ((rr |= r = libgamma_crtc_set_gamma_ramps16(crtc_state, &ramps16))) libgamma_perror("libgamma_crtc_set_gamma_ramps16", r); sleep(1); - memset(ramps16.green, 0, ramps16.green_size * sizeof(uint16_t)); - memcpy(ramps16.blue, old_ramps16.blue, ramps16.blue_size * sizeof(uint16_t)); + memset(ramps16.green, 0, ramps16.green_size * sizeof(*ramps16.green)); + memcpy(ramps16.blue, old_ramps16.blue, ramps16.blue_size * sizeof(*ramps16.blue)); printf("Making the monitor green-only for 1 second...\n"); if ((rr |= r = libgamma_crtc_set_gamma_ramps16(crtc_state, &ramps16))) libgamma_perror("libgamma_crtc_set_gamma_ramps16", r); |