[grisbi-cvs] grisbi/src main.c,1.177,1.178

Gunee guneemwelloeux at users.sourceforge.net
Fri May 21 00:12:21 CEST 2010


Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv21675

Modified Files:
	main.c 
Log Message:
Windows (MSVC): Transcribing wide chars arguments to normal chars (UTF8 encoded)

Index: main.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/main.c,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -d -r1.177 -r1.178
--- main.c	4 May 2010 20:58:26 -0000	1.177
+++ main.c	20 May 2010 22:12:18 -0000	1.178
@@ -82,13 +82,17 @@
                      LPWSTR    lpCmdLine,
                      int       nCmdShow)
 {
-	int argc, nLen;
+	int argc, nLen, i;
 	LPWSTR * argvP;
-	char ** argv = malloc(sizeof(char**));
+	char ** argv;
 	argvP = CommandLineToArgvW(GetCommandLineW(), &(argc));
-	nLen = WideCharToMultiByte(CP_UTF8, 0,argvP[0], -1, NULL, 0, NULL, NULL);
-	*argv = malloc((nLen + 1) * sizeof(char));
-	WideCharToMultiByte(CP_UTF8, 0, argvP[0], -1, *argv, nLen, NULL, NULL);
+	argv = malloc (argc* sizeof(char *));
+	for (i = 0 ; i<argc ; i++)
+	{
+		nLen = WideCharToMultiByte(CP_UTF8, 0,argvP[i], -1, NULL, 0, NULL, NULL);
+		argv[i] = malloc((nLen + 1) * sizeof(char));
+		WideCharToMultiByte(CP_UTF8, 0, argvP[i], -1, argv[i], nLen, NULL, NULL);
+	}
 	return main(argc, argv);
 }
 #endif



More information about the cvs mailing list