]> arthur.barton.de Git - netatalk.git/commitdiff
keep mtoupath and utompath flags in volume structure, they never changed
authordidg <didg>
Mon, 9 Nov 2009 01:36:18 +0000 (01:36 +0000)
committerdidg <didg>
Mon, 9 Nov 2009 01:36:18 +0000 (01:36 +0000)
etc/afpd/desktop.c
etc/afpd/volume.c
include/atalk/volume.h

index 9850dfc05693abdd3e593ad5052dbfec70326077..9ce7ad2aaeaa888ea65cc578f9dce9765947dff3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: desktop.c,v 1.45 2009-10-29 13:38:15 didg Exp $
+ * $Id: desktop.c,v 1.46 2009-11-09 01:36:18 didg Exp $
  *
  * See COPYRIGHT.
  *
@@ -597,27 +597,15 @@ char *mtoupath(const struct vol *vol, char *mpath, cnid_t did, int utf8)
     char       *m, *u;
     size_t       inplen;
     size_t       outlen;
-    u_int16_t   flags = 0;
+    u_int16_t   flags;
         
     if ( *mpath == '\0' ) {
         return( "." );
     }
 
     /* set conversion flags */
-    if (!(vol->v_flags & AFPVOL_NOHEX))
-        flags |= CONV_ESCAPEHEX;
-    if (!(vol->v_flags & AFPVOL_USEDOTS))
-        flags |= CONV_ESCAPEDOTS;
-
-    if ((vol->v_casefold & AFPVOL_MTOUUPPER))
-        flags |= CONV_TOUPPER;
-    else if ((vol->v_casefold & AFPVOL_MTOULOWER))
-        flags |= CONV_TOLOWER;
-
-    if ((vol->v_flags & AFPVOL_EILSEQ)) {
-        flags |= CONV__EILSEQ;
-    }
-
+    flags = vol->v_mtou_flags;
+    
     m = demangle(vol, mpath, did);
     if (m != mpath) {
         return m;
@@ -647,20 +635,13 @@ char *utompath(const struct vol *vol, char *upath, cnid_t id, int utf8)
 {
     static char  mpath[ MAXPATHLEN + 2]; /* for convert_charset dest_len parameter +2 */
     char        *m, *u;
-    u_int16_t    flags = CONV_IGNORE | CONV_UNESCAPEHEX;
+    u_int16_t    flags;
     size_t       outlen;
 
     m = mpath;
     outlen = strlen(upath);
 
-    if ((vol->v_casefold & AFPVOL_UTOMUPPER))
-        flags |= CONV_TOUPPER;
-    else if ((vol->v_casefold & AFPVOL_UTOMLOWER))
-        flags |= CONV_TOLOWER;
-
-    if ((vol->v_flags & AFPVOL_EILSEQ)) {
-        flags |= CONV__EILSEQ;
-    }
+    flags = vol->v_utom_flags;
 
     u = upath;
 
@@ -670,10 +651,7 @@ char *utompath(const struct vol *vol, char *upath, cnid_t id, int utf8)
        goto utompath_error;
     }
 
-    if (!(flags & CONV_REQMANGLE)) 
-        flags = 0;
-    else
-        flags = 1;
+    flags = !!(flags & CONV_REQMANGLE);
 
     if (utf8)
         flags |= 2;
index 687698d51b871b592aa49529b326a4367555187c..90f8d633a5604badf92d5eb90878d60b39da339d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.c,v 1.100 2009-11-08 23:17:40 didg Exp $
+ * $Id: volume.c,v 1.101 2009-11-09 01:36:18 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -770,7 +770,32 @@ static int creatvol(AFPObj *obj, struct passwd *pwd,
        else 
            volume->v_adouble = AD_VERSION;
 
+        /* Mac to Unix conversion flags*/
+        volume->v_mtou_flags = 0;
+        if (!(volume->v_flags & AFPVOL_NOHEX))
+            volume->v_mtou_flags |= CONV_ESCAPEHEX;
+        if (!(volume->v_flags & AFPVOL_USEDOTS))
+            volume->v_mtou_flags |= CONV_ESCAPEDOTS;
+        if ((volume->v_flags & AFPVOL_EILSEQ))
+            volume->v_mtou_flags |= CONV__EILSEQ;
+
+        if ((volume->v_casefold & AFPVOL_MTOUUPPER))
+            volume->v_mtou_flags |= CONV_TOUPPER;
+        else if ((volume->v_casefold & AFPVOL_MTOULOWER))
+            volume->v_mtou_flags |= CONV_TOLOWER;
+
+        /* Unix to Mac conversion flags*/
+        volume->v_utom_flags = CONV_IGNORE | CONV_UNESCAPEHEX;
+        if ((volume->v_casefold & AFPVOL_UTOMUPPER))
+            volume->v_utom_flags |= CONV_TOUPPER;
+        else if ((volume->v_casefold & AFPVOL_UTOMLOWER))
+            volume->v_utom_flags |= CONV_TOLOWER;
+
+        if ((volume->v_flags & AFPVOL_EILSEQ)) 
+            volume->v_utom_flags |= CONV__EILSEQ;
+
        initvol_vfs(volume);
+
 #ifdef FORCE_UIDGID
         if (options[VOLOPT_FORCEUID].c_value) {
             volume->v_forceuid = strdup(options[VOLOPT_FORCEUID].c_value);
index 037eca74df99d410c74807fc4848ae15217b47a0..ffcdb43ddad616c7c7dd46fc0f3a54dc9216f7a5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.h,v 1.4 2009-11-08 23:17:40 didg Exp $
+ * $Id: volume.h,v 1.5 2009-11-09 01:36:18 didg Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -33,11 +33,13 @@ struct vol {
 
     charset_t          v_volcharset;   
     charset_t          v_maccharset;
+
+    u_int16_t          v_mtou_flags;    /* flags for convert_charset in mtoupath */
+    u_int16_t          v_utom_flags;
+
     long               v_kTextEncoding; /* mac charset encoding in network order 
                                          * XXX should be a u_int32_t ?
                                          */
-
-    int                 v_casefold;
     size_t              max_filename;
     
     char                *v_veto;
@@ -80,6 +82,8 @@ struct vol {
     int                 v_nfs;
     
     /* only when opening/closing volumes or in error */
+    int                 v_casefold;
+
     char               *v_localname;   /* as defined in AppleVolumes.default */
     char                *v_volcodepage;
     char               *v_maccodepage;