mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Sfio: fix non-multibyte build (re: 7c4418cc
)
The Sfio code uses its own _has_multibyte macro and that was not being disabled by AST_NOMULTIBYTE, so some of its multibyte code was still getting compiled in. This is easily fixed in sfhdr.h. But that exposed another issue: the Sfio stdio wrappers didn't know about the _has_multibyte macro. So this adds the necessary directives to keep their multibyte functions from compiling.
This commit is contained in:
parent
ca5ea73d8c
commit
eea3ca3fd1
23 changed files with 190 additions and 12 deletions
|
@ -180,7 +180,9 @@
|
|||
#include <ctype.h>
|
||||
|
||||
/* deal with multi-byte character and string conversions */
|
||||
#if _PACKAGE_ast
|
||||
#if AST_NOMULTIBYTE
|
||||
#undef _has_multibyte
|
||||
#elif _PACKAGE_ast
|
||||
|
||||
#include <wchar.h>
|
||||
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(fgetwc)
|
||||
|
||||
#else
|
||||
|
||||
wint_t
|
||||
fgetwc(Sfio_t* f)
|
||||
{
|
||||
|
@ -31,3 +37,5 @@ fgetwc(Sfio_t* f)
|
|||
FWIDE(f, WEOF);
|
||||
return (sfread(f, &c, sizeof(c)) == sizeof(c)) ? c : WEOF;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(fgetws)
|
||||
|
||||
#else
|
||||
|
||||
wchar_t*
|
||||
fgetws(wchar_t* s, int n, Sfio_t* f)
|
||||
{
|
||||
|
@ -48,3 +54,5 @@ getws(wchar_t* s)
|
|||
*p = 0;
|
||||
return s;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -23,9 +23,17 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(fputwc)
|
||||
|
||||
#else
|
||||
|
||||
wint_t
|
||||
fputwc(wchar_t c, Sfio_t* f)
|
||||
{
|
||||
FWIDE(f, WEOF);
|
||||
return (sfwrite(f, &c, sizeof(c)) == sizeof(c)) ? c : WEOF;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(fputws)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
fputws(const wchar_t* s, Sfio_t* f)
|
||||
{
|
||||
|
@ -32,3 +38,5 @@ fputws(const wchar_t* s, Sfio_t* f)
|
|||
n = wcslen(s) * sizeof(wchar_t);
|
||||
return (sfwrite(f, s, n) == n) ? 0 : -1;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(fwide)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
fwide(Sfio_t* f, int mode)
|
||||
{
|
||||
|
@ -47,3 +53,5 @@ fwide(Sfio_t* f, int mode)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2011 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(fwprintf)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
fwprintf(Sfio_t* f, const wchar_t* fmt, ...)
|
||||
{
|
||||
|
@ -34,3 +40,5 @@ fwprintf(Sfio_t* f, const wchar_t* fmt, ...)
|
|||
va_end(args);
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(fwscanf)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
fwscanf(Sfio_t* f, const wchar_t* fmt, ...)
|
||||
{
|
||||
|
@ -35,3 +41,5 @@ fwscanf(Sfio_t* f, const wchar_t* fmt, ...)
|
|||
va_end(args);
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2011 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -24,8 +24,16 @@
|
|||
#include "stdhdr.h"
|
||||
#include "ast_wchar.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(getwc)
|
||||
|
||||
#else
|
||||
|
||||
wint_t
|
||||
getwc(Sfio_t* f)
|
||||
{
|
||||
return fgetwc(f);
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2011 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -24,8 +24,16 @@
|
|||
#include "stdhdr.h"
|
||||
#include "ast_wchar.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(getwchar)
|
||||
|
||||
#else
|
||||
|
||||
wint_t
|
||||
getwchar(void)
|
||||
{
|
||||
return fgetwc(sfstdin);
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2011 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -24,8 +24,16 @@
|
|||
#include "stdhdr.h"
|
||||
#include "ast_wchar.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(putwc)
|
||||
|
||||
#else
|
||||
|
||||
wint_t
|
||||
putwc(wchar_t c, Sfio_t* f)
|
||||
{
|
||||
return fputwc(c, f);
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2011 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -24,8 +24,16 @@
|
|||
#include "stdhdr.h"
|
||||
#include "ast_wchar.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(putwchar)
|
||||
|
||||
#else
|
||||
|
||||
wint_t
|
||||
putwchar(wchar_t c)
|
||||
{
|
||||
return fputwc(c, sfstdout);
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2011 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(swprintf)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
swprintf(wchar_t* s, size_t size, const wchar_t* fmt, ...)
|
||||
{
|
||||
|
@ -34,3 +40,5 @@ swprintf(wchar_t* s, size_t size, const wchar_t* fmt, ...)
|
|||
va_end(args);
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2011 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(swscanf)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
swscanf(const wchar_t* s, const wchar_t* fmt, ...)
|
||||
{
|
||||
|
@ -34,3 +40,5 @@ swscanf(const wchar_t* s, const wchar_t* fmt, ...)
|
|||
va_end(args);
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(ungetwc)
|
||||
|
||||
#else
|
||||
|
||||
wint_t
|
||||
ungetwc(wint_t c, Sfio_t* f)
|
||||
{
|
||||
|
@ -35,3 +41,5 @@ ungetwc(wint_t c, Sfio_t* f)
|
|||
return WEOF;
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(vfwprintf)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
vfwprintf(Sfio_t* f, const wchar_t* fmt, va_list args)
|
||||
{
|
||||
|
@ -64,3 +70,5 @@ vfwprintf(Sfio_t* f, const wchar_t* fmt, va_list args)
|
|||
v = -1;
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(vfwscanf)
|
||||
|
||||
#else
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Sfdisc_t sfdisc; /* sfio discipline */
|
||||
|
@ -117,3 +123,5 @@ vfwscanf(Sfio_t* f, const wchar_t* fmt, va_list args)
|
|||
v = -1;
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(vswprintf)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
vswprintf(wchar_t* s, size_t n, const wchar_t* fmt, va_list args)
|
||||
{
|
||||
|
@ -53,3 +59,5 @@ vswprintf(wchar_t* s, size_t n, const wchar_t* fmt, va_list args)
|
|||
_Sfi = f.next - f.data;
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(vswscanf)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
vswscanf(const wchar_t* s, const wchar_t* fmt, va_list args)
|
||||
{
|
||||
|
@ -49,3 +55,5 @@ vswscanf(const wchar_t* s, const wchar_t* fmt, va_list args)
|
|||
|
||||
return vfwscanf(&f, fmt, args);
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2011 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -23,8 +23,16 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(vwprintf)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
vwprintf(const wchar_t* fmt, va_list args)
|
||||
{
|
||||
return vfwprintf(sfstdout, fmt, args);
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2011 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -23,8 +23,16 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(vwscanf)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
vwscanf(const wchar_t* fmt, va_list args)
|
||||
{
|
||||
return vfwscanf(sfstdin, fmt, args);
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2011 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(wprintf)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
wprintf(const wchar_t* fmt, ...)
|
||||
{
|
||||
|
@ -34,3 +40,5 @@ wprintf(const wchar_t* fmt, ...)
|
|||
va_end(args);
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2011 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "stdhdr.h"
|
||||
|
||||
#if !_has_multibyte
|
||||
|
||||
NoN(wscanf)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
wscanf(const wchar_t* fmt, ...)
|
||||
{
|
||||
|
@ -34,3 +40,5 @@ wscanf(const wchar_t* fmt, ...)
|
|||
va_end(args);
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif /* !_has_multibyte */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue