netatalk  4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
mangle.c File Reference

mangle, demangle (filename) More...

#include <ctype.h>
#include <stdio.h>
#include <atalk/util.h>
#include "desktop.h"
#include "mangle.h"

Macros

#define hextoint(c)   ( isdigit( c ) ? c - '0' : c + 10 - 'A' )
 
#define isuxdigit(x)   (isdigit(x) || (isupper(x) && isxdigit(x)))
 

Functions

static size_t mangle_extension (const struct vol *vol, const char *uname, char *extension, charset_t charset)
 
static char * demangle_checks (const struct vol *vol, char *uname, char *mfilename, size_t prefix, char *ext)
 
static char * private_demangle (const struct vol *vol, char *mfilename, cnid_t did, cnid_t *osx)
 
char * demangle (const struct vol *vol, char *mfilename, cnid_t did)
 
char * demangle_osx (const struct vol *vol, char *mfilename, cnid_t did, cnid_t *fileid)
 
char * mangle (const struct vol *vol, char *filename, size_t filenamelen, char *uname, cnid_t id, int flags)
 

Detailed Description

mangle, demangle (filename)

mangle or demangle filenames if they are greater than the max allowed characters for a given version of AFP.

Macro Definition Documentation

◆ hextoint

#define hextoint (   c)    ( isdigit( c ) ? c - '0' : c + 10 - 'A' )

◆ isuxdigit

#define isuxdigit (   x)    (isdigit(x) || (isupper(x) && isxdigit(x)))

Function Documentation

◆ demangle()

char * demangle ( const struct vol vol,
char *  mfilename,
cnid_t  did 
)

◆ demangle_checks()

static char * demangle_checks ( const struct vol vol,
char *  uname,
char *  mfilename,
size_t  prefix,
char *  ext 
)
static

◆ demangle_osx()

char * demangle_osx ( const struct vol vol,
char *  mfilename,
cnid_t  did,
cnid_t fileid 
)

◆ mangle()

char * mangle ( const struct vol vol,
char *  filename,
size_t  filenamelen,
char *  uname,
cnid_t  id,
int  flags 
)
Bug:

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

Note
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
static int first
Definition nad_ls.c:56
static uint16_t ID
Definition uams_dhx2_pam.c:45

◆ mangle_extension()

static size_t mangle_extension ( const struct vol vol,
const char *  uname,
char *  extension,
charset_t  charset 
)
static

◆ private_demangle()

static char * private_demangle ( const struct vol vol,
char *  mfilename,
cnid_t  did,
cnid_t osx 
)
static