svn commit: samba r25456 - in branches/SAMBA_4_0: . source/lib/charset source/param

jelmer at samba.org jelmer at samba.org
Mon Oct 1 23:26:41 GMT 2007


Author: jelmer
Date: 2007-10-01 23:26:37 +0000 (Mon, 01 Oct 2007)
New Revision: 25456

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25456

Log:
Avoid externs for charsets for now - it breaks openchange.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/lib/charset/charcnv.c
   branches/SAMBA_4_0/source/lib/charset/charset.h
   branches/SAMBA_4_0/source/param/loadparm.c


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/lib/charset/charcnv.c
===================================================================
--- branches/SAMBA_4_0/source/lib/charset/charcnv.c	2007-10-01 23:18:26 UTC (rev 25455)
+++ branches/SAMBA_4_0/source/lib/charset/charcnv.c	2007-10-01 23:26:37 UTC (rev 25456)
@@ -38,20 +38,16 @@
  * @sa lib/iconv.c
  */
 
-char *unix_charset = NULL;
-char *dos_charset = NULL;
-char *display_charset = NULL;
-
 /**
  * Return the name of a charset to give to iconv().
  **/
-static const char *charset_name(charset_t ch)
+static const char *charset_name(struct loadparm_context *lp_ctx, charset_t ch)
 {
 	switch (ch) {
 	case CH_UTF16: return "UTF-16LE";
-	case CH_UNIX: return unix_charset;
-	case CH_DOS: return dos_charset;
-	case CH_DISPLAY: return display_charset;
+	case CH_UNIX: return lp_unix_charset(lp_ctx);
+	case CH_DOS: return lp_dos_charset(lp_ctx);
+	case CH_DISPLAY: return lp_display_charset(lp_ctx);
 	case CH_UTF8: return "UTF8";
 	case CH_UTF16BE: return "UTF-16BE";
 	default:
@@ -109,20 +105,20 @@
 		return conv_handles[from][to];
 	}
 
-	n1 = charset_name(from);
-	n2 = charset_name(to);
+	n1 = charset_name(global_loadparm, from);
+	n2 = charset_name(global_loadparm, to);
 
 	conv_handles[from][to] = smb_iconv_open(n2,n1);
 	
 	if (conv_handles[from][to] == (smb_iconv_t)-1) {
 		if ((from == CH_DOS || to == CH_DOS) &&
-		    strcasecmp(charset_name(CH_DOS), "ASCII") != 0) {
+		    strcasecmp(charset_name(global_loadparm, CH_DOS), "ASCII") != 0) {
 			DEBUG(0,("dos charset '%s' unavailable - using ASCII\n",
-				 charset_name(CH_DOS)));
+				 charset_name(global_loadparm, CH_DOS)));
 			lp_set_cmdline(global_loadparm, "dos charset", "ASCII");
 
-			n1 = charset_name(from);
-			n2 = charset_name(to);
+			n1 = charset_name(global_loadparm, from);
+			n2 = charset_name(global_loadparm, to);
 			
 			conv_handles[from][to] = smb_iconv_open(n2,n1);
 		}
@@ -176,12 +172,12 @@
 				reason="No more room"; 
 				if (from == CH_UNIX) {
 					DEBUG(0,("E2BIG: convert_string(%s,%s): srclen=%d destlen=%d - '%s'\n",
-						 charset_name(from), charset_name(to),
+						 charset_name(global_loadparm, from), charset_name(global_loadparm, to),
 						 (int)srclen, (int)destlen, 
 						 (const char *)src));
 				} else {
 					DEBUG(0,("E2BIG: convert_string(%s,%s): srclen=%d destlen=%d\n",
-						 charset_name(from), charset_name(to),
+						 charset_name(global_loadparm, from), charset_name(global_loadparm, to),
 						 (int)srclen, (int)destlen));
 				}
 			       return -1;
@@ -223,7 +219,7 @@
 	if (descriptor == (smb_iconv_t)-1 || descriptor == (smb_iconv_t)0) {
 		/* conversion not supported, return -1*/
 		DEBUG(3, ("convert_string_talloc: conversion from %s to %s not supported!\n",
-			  charset_name(from), charset_name(to)));
+			  charset_name(global_loadparm, from), charset_name(global_loadparm, to)));
 		return -1;
 	}
 

Modified: branches/SAMBA_4_0/source/lib/charset/charset.h
===================================================================
--- branches/SAMBA_4_0/source/lib/charset/charset.h	2007-10-01 23:18:26 UTC (rev 25455)
+++ branches/SAMBA_4_0/source/lib/charset/charset.h	2007-10-01 23:26:37 UTC (rev 25456)
@@ -77,9 +77,4 @@
 #define strlower(s) strlower_m(s)
 #define strupper(s) strupper_m(s)
 
-/* from lib/charset */
-extern char *dos_charset;
-extern char *unix_charset;
-extern char *display_charset;
-
 #endif /* __CHARSET_H__ */

Modified: branches/SAMBA_4_0/source/param/loadparm.c
===================================================================
--- branches/SAMBA_4_0/source/param/loadparm.c	2007-10-01 23:18:26 UTC (rev 25455)
+++ branches/SAMBA_4_0/source/param/loadparm.c	2007-10-01 23:26:37 UTC (rev 25456)
@@ -87,6 +87,9 @@
 
 	const char **smb_ports;
 	char *ncalrpc_dir;
+	char *dos_charset;
+	char *unix_charset;
+	char *display_charset;
 	char *szLockDir;
 	char *szModulesDir;
 	char *szPidDir;
@@ -381,10 +384,10 @@
 
 	{"server role", P_ENUM, P_GLOBAL, &loadparm.Globals.server_role, NULL, enum_server_role, FLAG_BASIC},
 
-	{"dos charset", P_STRING, P_GLOBAL, &dos_charset, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
-	{"unix charset", P_STRING, P_GLOBAL, &unix_charset, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+	{"dos charset", P_STRING, P_GLOBAL, &loadparm.Globals.dos_charset, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+	{"unix charset", P_STRING, P_GLOBAL, &loadparm.Globals.unix_charset, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
 	{"ncalrpc dir", P_STRING, P_GLOBAL, &loadparm.Globals.ncalrpc_dir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
-	{"display charset", P_STRING, P_GLOBAL, &display_charset, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+	{"display charset", P_STRING, P_GLOBAL, &loadparm.Globals.display_charset, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
 	{"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | FLAG_DEVELOPER},
 	{"path", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | FLAG_DEVELOPER},
 	{"directory", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_HIDE},
@@ -698,6 +701,9 @@
 _PUBLIC_ FN_GLOBAL_STRING(lp_modulesdir, szModulesDir)
 _PUBLIC_ FN_GLOBAL_STRING(lp_setupdir, szSetupDir)
 _PUBLIC_ FN_GLOBAL_STRING(lp_ncalrpc_dir, ncalrpc_dir)
+_PUBLIC_ FN_GLOBAL_STRING(lp_dos_charset, dos_charset)
+_PUBLIC_ FN_GLOBAL_STRING(lp_unix_charset, unix_charset)
+_PUBLIC_ FN_GLOBAL_STRING(lp_display_charset, display_charset)
 _PUBLIC_ FN_GLOBAL_STRING(lp_piddir, szPidDir)
 _PUBLIC_ FN_GLOBAL_LIST(lp_dcerpc_endpoint_servers, dcerpc_ep_servers)
 _PUBLIC_ FN_GLOBAL_LIST(lp_server_services, server_services)



More information about the samba-cvs mailing list