Deleted Added
full compact
msdosfs_conv.c (277092) msdosfs_conv.c (277898)
1/* $FreeBSD: head/sys/fs/msdosfs/msdosfs_conv.c 277092 2015-01-12 21:55:48Z emaste $ */
1/* $FreeBSD: head/sys/fs/msdosfs/msdosfs_conv.c 277898 2015-01-29 20:30:13Z dim $ */
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 *

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

248 */
249 if (*dn == SLOT_E5)
250 *dn = 0xe5;
251
252 /*
253 * Copy the name portion into the unix filename string.
254 */
255 for (i = 8; i > 0 && *dn != ' ';) {
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 *

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

248 */
249 if (*dn == SLOT_E5)
250 *dn = 0xe5;
251
252 /*
253 * Copy the name portion into the unix filename string.
254 */
255 for (i = 8; i > 0 && *dn != ' ';) {
256 c = dos2unixchr(tmpbuf, (const u_char **)&dn, &i,
256 c = dos2unixchr(tmpbuf, __DECONST(const u_char **, &dn), &i,
257 lower & LCASE_BASE, pmp);
258 while (*c != '\0') {
259 *un++ = *c++;
260 thislong++;
261 }
262 }
263 dn += i;
264
265 /*
266 * Now, if there is an extension then put in a period and copy in
267 * the extension.
268 */
269 if (*dn != ' ') {
270 *un++ = '.';
271 thislong++;
272 for (i = 3; i > 0 && *dn != ' ';) {
257 lower & LCASE_BASE, pmp);
258 while (*c != '\0') {
259 *un++ = *c++;
260 thislong++;
261 }
262 }
263 dn += i;
264
265 /*
266 * Now, if there is an extension then put in a period and copy in
267 * the extension.
268 */
269 if (*dn != ' ') {
270 *un++ = '.';
271 thislong++;
272 for (i = 3; i > 0 && *dn != ' ';) {
273 c = dos2unixchr(tmpbuf, (const u_char **)&dn, &i,
274 lower & LCASE_EXT, pmp);
273 c = dos2unixchr(tmpbuf, __DECONST(const u_char **, &dn),
274 &i, lower & LCASE_EXT, pmp);
275 while (*c != '\0') {
276 *un++ = *c++;
277 thislong++;
278 }
279 }
280 }
281 *un++ = 0;
282

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

607 return -2;
608
609 for (np = dirbuf.d_name; unlen > 0 && len > 0;) {
610 /*
611 * Comparison must be case insensitive, because FAT disallows
612 * to look up or create files in case sensitive even when
613 * it's a long file name.
614 */
275 while (*c != '\0') {
276 *un++ = *c++;
277 thislong++;
278 }
279 }
280 }
281 *un++ = 0;
282

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

607 return -2;
608
609 for (np = dirbuf.d_name; unlen > 0 && len > 0;) {
610 /*
611 * Comparison must be case insensitive, because FAT disallows
612 * to look up or create files in case sensitive even when
613 * it's a long file name.
614 */
615 c1 = unix2winchr((const u_char **)&np, &len, LCASE_BASE, pmp);
615 c1 = unix2winchr(__DECONST(const u_char **, &np), &len,
616 LCASE_BASE, pmp);
616 c2 = unix2winchr(&un, &unlen, LCASE_BASE, pmp);
617 if (c1 != c2)
618 return -2;
619 }
620 return chksum;
621}
622
623/*

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

917 if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) {
918 inbuf[0] = (u_char)(wc>>8);
919 inbuf[1] = (u_char)wc;
920 inbuf[2] = '\0';
921
922 ilen = 2;
923 olen = len = 4;
924 inp = inbuf;
617 c2 = unix2winchr(&un, &unlen, LCASE_BASE, pmp);
618 if (c1 != c2)
619 return -2;
620 }
621 return chksum;
622}
623
624/*

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

918 if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) {
919 inbuf[0] = (u_char)(wc>>8);
920 inbuf[1] = (u_char)wc;
921 inbuf[2] = '\0';
922
923 ilen = 2;
924 olen = len = 4;
925 inp = inbuf;
925 msdosfs_iconv->convchr(pmp->pm_w2u, (const char **)&inp, &ilen,
926 (char **)&outp, &olen);
926 msdosfs_iconv->convchr(pmp->pm_w2u, __DECONST(const char **,
927 &inp), &ilen, (char **)&outp, &olen);
927 len -= olen;
928
929 /*
930 * return '?' if failed to convert
931 */
932 if (len == 0)
933 *outp++ = '?';
934 } else {

--- 129 unchanged lines hidden ---
928 len -= olen;
929
930 /*
931 * return '?' if failed to convert
932 */
933 if (len == 0)
934 *outp++ = '?';
935 } else {

--- 129 unchanged lines hidden ---