clang-format the world.

This used to be done by CI but we ripped that out since there wasn't any
good way to ensure that CI and and local workflows were using the same
clang-format. Back when it was in CI, the pointer alignment was
configured incorrectly (we used the Google style presets, but those are
alignment preserving rather than actually style enforcing). Reformat
everything since the .clang-format file has changed since then so I stop
including so many unrelated edits in my commits.
This commit is contained in:
Dan Albert
2025-08-26 15:47:21 -07:00
committed by Dan Albert
parent 25757933bb
commit 5c283e26bc
63 changed files with 564 additions and 563 deletions

View File

@@ -35,7 +35,8 @@
#define LOG_TAG "native-activity"
#define _LOG(priority, fmt, ...) \
((void)__android_log_print((priority), (LOG_TAG), (fmt)__VA_OPT__(, ) __VA_ARGS__))
((void)__android_log_print((priority), (LOG_TAG), \
(fmt)__VA_OPT__(, ) __VA_ARGS__))
#define LOGE(fmt, ...) _LOG(ANDROID_LOG_ERROR, (fmt)__VA_OPT__(, ) __VA_ARGS__)
#define LOGW(fmt, ...) _LOG(ANDROID_LOG_WARN, (fmt)__VA_OPT__(, ) __VA_ARGS__)
@@ -305,8 +306,7 @@ static void engine_term_display(Engine* engine) {
/**
* Process the next input event.
*/
static int32_t engine_handle_input(android_app* app,
AInputEvent* event) {
static int32_t engine_handle_input(android_app* app, AInputEvent* event) {
auto* engine = (Engine*)app->userData;
if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION) {
engine->state.x = AMotionEvent_getX(event, 0);

View File

@@ -192,9 +192,9 @@ static XAresult AndroidBufferQueueCallback(
// EOS message has no parameters, so the total size of the message is the
// size of the key
// plus the size if itemSize, both XAuint32
res = (*caller)->Enqueue(
caller, (void *)&kEosBufferCntxt /*pBufferContext*/, NULL /*pData*/,
0 /*dataLength*/, msgEos /*pMsg*/, sizeof(XAuint32) * 2 /*msgLength*/);
res = (*caller)->Enqueue(caller, (void*)&kEosBufferCntxt /*pBufferContext*/,
NULL /*pData*/, 0 /*dataLength*/, msgEos /*pMsg*/,
sizeof(XAuint32) * 2 /*msgLength*/);
assert(XA_RESULT_SUCCESS == res);
reachedEof = JNI_TRUE;
}

View File

@@ -207,7 +207,8 @@ void Java_com_example_nativemidi_AppMidiManager_startWritingMidi(
void Java_com_example_nativemidi_AppMidiManager_stopWritingMidi(JNIEnv*,
jobject) {
if (sMidiInputPort != nullptr) {
AMidiInputPort_close(sMidiInputPort); //Close InputPort to make switching MidiDevices work!
AMidiInputPort_close(
sMidiInputPort); // Close InputPort to make switching MidiDevices work!
sMidiInputPort = nullptr;
}
/*media_status_t status =*/AMidiDevice_release(sNativeSendDevice);

View File

@@ -522,9 +522,9 @@ bool SimpleModel::Compute(float inputValue1, float inputValue2, float *result) {
// Validate the results.
const float goldenRef = (inputValue1 + 0.5f) * (inputValue2 + 0.5f);
float *outputTensorPtr = reinterpret_cast<float *>(
mmap(nullptr, tensorSize_ * sizeof(float), PROT_READ, MAP_SHARED,
outputTensorFd_, 0));
float* outputTensorPtr =
reinterpret_cast<float*>(mmap(nullptr, tensorSize_ * sizeof(float),
PROT_READ, MAP_SHARED, outputTensorFd_, 0));
for (int32_t idx = 0; idx < tensorSize_; idx++) {
float delta = outputTensorPtr[idx] - goldenRef;
delta = (delta < 0.0f) ? (-delta) : delta;

View File

@@ -593,8 +593,8 @@ void android_main(android_app* state) {
// If animating, we loop until all events are read, then continue
// to draw the next frame of animation.
android_poll_source* source = nullptr;
auto result = ALooper_pollOnce(g_engine.IsReady() ? 0 : -1, nullptr, nullptr,
(void**)&source);
auto result = ALooper_pollOnce(g_engine.IsReady() ? 0 : -1, nullptr,
nullptr, (void**)&source);
if (result == ALOOPER_POLL_ERROR) {
LOGE("ALooper_pollOnce returned an error");
abort();

View File

@@ -409,8 +409,8 @@ void android_main(android_app* state) {
// If animating, we loop until all events are read, then continue
// to draw the next frame of animation.
android_poll_source* source = nullptr;
auto result = ALooper_pollOnce(g_engine.IsReady() ? 0 : -1, nullptr, nullptr,
(void**)&source);
auto result = ALooper_pollOnce(g_engine.IsReady() ? 0 : -1, nullptr,
nullptr, (void**)&source);
if (result == ALOOPER_POLL_ERROR) {
LOGE("ALooper_pollOnce returned an error");
std::abort();

View File

@@ -409,8 +409,8 @@ void android_main(android_app* state) {
// If animating, we loop until all events are read, then continue
// to draw the next frame of animation.
android_poll_source* source = nullptr;
auto result = ALooper_pollOnce(g_engine.IsReady() ? 0 : -1, nullptr, nullptr,
(void**)&source);
auto result = ALooper_pollOnce(g_engine.IsReady() ? 0 : -1, nullptr,
nullptr, (void**)&source);
if (result == ALOOPER_POLL_ERROR) {
LOGE("ALooper_pollOnce returned an error");

View File

@@ -421,8 +421,8 @@ void android_main(android_app* state) {
// If animating, we loop until all events are read, then continue
// to draw the next frame of animation.
android_poll_source* source = nullptr;
auto result = ALooper_pollOnce(g_engine.IsReady() ? 0 : -1, nullptr, nullptr,
(void**)&source);
auto result = ALooper_pollOnce(g_engine.IsReady() ? 0 : -1, nullptr,
nullptr, (void**)&source);
if (result == ALOOPER_POLL_ERROR) {
LOGE("ALooper_pollOnce returned an error");
std::abort();

View File

@@ -409,8 +409,8 @@ void android_main(android_app* state) {
// If animating, we loop until all events are read, then continue
// to draw the next frame of animation.
android_poll_source* source = nullptr;
auto result = ALooper_pollOnce(g_engine.IsReady() ? 0 : -1, nullptr, nullptr,
(void**)&source);
auto result = ALooper_pollOnce(g_engine.IsReady() ? 0 : -1, nullptr,
nullptr, (void**)&source);
if (result == ALOOPER_POLL_ERROR) {
LOGE("ALooper_pollOnce returned an error");
std::abort();

View File

@@ -54,8 +54,8 @@ Texture::Texture(std::vector<std::string>& asset_paths,
fileBits.clear();
AssetReadFile(asset_manager, asset_paths[i], fileBits);
// tga/bmp asset_paths are saved as vertical mirror images ( at least more than
// half ).
// tga/bmp asset_paths are saved as vertical mirror images ( at least more
// than half ).
stbi_set_flip_vertically_on_load(1);
uint8_t* imageBits =