summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2022-03-15 14:06:42 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2022-03-15 14:06:42 +0000
commite24a285d34d37151be3f6c0d7d126f5fa9531e2e (patch)
tree9532ec164835a3f0956fca6244aca24bcb3fcca4
parentff05b6a4cb3b700d51a8e384aca483e134698801 (diff)
downloadnetsurf-e24a285d34d37151be3f6c0d7d126f5fa9531e2e.tar.gz
netsurf-e24a285d34d37151be3f6c0d7d126f5fa9531e2e.tar.bz2
Amiga: Fix ASPrintf(). Note this now requires utility.library v47
-rw-r--r--frontends/amiga/libs.c2
-rw-r--r--frontends/amiga/os3support.c85
2 files changed, 2 insertions, 85 deletions
diff --git a/frontends/amiga/libs.c b/frontends/amiga/libs.c
index ac60c7f2a..10c4d8677 100644
--- a/frontends/amiga/libs.c
+++ b/frontends/amiga/libs.c
@@ -224,7 +224,7 @@ bool ami_libs_open(void)
AMINS_LIB_OPEN("dos.library", 37, DOS, "main", 1, true)
#else
/* Libraries we get automatically on OS4 but not OS3 */
- AMINS_LIB_OPEN("utility.library", 37, Utility, "main", 1, true)
+ AMINS_LIB_OPEN("utility.library", 47, Utility, "main", 1, true)
#endif
/* Standard libraries for both versions */
AMINS_LIB_OPEN("asl.library", 37, Asl, "main", 1, true)
diff --git a/frontends/amiga/os3support.c b/frontends/amiga/os3support.c
index af3cb0666..cc888c02a 100644
--- a/frontends/amiga/os3support.c
+++ b/frontends/amiga/os3support.c
@@ -53,89 +53,6 @@ struct FormatContext
BOOL Overflow;
};
-STATIC VOID ASM
-StuffChar(
- REG(a3, struct FormatContext * Context),
- REG(d0, UBYTE Char))
-{
- /* Is there still room? */
- if(Context->Size > 0)
- {
- (*Context->Index) = Char;
-
- Context->Index++;
- Context->Size--;
-
- /* Is there only a single character left? */
- if(Context->Size == 1)
- {
- /* Provide null-termination. */
- (*Context->Index) = '\0';
-
- /* Don't store any further characters. */
- Context->Size = 0;
- }
- }
- else
- {
- Context->Overflow = TRUE;
- }
-}
-
-BOOL
-VSPrintfN(
- LONG MaxLen,
- STRPTR Buffer,
- const STRPTR FormatString,
- const va_list VarArgs)
-{
- BOOL result = FAILURE;
-
- /* format a text, but place only up to MaxLen
- * characters in the output buffer (including
- * the terminating NUL)
- */
-
- if (Buffer == NULL || FormatString == NULL) return(result);
-
- if(MaxLen > 1)
- {
- struct FormatContext Context;
-
- Context.Index = Buffer;
- Context.Size = MaxLen;
- Context.Overflow = FALSE;
-
- RawDoFmt(FormatString,(APTR)VarArgs,(VOID (*)())StuffChar,(APTR)&Context);
-
- if(NO Context.Overflow)
- result = SUCCESS;
- }
-
- return(result);
-}
-
-BOOL
-SPrintfN(
- LONG MaxLen,
- STRPTR Buffer,
- const STRPTR FormatString,
- ...)
-{
- va_list VarArgs;
- BOOL result = FAILURE;
-
- /* format a text, varargs version */
-
- if (Buffer == NULL && FormatString == NULL) return result;
-
- va_start(VarArgs,FormatString);
- result = VSPrintfN(MaxLen,Buffer,FormatString,VarArgs);
- va_end(VarArgs);
-
- return(result);
-}
-
char *ASPrintf(const char *fmt, ...)
{
int r;
@@ -144,7 +61,7 @@ char *ASPrintf(const char *fmt, ...)
char *rbuf;
va_start(ap, fmt);
- r = VSPrintfN(2048, buffer, (const STRPTR)fmt, ap);
+ r = SNPrintf(buffer, 2048, (const STRPTR)fmt, ap);
va_end(ap);
r = strlen(buffer);