/* length */
memcpy(&namelen, spec1, sizeof(namelen));
namelen = ntohs (namelen);
- if (namelen > 255) /* Safeguard */
- namelen = 255;
+ if (namelen > UTF8FILELEN_EARLY) /* Safeguard */
+ namelen = UTF8FILELEN_EARLY;
memcpy (c1.utf8name, spec1+2, namelen);
c1.utf8name[namelen] = 0;
/* 6*/
for ( p = path; *data != 0 && len > 0; len-- ) {
*p++ = *data++;
- if (p > &path[255]) { /* FIXME safeguard, limit of early Mac OS X */
+ if (p > &path[UTF8FILELEN_EARLY]) { /* FIXME safeguard, limit of early Mac OS X */
afp_errno = AFPERR_PARAM;
return NULL;
}
macnamelength(1) + macname(31) + utf8(4) + utf8namelen(2) + utf8name(255) +
oddpadding(1) */
-#define REPLY_PARAM_MAXLEN (4 + 104 + 1 + MACFILELEN + 4 + 2 + 255 + 1)
+#define REPLY_PARAM_MAXLEN (4 + 104 + 1 + MACFILELEN + 4 + 2 + UTF8FILELEN_EARLY + 1)
/* ----------------------------- */
static int enumerate(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_,
else {
u_int16_t temp;
- if (aint > 255) /* FIXME safeguard, anyway if no ascii char it's game over*/
- aint = 255;
+ if (aint > UTF8FILELEN_EARLY) /* FIXME safeguard, anyway if no ascii char it's game over*/
+ aint = UTF8FILELEN_EARLY;
utf8 = vol->v_kTextEncoding;
memcpy(data, &utf8, sizeof(utf8));
#include <atalk/unicode.h>
#include <atalk/uam.h>
-#define MACFILELEN 31
+/* #define DOSFILELEN 12 */ /* Type1, DOS-compat*/
+#define MACFILELEN 31 /* Type2, HFS-compat */
+#define UTF8FILELEN_EARLY 255 /* Type3, early Mac OS X 10.0-10.4.? */
+/* #define UTF8FILELEN_NAME_MAX 765 */ /* Type3, 10.4.?- , getconf NAME_MAX */
+/* #define UTF8FILELEN_SPEC 0xFFFF */ /* Type3, spec on document */
+/* #define HFSPLUSFILELEN 510 */ /* HFS+ spec, 510byte = 255codepoint */
+
#define MAXUSERLEN 256
#define OPTION_DEBUG (1 << 0)
/*
- * $Id: mangle.c,v 1.19.4.2 2010-02-01 14:25:45 franklahm Exp $
- *
* Copyright (c) 2002. Joe Marcus Clarke (marcus@marcuscom.com)
* All Rights Reserved. See COPYRIGHT.
*
return private_demangle(vol, mfilename, did, fileid);
}
+/* -------------------------------------------------------
+ FIXME !!!
+
+ Early Mac OS X (10.0-10.4.?) had the limitation up to 255 Byte.
+ Current implementation is:
+ volcharset -> UTF16-MAC -> truncated 255 UTF8-MAC
+
+ Recent Mac OS X (10.4.?-) don't have this limitation.
+ Desirable implementation is:
+ volcharset -> truncated 510 UTF16-MAC -> UTF8-MAC
-/* -----------------------
+ ------------------------
with utf8 filename not always round trip
filename mac filename too long or first chars if unmatchable chars.
uname unix filename
id file/folder ID or 0
-
*/
char *
mangle(const struct vol *vol, char *filename, size_t filenamelen, char *uname, cnid_t id, int flags) {
size_t maxlen;
int k;
- maxlen = (flags & 2)?255:MACFILELEN; /* was vol->max_filename */
+ maxlen = (flags & 2)?UTF8FILELEN_EARLY:MACFILELEN; /* was vol->max_filename */
/* Do we really need to mangle this filename? */
if (!(flags & 1) && filenamelen <= maxlen) {
return filename;
/*
- * $Id: ofork.c,v 1.32 2010/03/12 15:16:49 franklahm Exp $
- *
* Copyright (c) 1996 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*/
ad_open really does reinitialize the structure. */
ad_init(ad, vol->v_adouble, vol->v_ad_options);
- ad->ad_m_namelen = 255 +1;
+ ad->ad_m_namelen = UTF8FILELEN_EARLY +1;
/* here's the deal: we allocate enough for the standard mac file length.
* in the future, we'll reallocate in fairly large jumps in case
* of long unicode names */
* FIXME file size
*/
if (utf8_encoding()) {
- volume->max_filename = 255;
+ volume->max_filename = UTF8FILELEN_EARLY;
}
else {
volume->max_filename = MACFILELEN;