Deleted Added
full compact
vfwprintf.c (189131) vfwprintf.c (189138)
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

31 */
32
33#if 0
34#if defined(LIBC_SCCS) && !defined(lint)
35static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
36#endif /* LIBC_SCCS and not lint */
37#endif
38#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

31 */
32
33#if 0
34#if defined(LIBC_SCCS) && !defined(lint)
35static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
36#endif /* LIBC_SCCS and not lint */
37#endif
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/lib/libc/stdio/vfwprintf.c 189131 2009-02-28 04:58:18Z das $");
39__FBSDID("$FreeBSD: head/lib/libc/stdio/vfwprintf.c 189138 2009-02-28 06:06:57Z das $");
40
41/*
42 * Actual wprintf innards.
43 *
44 * Avoid making gratuitous changes to this source file; it should be kept
45 * as close as possible to vfprintf.c for ease of maintenance.
46 */
47

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

885 convbuf = __mbsconv(mbp, prec);
886 if (convbuf == NULL) {
887 fp->_flags |= __SERR;
888 goto error;
889 }
890 cp = convbuf;
891 }
892 }
40
41/*
42 * Actual wprintf innards.
43 *
44 * Avoid making gratuitous changes to this source file; it should be kept
45 * as close as possible to vfprintf.c for ease of maintenance.
46 */
47

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

885 convbuf = __mbsconv(mbp, prec);
886 if (convbuf == NULL) {
887 fp->_flags |= __SERR;
888 goto error;
889 }
890 cp = convbuf;
891 }
892 }
893
894 if (prec >= 0) {
895 /*
896 * can't use wcslen; can only look for the
897 * NUL in the first `prec' characters, and
898 * wcslen() will go further.
899 */
900 wchar_t *p = wmemchr(cp, 0, (size_t)prec);
901
902 if (p != NULL) {
903 size = p - cp;
904 if (size > prec)
905 size = prec;
906 } else
907 size = prec;
908 } else
909 size = wcslen(cp);
893 size = (prec >= 0) ? wcsnlen(cp, prec) : wcslen(cp);
910 sign = '\0';
911 break;
912 case 'U':
913 flags |= LONGINT;
914 /*FALLTHROUGH*/
915 case 'u':
916 if (flags & INTMAX_SIZE)
917 ujval = UJARG();

--- 185 unchanged lines hidden ---
894 sign = '\0';
895 break;
896 case 'U':
897 flags |= LONGINT;
898 /*FALLTHROUGH*/
899 case 'u':
900 if (flags & INTMAX_SIZE)
901 ujval = UJARG();

--- 185 unchanged lines hidden ---