Deleted Added
full compact
msdosfs_conv.c (227650) msdosfs_conv.c (227817)
1/* $FreeBSD: head/sys/fs/msdosfs/msdosfs_conv.c 227650 2011-11-18 03:05:20Z kevlo $ */
1/* $FreeBSD: head/sys/fs/msdosfs/msdosfs_conv.c 227817 2011-11-22 13:30:36Z kib $ */
2/* $NetBSD: msdosfs_conv.c,v 1.25 1997/11/17 15:36:40 ws Exp $ */
3
4/*-
5 * Copyright (C) 1995, 1997 Wolfgang Solfrank.
6 * Copyright (C) 1995, 1997 TooLs GmbH.
7 * All rights reserved.
8 * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below).
9 *

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

1031 */
1032void
1033mbnambuf_write(struct mbnambuf *nbp, char *name, int id)
1034{
1035 char *slot;
1036 size_t count, newlen;
1037
1038 if (nbp->nb_len != 0 && id != nbp->nb_last_id - 1) {
2/* $NetBSD: msdosfs_conv.c,v 1.25 1997/11/17 15:36:40 ws Exp $ */
3
4/*-
5 * Copyright (C) 1995, 1997 Wolfgang Solfrank.
6 * Copyright (C) 1995, 1997 TooLs GmbH.
7 * All rights reserved.
8 * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below).
9 *

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

1031 */
1032void
1033mbnambuf_write(struct mbnambuf *nbp, char *name, int id)
1034{
1035 char *slot;
1036 size_t count, newlen;
1037
1038 if (nbp->nb_len != 0 && id != nbp->nb_last_id - 1) {
1039#ifdef MSDOSFS_DEBUG
1039 printf("msdosfs: non-decreasing id: id %d, last id %d\n",
1040 id, nbp->nb_last_id);
1040 printf("msdosfs: non-decreasing id: id %d, last id %d\n",
1041 id, nbp->nb_last_id);
1042#endif
1041 return;
1042 }
1043
1044 /* Will store this substring in a WIN_CHARS-aligned slot. */
1045 slot = &nbp->nb_buf[id * WIN_CHARS];
1046 count = strlen(name);
1047 newlen = nbp->nb_len + count;
1048 if (newlen > WIN_MAXLEN || newlen > MAXNAMLEN) {
1043 return;
1044 }
1045
1046 /* Will store this substring in a WIN_CHARS-aligned slot. */
1047 slot = &nbp->nb_buf[id * WIN_CHARS];
1048 count = strlen(name);
1049 newlen = nbp->nb_len + count;
1050 if (newlen > WIN_MAXLEN || newlen > MAXNAMLEN) {
1051#ifdef MSDOSFS_DEBUG
1049 printf("msdosfs: file name length %zu too large\n", newlen);
1052 printf("msdosfs: file name length %zu too large\n", newlen);
1053#endif
1050 return;
1051 }
1052
1053 /* Shift suffix upwards by the amount length exceeds WIN_CHARS. */
1054 if (count > WIN_CHARS && nbp->nb_len != 0)
1055 bcopy(slot + WIN_CHARS, slot + count, nbp->nb_len);
1056
1057 /* Copy in the substring to its slot and update length so far. */

--- 27 unchanged lines hidden ---
1054 return;
1055 }
1056
1057 /* Shift suffix upwards by the amount length exceeds WIN_CHARS. */
1058 if (count > WIN_CHARS && nbp->nb_len != 0)
1059 bcopy(slot + WIN_CHARS, slot + count, nbp->nb_len);
1060
1061 /* Copy in the substring to its slot and update length so far. */

--- 27 unchanged lines hidden ---