You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2002/04/13 21:27:24 UTC
cvs commit: apr/misc/win32 internal.c start.c
wrowe 02/04/13 12:27:24
Modified: include apr_general.h
include/arch/win32 misc.h
misc/netware start.c
misc/unix start.c
misc/win32 internal.c start.c
Log:
Correct const'ification of apr_app_initialize and internal related
functions, as pointed out by GStein. Also fix a -very- significant
bug in win32/apr_app_initialize() where we misassigned the new env
memory to env rather than *env as required.
Revision Changes Path
1.70 +6 -2 apr/include/apr_general.h
Index: apr_general.h
===================================================================
RCS file: /home/cvs/apr/include/apr_general.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- apr_general.h 13 Apr 2002 18:17:05 -0000 1.69
+++ apr_general.h 13 Apr 2002 19:27:24 -0000 1.70
@@ -195,12 +195,16 @@
* order to deal with platform-specific oddities, such as Win32 services,
* code pages and signals. This must be the first function called for any
* APR program.
- * @deffunc apr_status_t apr_app_initialize(int *argc, char ***argv, char ***env)
+ * @param argc Pointer to the argc that may be corrected
+ * @param argv Pointer to the argv that may be corrected
+ * @param env Pointer to the env that may be corrected, may be NULL
* @remark See apr_initialize if this is a library consumer of apr.
* Otherwise, this call is identical to apr_initialize, and must be closed
* with a call to apr_terminate at the end of program execution.
*/
-APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, char ***argv, char ***env);
+APR_DECLARE(apr_status_t) apr_app_initialize(int *argc,
+ char const * const * *argv,
+ char const * const * *env);
/**
* Tear down any APR internal data structures which aren't torn down
1.43 +2 -1 apr/include/arch/win32/misc.h
Index: misc.h
===================================================================
RCS file: /home/cvs/apr/include/arch/win32/misc.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- misc.h 13 Mar 2002 20:39:19 -0000 1.42
+++ misc.h 13 Apr 2002 19:27:24 -0000 1.43
@@ -103,7 +103,8 @@
*/
extern int APR_DECLARE_DATA apr_app_init_complete;
-int apr_wastrtoastr(char ***retarr, const wchar_t **arr, int args);
+int apr_wastrtoastr(char const * const * *retarr,
+ wchar_t const * const *arr, int args);
/* Platform specific designation of run time os version.
* Gaps allow for specific service pack levels that
1.7 +3 -1 apr/misc/netware/start.c
Index: start.c
===================================================================
RCS file: /home/cvs/apr/misc/netware/start.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- start.c 9 Apr 2002 15:58:24 -0000 1.6
+++ start.c 13 Apr 2002 19:27:24 -0000 1.7
@@ -62,7 +62,9 @@
#include "internal_time.h"
-APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, char ***argv, char ***env)
+APR_DECLARE(apr_status_t) apr_app_initialize(int *argc,
+ const char * const * *argv,
+ const char * const * *env)
{
/* An absolute noop. At present, only Win32 requires this stub, but it's
* required in order to move command arguments passed through the service
1.65 +3 -1 apr/misc/unix/start.c
Index: start.c
===================================================================
RCS file: /home/cvs/apr/misc/unix/start.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- start.c 9 Apr 2002 06:56:56 -0000 1.64
+++ start.c 13 Apr 2002 19:27:24 -0000 1.65
@@ -61,7 +61,9 @@
#include "internal_time.h"
-APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, char ***argv, char ***env)
+APR_DECLARE(apr_status_t) apr_app_initialize(int *argc,
+ const char * const * *argv,
+ const char * const * *env)
{
/* An absolute noop. At present, only Win32 requires this stub, but it's
* required in order to move command arguments passed through the service
1.4 +2 -1 apr/misc/win32/internal.c
Index: internal.c
===================================================================
RCS file: /home/cvs/apr/misc/win32/internal.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- internal.c 13 Mar 2002 20:39:23 -0000 1.3
+++ internal.c 13 Apr 2002 19:27:24 -0000 1.4
@@ -76,7 +76,8 @@
* These are allocated from the MSVCRT's _CRT_BLOCK to trick the system
* into trusting our store.
*/
-int apr_wastrtoastr(char ***retarr, const wchar_t **arr, int args)
+int apr_wastrtoastr(char const * const * *retarr,
+ wchar_t const * const *arr, int args)
{
size_t elesize = 0;
char **newarr;
1.36 +9 -6 apr/misc/win32/start.c
Index: start.c
===================================================================
RCS file: /home/cvs/apr/misc/win32/start.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- start.c 17 Mar 2002 23:16:46 -0000 1.35
+++ start.c 13 Apr 2002 19:27:24 -0000 1.36
@@ -75,9 +75,10 @@
* as a list of strings. These are allocated from the MSVCRT's
* _CRT_BLOCK to trick the system into trusting our store.
*/
-static int warrsztoastr(char ***retarr, wchar_t *arrsz, int args)
+static int warrsztoastr(const char * const * *retarr,
+ const wchar_t * arrsz, int args)
{
- apr_wchar_t *wch;
+ const apr_wchar_t *wch;
size_t totlen;
size_t newlen;
size_t wsize;
@@ -128,7 +129,9 @@
/* Reprocess the arguments to main() for a completely apr-ized application
*/
-APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, char ***argv, char ***env)
+APR_DECLARE(apr_status_t) apr_app_initialize(int *argc,
+ const char * const * *argv,
+ const char * const * *env)
{
#if APR_HAS_UNICODE_FS
IF_WIN_OS_IS_UNICODE
@@ -155,9 +158,9 @@
dupenv = warrsztoastr(&_environ, sysstr, -1);
if (env) {
- env = _malloc_dbg((dupenv + 1) * sizeof (char *),
- _CRT_BLOCK, __FILE__, __LINE__ );
- memcpy(*env, _environ, (dupenv + 1) * sizeof (char *));
+ *env = _malloc_dbg((dupenv + 1) * sizeof (char *),
+ _CRT_BLOCK, __FILE__, __LINE__ );
+ memcpy((void*)*env, _environ, (dupenv + 1) * sizeof (char *));
}
else {
}