r23779: Change from v2 or later to v3 or later.
[gd/samba/.git] / source3 / modules / charset_macosxfs.c
index 6f50d879ba4bd1d6b3f5d76e87b9a3545549c6fe..51c3fbe4c9deb251464fb943b93eeb7d8573d76c 100644 (file)
@@ -5,7 +5,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -41,8 +41,8 @@
  * See if autoconf has found us the internal headers in some form.
  */
 #if HAVE_COREFOUNDATION_CFSTRINGENCODINGCONVERTER_H
-#      include <Corefoundation/CFStringEncodingConverter.h>
-#      include <Corefoundation/CFUnicodePrecomposition.h>
+#      include <CoreFoundation/CFStringEncodingConverter.h>
+#      include <CoreFoundation/CFUnicodePrecomposition.h>
 #      define USE_INTERNAL_API 1
 #elif HAVE_CFSTRINGENCODINGCONVERTER_H
 #      include <CFStringEncodingConverter.h>
@@ -62,7 +62,7 @@ static inline void *resize_buffer (void *buffer, size_t *size, size_t newsize)
 {
        if (newsize > *size) {
                *size = newsize + 128;
-               buffer = realloc(buffer, *size);
+               buffer = SMB_REALLOC(buffer, *size);
        }
        return buffer;
 }
@@ -202,9 +202,9 @@ static void hexdump( const char * label, const char * s, size_t len )
  * perfect fits.
  */
 static size_t macosxfs_encoding_pull(
-       void *cd,                               /* Encoder handle */
-       char **inbuf, size_t *inbytesleft,      /* Script string */
-       char **outbuf, size_t *outbytesleft)    /* UTF-16-LE string */
+       void *cd,                                   /* Encoder handle */
+       const char **inbuf, size_t *inbytesleft,    /* Script string */
+       char **outbuf, size_t *outbytesleft)        /* UTF-16-LE string */
 {
        static const int script_code = kCFStringEncodingUTF8;
        static CFMutableStringRef cfstring = NULL;
@@ -324,9 +324,9 @@ static size_t macosxfs_encoding_pull(
 }
 
 static size_t macosxfs_encoding_push(
-       void *cd,                               /* Encoder handle */
-       char **inbuf, size_t *inbytesleft,      /* UTF-16-LE string */
-       char **outbuf, size_t *outbytesleft)    /* Script string */
+       void *cd,                                   /* Encoder handle */
+       const char **inbuf, size_t *inbytesleft,    /* UTF-16-LE string */
+       char **outbuf, size_t *outbytesleft)        /* Script string */
 {
        static const int script_code = kCFStringEncodingUTF8;
        static CFMutableStringRef cfstring = NULL;
@@ -374,7 +374,7 @@ static size_t macosxfs_encoding_push(
        charsconverted = CFStringGetBytes(
                cfstring, CFRangeMake(0,cfsize),
                script_code, 0, False,
-               *outbuf, *outbytesleft, &outsize);
+               (uint8_t *)(*outbuf), *outbytesleft, &outsize);
 
        if (0 == charsconverted) {
                debug_out("String conversion: "
@@ -594,7 +594,7 @@ static struct charset_functions macosxfs_encoding_functions = {
        "MACOSXFS", macosxfs_encoding_pull, macosxfs_encoding_push
 };
 
-NTSTATUS init_module(void)
+NTSTATUS charset_macosxfs_init(void)
 {
        return smb_register_charset(&macosxfs_encoding_functions);
 }