Fossil SCM

make winhttp.c compilable without -DUNICODE

jan.nijtmans 2012-08-30 12:34 UTC eclipse-project
Commit d0256a17beaa9be24875ff86a61201e7159eec78
1 file changed +10 -14
+10 -14
--- src/winhttp.c
+++ src/winhttp.c
@@ -298,11 +298,11 @@
298298
0,
299299
NULL
300300
);
301301
}
302302
if( nMsg ){
303
- zMsg = fossil_unicode_to_utf8(tmp);
303
+ zMsg = fossil_unicode_to_utf8(tmp);
304304
}else{
305305
fossil_fatal("unable to get system error message.");
306306
}
307307
if( tmp ){
308308
LocalFree((HLOCAL) tmp);
@@ -380,15 +380,11 @@
380380
){
381381
382382
/* Update the service information. */
383383
hsData.isRunningAsService = 1;
384384
if( argc>0 ){
385
-#ifdef UNICODE
386385
hsData.zServiceName = fossil_unicode_to_utf8(argv[0]);
387
-#else
388
- hsData.zServiceName = fossil_mbcs_to_utf8(argv[0]);
389
-#endif
390386
}
391387
392388
/* Register the service control handler function */
393389
sshStatusHandle = RegisterServiceCtrlHandlerW(L"", win32_http_service_ctrl);
394390
if( !sshStatusHandle ){
@@ -568,12 +564,12 @@
568564
n = strlen(zMethod);
569565
570566
if( strncmp(zMethod, "create", n)==0 ){
571567
SC_HANDLE hScm;
572568
SC_HANDLE hSvc;
573
- SERVICE_DESCRIPTION
574
- svcDescr = {TEXT("Fossil - Distributed Software Configuration Management")};
569
+ SERVICE_DESCRIPTIONW
570
+ svcDescr = {L"Fossil - Distributed Software Configuration Management"};
575571
char *zErrFmt = "unable to create service '%s': %s";
576572
DWORD dwStartType = SERVICE_DEMAND_START;
577573
const char *zDisplay = find_option("display", "D", 1);
578574
const char *zStart = find_option("start", "S", 1);
579575
const char *zUsername = find_option("username", "U", 1);
@@ -696,35 +692,35 @@
696692
if( strncmp(zMethod, "show", n)==0 ){
697693
SC_HANDLE hScm;
698694
SC_HANDLE hSvc;
699695
SERVICE_STATUS sstat;
700696
LPQUERY_SERVICE_CONFIGW pSvcConfig;
701
- LPSERVICE_DESCRIPTION pSvcDescr;
697
+ LPSERVICE_DESCRIPTIONW pSvcDescr;
702698
BOOL bStatus;
703699
DWORD nRequired;
704
- char *zErrFmt = "unable to show service '%s': %s";
705
- static const char *zSvcTypes[] = {
700
+ static const char *zErrFmt = "unable to show service '%s': %s";
701
+ static const char *const zSvcTypes[] = {
706702
"Driver service",
707703
"File system driver service",
708704
"Service runs in its own process",
709705
"Service shares a process with other services",
710706
"Service can interact with the desktop"
711707
};
712
- const char *zSvcType = "";
713
- static char *zSvcStartTypes[] = {
708
+ static const char *zSvcType = "";
709
+ static const char *zSvcStartTypes[] = {
714710
"Started by the system loader",
715711
"Started by the IoInitSystem function",
716712
"Started automatically by the service control manager",
717713
"Started manually",
718714
"Service cannot be started"
719715
};
720
- const char *zSvcStartType = "";
716
+ static const char *zSvcStartType = "";
721717
static const char *zSvcStates[] = {
722718
"Stopped", "Starting", "Stopping", "Running",
723719
"Continue pending", "Pause pending", "Paused"
724720
};
725
- const char *zSvcState = "";
721
+ static const char *zSvcState = "";
726722
727723
verify_all_options();
728724
if( g.argc==4 ){
729725
zSvcName = g.argv[3];
730726
}else if( g.argc>4 ){
731727
--- src/winhttp.c
+++ src/winhttp.c
@@ -298,11 +298,11 @@
298 0,
299 NULL
300 );
301 }
302 if( nMsg ){
303 zMsg = fossil_unicode_to_utf8(tmp);
304 }else{
305 fossil_fatal("unable to get system error message.");
306 }
307 if( tmp ){
308 LocalFree((HLOCAL) tmp);
@@ -380,15 +380,11 @@
380 ){
381
382 /* Update the service information. */
383 hsData.isRunningAsService = 1;
384 if( argc>0 ){
385 #ifdef UNICODE
386 hsData.zServiceName = fossil_unicode_to_utf8(argv[0]);
387 #else
388 hsData.zServiceName = fossil_mbcs_to_utf8(argv[0]);
389 #endif
390 }
391
392 /* Register the service control handler function */
393 sshStatusHandle = RegisterServiceCtrlHandlerW(L"", win32_http_service_ctrl);
394 if( !sshStatusHandle ){
@@ -568,12 +564,12 @@
568 n = strlen(zMethod);
569
570 if( strncmp(zMethod, "create", n)==0 ){
571 SC_HANDLE hScm;
572 SC_HANDLE hSvc;
573 SERVICE_DESCRIPTION
574 svcDescr = {TEXT("Fossil - Distributed Software Configuration Management")};
575 char *zErrFmt = "unable to create service '%s': %s";
576 DWORD dwStartType = SERVICE_DEMAND_START;
577 const char *zDisplay = find_option("display", "D", 1);
578 const char *zStart = find_option("start", "S", 1);
579 const char *zUsername = find_option("username", "U", 1);
@@ -696,35 +692,35 @@
696 if( strncmp(zMethod, "show", n)==0 ){
697 SC_HANDLE hScm;
698 SC_HANDLE hSvc;
699 SERVICE_STATUS sstat;
700 LPQUERY_SERVICE_CONFIGW pSvcConfig;
701 LPSERVICE_DESCRIPTION pSvcDescr;
702 BOOL bStatus;
703 DWORD nRequired;
704 char *zErrFmt = "unable to show service '%s': %s";
705 static const char *zSvcTypes[] = {
706 "Driver service",
707 "File system driver service",
708 "Service runs in its own process",
709 "Service shares a process with other services",
710 "Service can interact with the desktop"
711 };
712 const char *zSvcType = "";
713 static char *zSvcStartTypes[] = {
714 "Started by the system loader",
715 "Started by the IoInitSystem function",
716 "Started automatically by the service control manager",
717 "Started manually",
718 "Service cannot be started"
719 };
720 const char *zSvcStartType = "";
721 static const char *zSvcStates[] = {
722 "Stopped", "Starting", "Stopping", "Running",
723 "Continue pending", "Pause pending", "Paused"
724 };
725 const char *zSvcState = "";
726
727 verify_all_options();
728 if( g.argc==4 ){
729 zSvcName = g.argv[3];
730 }else if( g.argc>4 ){
731
--- src/winhttp.c
+++ src/winhttp.c
@@ -298,11 +298,11 @@
298 0,
299 NULL
300 );
301 }
302 if( nMsg ){
303 zMsg = fossil_unicode_to_utf8(tmp);
304 }else{
305 fossil_fatal("unable to get system error message.");
306 }
307 if( tmp ){
308 LocalFree((HLOCAL) tmp);
@@ -380,15 +380,11 @@
380 ){
381
382 /* Update the service information. */
383 hsData.isRunningAsService = 1;
384 if( argc>0 ){
 
385 hsData.zServiceName = fossil_unicode_to_utf8(argv[0]);
 
 
 
386 }
387
388 /* Register the service control handler function */
389 sshStatusHandle = RegisterServiceCtrlHandlerW(L"", win32_http_service_ctrl);
390 if( !sshStatusHandle ){
@@ -568,12 +564,12 @@
564 n = strlen(zMethod);
565
566 if( strncmp(zMethod, "create", n)==0 ){
567 SC_HANDLE hScm;
568 SC_HANDLE hSvc;
569 SERVICE_DESCRIPTIONW
570 svcDescr = {L"Fossil - Distributed Software Configuration Management"};
571 char *zErrFmt = "unable to create service '%s': %s";
572 DWORD dwStartType = SERVICE_DEMAND_START;
573 const char *zDisplay = find_option("display", "D", 1);
574 const char *zStart = find_option("start", "S", 1);
575 const char *zUsername = find_option("username", "U", 1);
@@ -696,35 +692,35 @@
692 if( strncmp(zMethod, "show", n)==0 ){
693 SC_HANDLE hScm;
694 SC_HANDLE hSvc;
695 SERVICE_STATUS sstat;
696 LPQUERY_SERVICE_CONFIGW pSvcConfig;
697 LPSERVICE_DESCRIPTIONW pSvcDescr;
698 BOOL bStatus;
699 DWORD nRequired;
700 static const char *zErrFmt = "unable to show service '%s': %s";
701 static const char *const zSvcTypes[] = {
702 "Driver service",
703 "File system driver service",
704 "Service runs in its own process",
705 "Service shares a process with other services",
706 "Service can interact with the desktop"
707 };
708 static const char *zSvcType = "";
709 static const char *zSvcStartTypes[] = {
710 "Started by the system loader",
711 "Started by the IoInitSystem function",
712 "Started automatically by the service control manager",
713 "Started manually",
714 "Service cannot be started"
715 };
716 static const char *zSvcStartType = "";
717 static const char *zSvcStates[] = {
718 "Stopped", "Starting", "Stopping", "Running",
719 "Continue pending", "Pause pending", "Paused"
720 };
721 static const char *zSvcState = "";
722
723 verify_all_options();
724 if( g.argc==4 ){
725 zSvcName = g.argv[3];
726 }else if( g.argc>4 ){
727

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button