fputwc.c (8f030a44b8c665d111ed900df1a8203dde0af1e7) fputwc.c (6180233fd804806e7301790d2330da50ca57e71f)
1/*-
2 * Copyright (c) 2002 Tim J. Robbins.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 43 unchanged lines hidden (view full) ---

52 * Assume single-byte locale with no special encoding.
53 * A more careful test would be to check
54 * _CurrentRuneLocale->encoding.
55 */
56 *buf = (unsigned char)wc;
57 len = 1;
58 } else {
59 memset(&mbs, 0, sizeof(mbs));
1/*-
2 * Copyright (c) 2002 Tim J. Robbins.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 43 unchanged lines hidden (view full) ---

52 * Assume single-byte locale with no special encoding.
53 * A more careful test would be to check
54 * _CurrentRuneLocale->encoding.
55 */
56 *buf = (unsigned char)wc;
57 len = 1;
58 } else {
59 memset(&mbs, 0, sizeof(mbs));
60 if ((len = wcrtomb(buf, wc, &mbs)) == (size_t)-1)
60 if ((len = wcrtomb(buf, wc, &mbs)) == (size_t)-1) {
61 fp->_flags |= __SERR;
61 return (WEOF);
62 return (WEOF);
63 }
62 }
63
64 for (i = 0; i < len; i++)
65 if (__sputc((unsigned char)buf[i], fp) == EOF)
66 return (WEOF);
67
68 return ((wint_t)wc);
69}

--- 16 unchanged lines hidden ---
64 }
65
66 for (i = 0; i < len; i++)
67 if (__sputc((unsigned char)buf[i], fp) == EOF)
68 return (WEOF);
69
70 return ((wint_t)wc);
71}

--- 16 unchanged lines hidden ---