@@ -52,46 +52,46 @@ static bool script_engine_create(proxy_execute_wsh_s *proxy_execute_wsh) {
5252
5353 HRESULT result = CLSIDFromProgID (L"JavaScript" , & lang_clsid );
5454 if (FAILED (result )) {
55- LOG_ERROR ("Failed to find JavaScript CLSID: (%08lx)\n " , result );
55+ log_error ("Failed to find JavaScript CLSID: (%08lx)" , result );
5656 return false;
5757 }
5858
5959 result = CoCreateInstance (& lang_clsid , NULL , CLSCTX_INPROC_SERVER , & IID_IActiveScript ,
6060 (void * * )& proxy_execute_wsh -> active_script );
6161 if (FAILED (result )) {
62- LOG_ERROR ("Failed to create active script instance (%08lx)\n " , result );
62+ log_error ("Failed to create active script instance (%08lx)" , result );
6363 return false;
6464 }
6565
6666 result = IActiveScript_QueryInterface (proxy_execute_wsh -> active_script , & IID_IActiveScriptParse ,
6767 (void * * )& proxy_execute_wsh -> active_script_parse );
6868 if (FAILED (result )) {
69- LOG_ERROR ("Failed to create active script parse instance (%08lx)\n " , result );
69+ log_error ("Failed to create active script parse instance (%08lx)" , result );
7070 return false;
7171 }
7272
7373 result = IActiveScript_SetScriptSite (proxy_execute_wsh -> active_script , & proxy_execute_wsh -> active_script_site .site );
7474 if (FAILED (result )) {
75- LOG_ERROR ("Failed to set script site for active script (%08lx)\n " , result );
75+ log_error ("Failed to set script site for active script (%08lx)" , result );
7676 return false;
7777 }
7878
7979 result = IActiveScriptParse_InitNew (proxy_execute_wsh -> active_script_parse );
8080 if (FAILED (result )) {
81- LOG_ERROR ("Failed to initialize active script parse (%08lx)\n " , result );
81+ log_error ("Failed to initialize active script parse (%08lx)" , result );
8282 return false;
8383 }
8484
8585 result = IActiveScript_AddNamedItem (proxy_execute_wsh -> active_script , WSH_SCRIPT_NAME ,
8686 SCRIPTITEM_GLOBALMEMBERS | SCRIPTITEM_ISVISIBLE );
8787 if (FAILED (result )) {
88- LOG_ERROR ("Failed to add named item to active script (%08lx)\n " , result );
88+ log_error ("Failed to add named item to active script (%08lx)" , result );
8989 return false;
9090 }
9191
9292 result = IActiveScript_SetScriptState (proxy_execute_wsh -> active_script , SCRIPTSTATE_STARTED );
9393 if (FAILED (result )) {
94- LOG_ERROR ("Failed to set script state to started (%08lx)\n " , result );
94+ log_error ("Failed to set script state to started (%08lx)" , result );
9595 return false;
9696 }
9797
@@ -114,7 +114,7 @@ static bool script_engine_parse_text(proxy_execute_wsh_s *proxy_execute_wsh, con
114114 SysFreeString (script_bstr );
115115
116116 if (FAILED (result )) {
117- LOG_ERROR ("Failed to parse script text (%08lx)\n " , result );
117+ log_error ("Failed to parse script text (%08lx)" , result );
118118 return false;
119119 }
120120
@@ -128,15 +128,15 @@ static bool script_engine_find_proxy_for_url(proxy_execute_wsh_s *proxy_execute_
128128
129129 HRESULT result = IActiveScript_GetScriptDispatch (proxy_execute_wsh -> active_script , NULL , & dispatch );
130130 if (FAILED (result )) {
131- LOG_ERROR ("Failed to get script dispatch (%08lx)\n " , result );
131+ log_error ("Failed to get script dispatch (%08lx)" , result );
132132 return false;
133133 }
134134
135135 // Get the id for the FindProxyForURL function to call
136136 LPOLESTR find_proxy_for_url = OLESTR ("FindProxyForURL" );
137137 result = IDispatch_GetIDsOfNames (dispatch , & IID_NULL , & find_proxy_for_url , 1 , LOCALE_NEUTRAL , & disp_id );
138138 if (FAILED (result )) {
139- LOG_ERROR ("Failed to get ID of names (%08lx)\n " , result );
139+ log_error ("Failed to get ID of names (%08lx)" , result );
140140 goto script_engine_execute_cleanup ;
141141 }
142142
@@ -158,14 +158,14 @@ static bool script_engine_find_proxy_for_url(proxy_execute_wsh_s *proxy_execute_
158158 // Create VARIANTARG for the host parameter
159159 char * host = get_url_host (url );
160160 if (!host ) {
161- LOG_ERROR ("Failed to get host from url\n " );
161+ log_error ("Failed to get host from url" );
162162 goto script_engine_execute_cleanup ;
163163 }
164164
165165 wchar_t * host_wchar = utf8_dup_to_wchar (host );
166166 free (host );
167167 if (!host_wchar ) {
168- LOG_ERROR ("Failed to convert host to wchar\n " );
168+ log_error ("Failed to convert host to wchar" );
169169 goto script_engine_execute_cleanup ;
170170 }
171171
@@ -181,13 +181,13 @@ static bool script_engine_find_proxy_for_url(proxy_execute_wsh_s *proxy_execute_
181181 result = IDispatch_Invoke (dispatch , disp_id , & IID_NULL , LOCALE_NEUTRAL , DISPATCH_METHOD , & params , & result_ptr , NULL ,
182182 NULL );
183183 if (FAILED (result )) {
184- LOG_ERROR ("Failed to invoke script (%08lx)\n " , result );
184+ log_error ("Failed to invoke script (%08lx)" , result );
185185 goto script_engine_execute_cleanup ;
186186 }
187187
188188 // Return the result of the FindProxyForURL function
189189 if (result_ptr .vt != VT_BSTR ) {
190- LOG_ERROR ("Invalid result type returned from script (%d)\n " , result_ptr .vt );
190+ log_error ("Invalid result type returned from script (%d)" , result_ptr .vt );
191191 goto script_engine_execute_cleanup ;
192192 }
193193
@@ -211,21 +211,21 @@ static bool script_engine_delete(proxy_execute_wsh_s *proxy_execute_wsh) {
211211 if (proxy_execute_wsh -> active_script ) {
212212 HRESULT result = IActiveScript_Close (proxy_execute_wsh -> active_script );
213213 if (FAILED (result )) {
214- LOG_ERROR ("Failed to close active script (%08lx)\n " , result );
214+ log_error ("Failed to close active script (%08lx)" , result );
215215 return false;
216216 }
217217 }
218218 if (proxy_execute_wsh -> active_script_parse ) {
219219 HRESULT result = IActiveScriptParse_Release (proxy_execute_wsh -> active_script_parse );
220220 if (FAILED (result )) {
221- LOG_ERROR ("Failed to release active script parse (%08lx)\n " , result );
221+ log_error ("Failed to release active script parse (%08lx)" , result );
222222 return false;
223223 }
224224 }
225225 if (proxy_execute_wsh -> active_script ) {
226226 HRESULT result = IActiveScript_Release (proxy_execute_wsh -> active_script );
227227 if (FAILED (result )) {
228- LOG_ERROR ("Failed to release active script (%08lx)\n " , result );
228+ log_error ("Failed to release active script (%08lx)" , result );
229229 return false;
230230 }
231231 }
@@ -245,17 +245,17 @@ bool proxy_execute_wsh_get_proxies_for_url(void *ctx, const char *script, const
245245 return false;
246246
247247 if (!script_engine_parse_text (proxy_execute_wsh , MOZILLA_PAC_JAVASCRIPT )) {
248- LOG_ERROR ("Failed to parse Mozilla PAC JavaScript\n " );
248+ log_error ("Failed to parse Mozilla PAC JavaScript" );
249249 goto execute_wsh_cleanup ;
250250 }
251251
252252 if (!script_engine_parse_text (proxy_execute_wsh , script )) {
253- LOG_ERROR ("Failed to parse PAC script\n " );
253+ log_error ("Failed to parse PAC script" );
254254 goto execute_wsh_cleanup ;
255255 }
256256
257257 if (!script_engine_find_proxy_for_url (proxy_execute_wsh , url )) {
258- LOG_ERROR ("Failed to execute script\n " );
258+ log_error ("Failed to execute script" );
259259 goto execute_wsh_cleanup ;
260260 }
261261
0 commit comments