>--- subversion/libsvn_subr/cmdline.c (Revision 15391)
>+++ subversion/libsvn_subr/cmdline.c (Arbeitskopie)
>@@ -36,6 +36,7 @@
> #include "svn_pools.h"
> #include "svn_error.h"
> #include "utf_impl.h"
> #include "svn_private_config.h"
>@@ -56,13 +57,50 @@
> /* The stdout encoding. If null, it's the same as the native encoding. */
> static const char *output_encoding = NULL;
>+/* Client crash callback */
>+typedef BOOL (CALLBACK *LPGETLOGFILE) (LPVOID lpvState);
>+/* Stack trace callback */
>+typedef void (*TraceCallbackFunction)(DWORD address, const char *ImageName,
>+ const char *FunctionName, DWORD functionDisp,
>+ const char *Filename, DWORD LineNumber, DWORD lineDisp,
>+ void *data);
A general not on style: We don't allow tabs or lines longer than 80 columns.
>+typedef LPVOID (*InstallEx)(LPGETLOGFILE pfn, LPCSTR lpcszTo, LPCSTR lpcszSubject);
>+typedef void (*UninstallEx)(LPVOID lpState);
>+HMODULE crashDll = 0;
>+LPVOID lpvState = 0;
>+ UninstallEx pfnUninstallEx;
>+ if ((crashDll)&&(lpvState))
>+ pfnUninstallEx = (UninstallEx)GetProcAddress(crashDll, "UninstallEx");
First of all, svn_cmdline_remove_crashrpt should not be a public
function. It should be static, and not have the svn_ prefix in the name.
The way you use crashDll and lpvState is not thread safe. You can assume
that svn_cmdline_init is called in a single-threaded environment, but
I'm not sure about the teardown functions. Presumably atexit will be
called once, but we hav to be sure about this.
Next: you're missing a ton of docstrings here. Generally every variable
and function should have a docstring.
You're still using Hungarian notation even with symbols that are not
related to the contents of crashrpt.dll. You're not conforming to the
indentation rules, etc. etc.
You're not checking the return value of GetProcAddress. It _can_ fail,
and if it does, the client shouldn't crash.
> svn_cmdline_init (const char *progname, FILE *error_stream)
> apr_status_t status;
> apr_pool_t *pool;
>+ /* Load the crash reporting dll if it's available */
>+ InstallEx pfnInstallEx;
>+ crashDll = LoadLibrary("CrashRpt");
>+ if (crashDll)
>+ pfnInstallEx = (InstallEx)GetProcAddress(crashDll, "InstallEx");
>+ lpvState = (pfnInstallEx)(NULL, "email@example.com", SVN_VER_NUM);
Most of the above comments apply here, too.
One thing I'm nervous about is your calling GetProcAddress instead of
GetProcAddressA, when the name of the procedure is always a
Regarding the mailing address: I suppose the breakage address would be
the most appropriate here (firstname.lastname@example.org), unless
people thing we need a new mailing list for crash reports.
I don't like the idea of command-line programs popping up dialogue
boxes. This is especially annoying when the program in question is a
server, such as svnserve. I'd like to have a way to configure the crash
reporter to dump the data in a text file instead, and perhaps leave a
pointer to that file in the event log.
Another issue is the name of crashrpt.dll. This seems to me to be a much
too generic name, and likely to collide with other DLLs on the system.
svn_crachrpt.dll would be much better. (If you'll recall, we had
problems with intl.dll, which is why we renamed our copy to svn_intl3.dll).
To unsubscribe, e-mail: email@example.com
For additional commands, e-mail: firstname.lastname@example.org
Received on Sun Jul 24 14:58:16 2005