From 85604b8a18306c0f53b4ad5f19b862c29d7360b8 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 29 Jan 2025 02:57:56 -0800
Subject: [PATCH] Remove newlines from SDL_Log() messages
---
examples/editbox.c | 4 ++--
examples/showfont.c | 24 ++++++++++++------------
examples/testapp.c | 4 ++--
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/examples/editbox.c b/examples/editbox.c
index f2adcbf6..2f0130f4 100644
--- a/examples/editbox.c
+++ b/examples/editbox.c
@@ -714,7 +714,7 @@ static bool HandleMouseDown(EditBox *edit, float x, float y)
int textX = (int)SDL_roundf(x - edit->rect.x);
int textY = (int)SDL_roundf(y - edit->rect.y);
if (!TTF_GetTextSubStringForPoint(edit->text, textX, textY, &substring)) {
- SDL_Log("Couldn't get cursor location: %s\n", SDL_GetError());
+ SDL_Log("Couldn't get cursor location: %s", SDL_GetError());
return false;
}
@@ -737,7 +737,7 @@ static bool HandleMouseMotion(EditBox *edit, float x, float y)
int textX = (int)SDL_roundf(x - edit->rect.x);
int textY = (int)SDL_roundf(y - edit->rect.y);
if (!TTF_GetTextSubStringForPoint(edit->text, textX, textY, &substring)) {
- SDL_Log("Couldn't get cursor location: %s\n", SDL_GetError());
+ SDL_Log("Couldn't get cursor location: %s", SDL_GetError());
return false;
}
diff --git a/examples/showfont.c b/examples/showfont.c
index f1501ed9..2677d993 100644
--- a/examples/showfont.c
+++ b/examples/showfont.c
@@ -155,7 +155,7 @@ static void HandleKeyDown(Scene *scene, SDL_Event *event)
TTF_SetFontWrapAlignment(scene->font, TTF_HORIZONTAL_ALIGN_LEFT);
break;
default:
- SDL_Log("Unknown wrap alignment: %d\n", TTF_GetFontWrapAlignment(scene->font));
+ SDL_Log("Unknown wrap alignment: %d", TTF_GetFontWrapAlignment(scene->font));
break;
}
break;
@@ -313,7 +313,7 @@ int main(int argc, char *argv[])
if (num_fallbacks < MAX_FALLBACKS) {
fallback_font_files[num_fallbacks++] = argv[i];
} else {
- SDL_Log("Too many fallback fonts (maximum = %d)\n", MAX_FALLBACKS);
+ SDL_Log("Too many fallback fonts (maximum = %d)", MAX_FALLBACKS);
return(1);
}
} else
@@ -426,7 +426,7 @@ int main(int argc, char *argv[])
/* Initialize the TTF library */
if (!TTF_Init()) {
- SDL_Log("Couldn't initialize TTF: %s\n",SDL_GetError());
+ SDL_Log("Couldn't initialize TTF: %s",SDL_GetError());
result = 2;
goto done;
}
@@ -444,7 +444,7 @@ int main(int argc, char *argv[])
}
font = TTF_OpenFont(argv[0], ptsize);
if (font == NULL) {
- SDL_Log("Couldn't load %g pt font from %s: %s\n",
+ SDL_Log("Couldn't load %g pt font from %s: %s",
ptsize, argv[0], SDL_GetError());
result = 2;
goto done;
@@ -459,7 +459,7 @@ int main(int argc, char *argv[])
for (i = 0; i < num_fallbacks; ++i) {
fallback_fonts[i] = TTF_OpenFont(fallback_font_files[i], ptsize);
if (!fallback_fonts[i]) {
- SDL_Log("Couldn't load %g pt font from %s: %s\n",
+ SDL_Log("Couldn't load %g pt font from %s: %s",
ptsize, fallback_font_files[i], SDL_GetError());
result = 2;
goto done;
@@ -487,14 +487,14 @@ int main(int argc, char *argv[])
/* Create a window */
scene.window = SDL_CreateWindow("showfont demo", WIDTH, HEIGHT, 0);
if (!scene.window) {
- SDL_Log("SDL_CreateWindow() failed: %s\n", SDL_GetError());
+ SDL_Log("SDL_CreateWindow() failed: %s", SDL_GetError());
result = 2;
goto done;
}
if (scene.textEngine == TextEngineSurface) {
scene.window_surface = SDL_GetWindowSurface(scene.window);
if (!scene.window_surface) {
- SDL_Log("SDL_CreateWindowSurface() failed: %s\n", SDL_GetError());
+ SDL_Log("SDL_CreateWindowSurface() failed: %s", SDL_GetError());
result = 2;
goto done;
}
@@ -508,7 +508,7 @@ int main(int argc, char *argv[])
}
}
if (!scene.renderer) {
- SDL_Log("SDL_CreateRenderer() failed: %s\n", SDL_GetError());
+ SDL_Log("SDL_CreateRenderer() failed: %s", SDL_GetError());
result = 2;
goto done;
}
@@ -517,7 +517,7 @@ int main(int argc, char *argv[])
case TextEngineSurface:
engine = TTF_CreateSurfaceTextEngine();
if (!engine) {
- SDL_Log("Couldn't create surface text engine: %s\n", SDL_GetError());
+ SDL_Log("Couldn't create surface text engine: %s", SDL_GetError());
result = 2;
goto done;
}
@@ -525,7 +525,7 @@ int main(int argc, char *argv[])
case TextEngineRenderer:
engine = TTF_CreateRendererTextEngine(scene.renderer);
if (!engine) {
- SDL_Log("Couldn't create renderer text engine: %s\n", SDL_GetError());
+ SDL_Log("Couldn't create renderer text engine: %s", SDL_GetError());
result = 2;
goto done;
}
@@ -572,7 +572,7 @@ int main(int argc, char *argv[])
break;
}
if (text == NULL) {
- SDL_Log("Couldn't render text: %s\n", SDL_GetError());
+ SDL_Log("Couldn't render text: %s", SDL_GetError());
result = 2;
goto done;
}
@@ -581,7 +581,7 @@ int main(int argc, char *argv[])
scene.messageRect.w = (float)text->w;
scene.messageRect.h = (float)text->h;
scene.message = SDL_CreateTextureFromSurface(scene.renderer, text);
- SDL_Log("Font is generally %d big, and string is %d big\n",
+ SDL_Log("Font is generally %d big, and string is %d big",
TTF_GetFontHeight(font), text->h);
if (editbox) {
diff --git a/examples/testapp.c b/examples/testapp.c
index deedd9d6..5e2a82e4 100644
--- a/examples/testapp.c
+++ b/examples/testapp.c
@@ -929,14 +929,14 @@ int main(void)
if (!engine_surface) {
engine_surface = TTF_CreateSurfaceTextEngine();
if (!engine_surface) {
- SDL_Log("Couldn't create surface text engine: %s\n", SDL_GetError());
+ SDL_Log("Couldn't create surface text engine: %s", SDL_GetError());
}
}
if (!engine_renderer) {
engine_renderer = TTF_CreateRendererTextEngine(renderer);
if (!engine_renderer) {
- SDL_Log("Couldn't create renderer text engine: %s\n", SDL_GetError());
+ SDL_Log("Couldn't create renderer text engine: %s", SDL_GetError());
}
}