ladybird/Ports/SDLPoP/patches/0003-Remove-some-unsupported-scanf-format-specifiers.patch

49 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Manuel Palenzuela <manuelpalenzuelamerino@gmail.com>
Date: Sat, 3 Apr 2021 17:53:44 +0200
Subject: [PATCH] Remove some unsupported scanf format specifiers
(Note that scanf has been rewritten since and probably supports these
modifiers now, so this patch might not be necessary)
---
src/options.c | 6 +++---
src/seg009.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/options.c b/src/options.c
index 1bfe473..2bf173e 100644
--- a/src/options.c
+++ b/src/options.c
@@ -56,8 +56,8 @@ int ini_load(const char *filename,
}
while (!feof(f)) {
- if (fscanf(f, "[%127[^];\n]]\n", section) == 1) {
- } else if ((cnt = fscanf(f, " %63[^=;\n] = %255[^;\n]", name, value))) {
+ if (fscanf(f, "[%[^];\n]]\n", section) == 1) {
+ } else if ((cnt = fscanf(f, " %[^=;\n] = %[^;\n]", name, value))) {
if (cnt == 1)
*value = 0;
for (s = name + strlen(name) - 1; s > name && isspace(*s); s--)
@@ -66,7 +66,7 @@ int ini_load(const char *filename,
*s = 0;
report(section, name, value);
}
- if (fscanf(f, " ;%*[^\n]") != 0 ||
+ if (fscanf(f, " ;%[^\n]") != 0 ||
fscanf(f, " \n") != 0) {
fprintf(stderr, "short read from %s!?\n", filename);
fclose(f);
diff --git a/src/seg009.c b/src/seg009.c
index 139c2d8..e2047fb 100644
--- a/src/seg009.c
+++ b/src/seg009.c
@@ -2077,7 +2077,7 @@ void load_sound_names() {
while (!feof(fp)) {
int index;
char name[POP_MAX_PATH];
- if (fscanf(fp, "%d=%255s\n", &index, /*sizeof(name)-1,*/ name) != 2) {
+ if (fscanf(fp, "%d=%s\n", &index, /*sizeof(name)-1,*/ name) != 2) {
perror(names_path);
continue;
}