From owner-svn-src-all@FreeBSD.ORG Thu Dec 22 06:31:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C895106564A; Thu, 22 Dec 2011 06:31:29 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 876838FC0A; Thu, 22 Dec 2011 06:31:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBM6VTFE003777; Thu, 22 Dec 2011 06:31:29 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBM6VT6g003775; Thu, 22 Dec 2011 06:31:29 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201112220631.pBM6VT6g003775@svn.freebsd.org> From: Kevin Lo Date: Thu, 22 Dec 2011 06:31:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228796 - head/sys/fs/msdosfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2011 06:31:29 -0000 Author: kevlo Date: Thu Dec 22 06:31:29 2011 New Revision: 228796 URL: http://svn.freebsd.org/changeset/base/228796 Log: Discarding local array based on return values Modified: head/sys/fs/msdosfs/msdosfs_conv.c Modified: head/sys/fs/msdosfs/msdosfs_conv.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_conv.c Thu Dec 22 03:36:54 2011 (r228795) +++ head/sys/fs/msdosfs/msdosfs_conv.c Thu Dec 22 06:31:29 2011 (r228796) @@ -61,9 +61,9 @@ extern struct iconv_functions *msdosfs_iconv; static int mbsadjpos(const char **, size_t, size_t, int, int, void *handle); -static u_char * dos2unixchr(const u_char **, size_t *, int, struct msdosfsmount *); +static u_char * dos2unixchr(u_char *, const u_char **, size_t *, int, struct msdosfsmount *); static u_int16_t unix2doschr(const u_char **, size_t *, struct msdosfsmount *); -static u_char * win2unixchr(u_int16_t, struct msdosfsmount *); +static u_char * win2unixchr(u_char *, u_int16_t, struct msdosfsmount *); static u_int16_t unix2winchr(const u_char **, size_t *, int, struct msdosfsmount *); /* @@ -242,7 +242,7 @@ dos2unixfn(dn, un, lower, pmp) { size_t i; int thislong = 0; - u_char *c; + u_char *c, tmpbuf[5]; /* * If first char of the filename is SLOT_E5 (0x05), then the real @@ -257,8 +257,8 @@ dos2unixfn(dn, un, lower, pmp) * Copy the name portion into the unix filename string. */ for (i = 8; i > 0 && *dn != ' ';) { - c = dos2unixchr((const u_char **)&dn, &i, lower & LCASE_BASE, - pmp); + c = dos2unixchr(tmpbuf, (const u_char **)&dn, &i, + lower & LCASE_BASE, pmp); while (*c != '\0') { *un++ = *c++; thislong++; @@ -274,7 +274,7 @@ dos2unixfn(dn, un, lower, pmp) *un++ = '.'; thislong++; for (i = 3; i > 0 && *dn != ' ';) { - c = dos2unixchr((const u_char **)&dn, &i, + c = dos2unixchr(tmpbuf, (const u_char **)&dn, &i, lower & LCASE_EXT, pmp); while (*c != '\0') { *un++ = *c++; @@ -648,7 +648,7 @@ win2unixfn(nbp, wep, chksum, pmp) int chksum; struct msdosfsmount *pmp; { - u_char *c; + u_char *c, tmpbuf[5]; u_int8_t *cp; u_int8_t *np, name[WIN_CHARS * 3 + 1]; u_int16_t code; @@ -683,7 +683,7 @@ win2unixfn(nbp, wep, chksum, pmp) *np = '\0'; return -1; default: - c = win2unixchr(code, pmp); + c = win2unixchr(tmpbuf, code, pmp); while (*c != '\0') *np++ = *c++; break; @@ -701,7 +701,7 @@ win2unixfn(nbp, wep, chksum, pmp) *np = '\0'; return -1; default: - c = win2unixchr(code, pmp); + c = win2unixchr(tmpbuf, code, pmp); while (*c != '\0') *np++ = *c++; break; @@ -719,7 +719,7 @@ win2unixfn(nbp, wep, chksum, pmp) *np = '\0'; return -1; default: - c = win2unixchr(code, pmp); + c = win2unixchr(tmpbuf, code, pmp); while (*c != '\0') *np++ = *c++; break; @@ -812,9 +812,9 @@ mbsadjpos(const char **instr, size_t inl * Convert DOS char to Local char */ static u_char * -dos2unixchr(const u_char **instr, size_t *ilen, int lower, struct msdosfsmount *pmp) +dos2unixchr(u_char *outbuf, const u_char **instr, size_t *ilen, int lower, struct msdosfsmount *pmp) { - u_char c, *outp, outbuf[5]; + u_char c, *outp; size_t len, olen; outp = outbuf; @@ -933,9 +933,9 @@ unix2doschr(const u_char **instr, size_t * Convert Windows char to Local char */ static u_char * -win2unixchr(u_int16_t wc, struct msdosfsmount *pmp) +win2unixchr(u_char *outbuf, u_int16_t wc, struct msdosfsmount *pmp) { - u_char *inp, *outp, inbuf[3], outbuf[5]; + u_char *inp, *outp, inbuf[3]; size_t ilen, olen, len; outp = outbuf;