wrowe 02/01/28 22:43:22
Modified: misc/win32 apr_app.c
Log:
Not ready for it's own prime time slot in any build - note the purpose
and some hints already for folks wondering where this module is going.
Revision Changes Path
1.2 +17 -3 apr/misc/win32/apr_app.c
Index: apr_app.c
===================================================================
RCS file: /home/cvs/apr/misc/win32/apr_app.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- apr_app.c 29 Jan 2002 06:27:19 -0000 1.1
+++ apr_app.c 29 Jan 2002 06:43:22 -0000 1.2
@@ -52,6 +52,19 @@
* <http://www.apache.org/>.
*/
+/* Usage Notes:
+ *
+ * this module, and the i18n/unix/ucs2_utf8.c modules must be
+ * compiled APR_EXPORT_STATIC and linked to an application with
+ * the /entry:wmainCRTStartup flag. This module becomes the true
+ * wmain entry point, and passes utf-8 reformatted argv and env
+ * arrays to the application's main function.
+ *
+ * This module is only compatible with Unicode-only executables.
+ * Mixed (Win9x backwards compatible) binaries should refer instead
+ * to the apr_startup.c module.
+ */
+
#include "apr_private.h"
#include "apr_general.h"
#include "wchar.h"
@@ -104,14 +117,12 @@
newarr[arg] = NULL;
*ele = '\0';
- /* Return to the free store, we hope, if the heap
- * realloc is at all optimized.
+ /* Return to the free store if the heap realloc is the least bit
optimized
*/
ele = realloc(elements, ele - elements);
if (ele != elements) {
size_t diff = ele - elements;
- DebugBreak();
for (arg = 0; arg < args; ++arg) {
newarr[arg] += diff;
}
@@ -128,7 +139,10 @@
int dupenv;
(void)wastrtoastr(&argv, wargv, argc);
+
+ _wenviron = wenv;
dupenv = wastrtoastr(&env, wenv, -1);
+
_environ = malloc((dupenv + 1) * sizeof (char *));
memcpy(_environ, env, (dupenv + 1) * sizeof (char *));