Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting updates using newest version of clang-format #2744

Merged
merged 2 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src_c/SDL_gfx/SDL_gfxPrimitives.c
Original file line number Diff line number Diff line change
Expand Up @@ -4226,7 +4226,8 @@ lrint(double flt)
#include <armintr.h>
#pragma warning(push)
#pragma warning(disable : 4716)
__declspec(naked) long int lrint(double flt)
__declspec(naked) long int
lrint(double flt)
{
__emit(0xEC410B10); // fmdrr d0, r0, r1
__emit(0xEEBD0B40); // ftosid s0, d0
Expand Down
2 changes: 1 addition & 1 deletion src_c/color.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

#if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) && \
!defined(round)
#define pg_round(d) (((d < 0) ? (ceil((d)-0.5)) : (floor((d) + 0.5))))
#define pg_round(d) (((d < 0) ? (ceil((d) - 0.5)) : (floor((d) + 0.5))))
#else
#define pg_round(d) round(d)
#endif
Expand Down
2 changes: 1 addition & 1 deletion src_c/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ dict_from_event(SDL_Event *event)
}
break;
#endif /* (defined(unix) || ... */
} /* switch (event->type) */
} /* switch (event->type) */
/* Events that dont have any attributes are not handled in switch
* statement */
SDL_Window *window;
Expand Down
51 changes: 25 additions & 26 deletions src_c/freetype/ft_wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ ft_wrap_quit(pgFontObject *);
*
*********************************************************/
void
_PGFT_SetError(FreeTypeInstance *ft, const char *error_msg, FT_Error error_id)
{
_PGFT_SetError(FreeTypeInstance *ft, const char *error_msg, FT_Error error_id){
Copy link
Member

Choose a reason for hiding this comment

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

The changes in this file are weird... but we will just go with whatever clang-format is doing here

#undef __FTERRORS_H__
#define FT_ERRORDEF(e, v, s) {e, s},
#define FT_ERROR_START_LIST {
Expand All @@ -49,37 +48,37 @@ _PGFT_SetError(FreeTypeInstance *ft, const char *error_msg, FT_Error error_id)
} \
} \
;
static const struct {
int err_code;
const char *err_msg;
} ft_errors[] =
static const struct {int err_code;
const char *err_msg;
}
ft_errors[] =
#include FT_ERRORS_H

const int maxlen = (int)(sizeof(ft->_error_msg)) - 1;
int i;
const char *ft_msg;
const int maxlen = (int)(sizeof(ft->_error_msg)) - 1;
int i;
const char *ft_msg;

ft_msg = 0;
for (i = 0; ft_errors[i].err_msg; ++i) {
if (error_id == ft_errors[i].err_code) {
ft_msg = ft_errors[i].err_msg;
break;
}
ft_msg = 0;
for (i = 0; ft_errors[i].err_msg; ++i) {
if (error_id == ft_errors[i].err_code) {
ft_msg = ft_errors[i].err_msg;
break;
}
}

if (error_id && ft_msg) {
int ret = PyOS_snprintf(ft->_error_msg, sizeof(ft->_error_msg),
"%.*s: %s", maxlen - 3, error_msg, ft_msg);
if (ret >= 0) {
/* return after successfully copying full or truncated error.
* If ret < 0, PyOS_snprintf failed so try to strncpy error
* message */
return;
}
if (error_id && ft_msg) {
int ret = PyOS_snprintf(ft->_error_msg, sizeof(ft->_error_msg), "%.*s: %s",
maxlen - 3, error_msg, ft_msg);
if (ret >= 0) {
/* return after successfully copying full or truncated error.
* If ret < 0, PyOS_snprintf failed so try to strncpy error
* message */
return;
}
}

strncpy(ft->_error_msg, error_msg, maxlen);
ft->_error_msg[maxlen] = '\0'; /* in case of message truncation */
strncpy(ft->_error_msg, error_msg, maxlen);
ft->_error_msg[maxlen] = '\0'; /* in case of message truncation */
}

const char *
Expand Down
Loading