Fossil SCM
make winhttp.c compilable without -DUNICODE
Commit
d0256a17beaa9be24875ff86a61201e7159eec78
Parent
f342247c50eb13a…
1 file changed
+10
-14
+10
-14
| --- src/winhttp.c | ||
| +++ src/winhttp.c | ||
| @@ -298,11 +298,11 @@ | ||
| 298 | 298 | 0, |
| 299 | 299 | NULL |
| 300 | 300 | ); |
| 301 | 301 | } |
| 302 | 302 | if( nMsg ){ |
| 303 | - zMsg = fossil_unicode_to_utf8(tmp); | |
| 303 | + zMsg = fossil_unicode_to_utf8(tmp); | |
| 304 | 304 | }else{ |
| 305 | 305 | fossil_fatal("unable to get system error message."); |
| 306 | 306 | } |
| 307 | 307 | if( tmp ){ |
| 308 | 308 | LocalFree((HLOCAL) tmp); |
| @@ -380,15 +380,11 @@ | ||
| 380 | 380 | ){ |
| 381 | 381 | |
| 382 | 382 | /* Update the service information. */ |
| 383 | 383 | hsData.isRunningAsService = 1; |
| 384 | 384 | if( argc>0 ){ |
| 385 | -#ifdef UNICODE | |
| 386 | 385 | hsData.zServiceName = fossil_unicode_to_utf8(argv[0]); |
| 387 | -#else | |
| 388 | - hsData.zServiceName = fossil_mbcs_to_utf8(argv[0]); | |
| 389 | -#endif | |
| 390 | 386 | } |
| 391 | 387 | |
| 392 | 388 | /* Register the service control handler function */ |
| 393 | 389 | sshStatusHandle = RegisterServiceCtrlHandlerW(L"", win32_http_service_ctrl); |
| 394 | 390 | if( !sshStatusHandle ){ |
| @@ -568,12 +564,12 @@ | ||
| 568 | 564 | n = strlen(zMethod); |
| 569 | 565 | |
| 570 | 566 | if( strncmp(zMethod, "create", n)==0 ){ |
| 571 | 567 | SC_HANDLE hScm; |
| 572 | 568 | 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"}; | |
| 575 | 571 | char *zErrFmt = "unable to create service '%s': %s"; |
| 576 | 572 | DWORD dwStartType = SERVICE_DEMAND_START; |
| 577 | 573 | const char *zDisplay = find_option("display", "D", 1); |
| 578 | 574 | const char *zStart = find_option("start", "S", 1); |
| 579 | 575 | const char *zUsername = find_option("username", "U", 1); |
| @@ -696,35 +692,35 @@ | ||
| 696 | 692 | if( strncmp(zMethod, "show", n)==0 ){ |
| 697 | 693 | SC_HANDLE hScm; |
| 698 | 694 | SC_HANDLE hSvc; |
| 699 | 695 | SERVICE_STATUS sstat; |
| 700 | 696 | LPQUERY_SERVICE_CONFIGW pSvcConfig; |
| 701 | - LPSERVICE_DESCRIPTION pSvcDescr; | |
| 697 | + LPSERVICE_DESCRIPTIONW pSvcDescr; | |
| 702 | 698 | BOOL bStatus; |
| 703 | 699 | 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[] = { | |
| 706 | 702 | "Driver service", |
| 707 | 703 | "File system driver service", |
| 708 | 704 | "Service runs in its own process", |
| 709 | 705 | "Service shares a process with other services", |
| 710 | 706 | "Service can interact with the desktop" |
| 711 | 707 | }; |
| 712 | - const char *zSvcType = ""; | |
| 713 | - static char *zSvcStartTypes[] = { | |
| 708 | + static const char *zSvcType = ""; | |
| 709 | + static const char *zSvcStartTypes[] = { | |
| 714 | 710 | "Started by the system loader", |
| 715 | 711 | "Started by the IoInitSystem function", |
| 716 | 712 | "Started automatically by the service control manager", |
| 717 | 713 | "Started manually", |
| 718 | 714 | "Service cannot be started" |
| 719 | 715 | }; |
| 720 | - const char *zSvcStartType = ""; | |
| 716 | + static const char *zSvcStartType = ""; | |
| 721 | 717 | static const char *zSvcStates[] = { |
| 722 | 718 | "Stopped", "Starting", "Stopping", "Running", |
| 723 | 719 | "Continue pending", "Pause pending", "Paused" |
| 724 | 720 | }; |
| 725 | - const char *zSvcState = ""; | |
| 721 | + static const char *zSvcState = ""; | |
| 726 | 722 | |
| 727 | 723 | verify_all_options(); |
| 728 | 724 | if( g.argc==4 ){ |
| 729 | 725 | zSvcName = g.argv[3]; |
| 730 | 726 | }else if( g.argc>4 ){ |
| 731 | 727 |
| --- 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 |