]> arthur.barton.de Git - netatalk.git/commitdiff
don't store in struct volume pointers to charset function table, we only need texten...
authordidg <didg>
Sun, 8 Nov 2009 23:17:39 +0000 (23:17 +0000)
committerdidg <didg>
Sun, 8 Nov 2009 23:17:39 +0000 (23:17 +0000)
etc/afpd/file.c
etc/afpd/volume.c
include/atalk/volume.h

index fac35b7fa71a1e282d92dcb28a30f1b2f75e3f5c..84caef4d22acd5be432f6b7944fd337256bccfc0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.c,v 1.120 2009-11-02 14:35:27 didg Exp $
+ * $Id: file.c,v 1.121 2009-11-08 23:17:39 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -158,7 +158,7 @@ char *set_name(const struct vol *vol, char *data, cnid_t pid, char *name, cnid_t
         if (aint > 255)  /* FIXME safeguard, anyway if no ascii char it's game over*/
            aint = 255;
 
-        utf8 = vol->v_mac?htonl(vol->v_mac->kTextEncoding):0;         /* htonl(utf8) */
+        utf8 = vol->v_kTextEncoding;
         memcpy(data, &utf8, sizeof(utf8));
         data += sizeof(utf8);
         
index f9e0b2257b4e008bb1a49898f67c6aa021e0899f..687698d51b871b592aa49529b326a4367555187c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.c,v 1.99 2009-11-06 04:28:25 didg Exp $
+ * $Id: volume.c,v 1.100 2009-11-08 23:17:40 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -1786,7 +1786,8 @@ int afp_openvol(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t
     char        *vol_uname;
     char        *vol_mname;
     char        *volname_tmp;
-
+    struct charset_functions *charset;
+    
     ibuf += 2;
     memcpy(&bitmap, ibuf, sizeof( bitmap ));
     bitmap = ntohs( bitmap );
@@ -1953,7 +1954,7 @@ int afp_openvol(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t
        goto openvol_err;
     }
 
-    if ( NULL == ( volume->v_vol = find_charset_functions(volume->v_volcodepage)) || volume->v_vol->flags & CHARSET_ICONV ) {
+    if ( NULL == (charset = find_charset_functions(volume->v_volcodepage)) || charset->flags & CHARSET_ICONV ) {
        LOG (log_warning, logtype_afpd, "WARNING: volume encoding %s is *not* supported by netatalk, expect problems !!!!", volume->v_volcodepage);
     }  
 
@@ -1966,11 +1967,12 @@ int afp_openvol(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t
        goto openvol_err;
     }
 
-    if ( NULL == ( volume->v_mac = find_charset_functions(volume->v_maccodepage)) || ! (volume->v_mac->flags & CHARSET_CLIENT) ) {
+    if ( NULL == ( charset = find_charset_functions(volume->v_maccodepage)) || ! (charset->flags & CHARSET_CLIENT) ) {
        LOG (log_error, logtype_afpd, "Fatal error: mac charset %s not supported", volume->v_maccodepage);
        ret = AFPERR_MISC;
        goto openvol_err;
-    }  
+    }
+    volume->v_kTextEncoding = htonl(charset->kTextEncoding);
 
     ret  = stat_vol(bitmap, volume, rbuf, rbuflen);
     if (ret == AFP_OK) {
index 254e5053d9e7df975b10cb1e5b6d38bcbcaa4d14..037eca74df99d410c74807fc4848ae15217b47a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.h,v 1.3 2009-11-08 22:08:04 didg Exp $
+ * $Id: volume.h,v 1.4 2009-11-08 23:17:40 didg Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -33,7 +33,9 @@ struct vol {
 
     charset_t          v_volcharset;   
     charset_t          v_maccharset;
-    struct charset_functions   *v_mac;
+    long               v_kTextEncoding; /* mac charset encoding in network order 
+                                         * XXX should be a u_int32_t ?
+                                         */
 
     int                 v_casefold;
     size_t              max_filename;
@@ -77,8 +79,6 @@ struct vol {
     void                *v_nfsclient;
     int                 v_nfs;
     
-    struct charset_functions   *v_vol;  /* set but not used */
-
     /* only when opening/closing volumes or in error */
     char               *v_localname;   /* as defined in AppleVolumes.default */
     char                *v_volcodepage;