* cmake/: don't install test applications and service files, moved CMAKE_DEBUG_POSTFI...
[platform/upstream/dbus.git] / dbus-win.patch
1 ? doc/Thumbs.db
2 Index: bus/config-loader-expat.c
3 ===================================================================
4 RCS file: /cvs/dbus/dbus/bus/config-loader-expat.c,v
5 retrieving revision 1.10
6 diff -u -r1.10 config-loader-expat.c
7 --- bus/config-loader-expat.c   10 Aug 2004 03:06:59 -0000      1.10
8 +++ bus/config-loader-expat.c   8 Mar 2007 20:25:42 -0000
9 @@ -161,6 +161,9 @@
10      }
11  }
12  
13 +#ifdef DBUS_WIN
14 +DBusString *_dbus_get_working_dir(void);
15 +#endif
16  
17  BusConfigParser*
18  bus_config_load (const DBusString      *file,
19 @@ -171,6 +174,9 @@
20    XML_Parser expat;
21    const char *filename;
22    BusConfigParser *parser;
23 +#ifdef DBUS_WIN
24 +  DBusString *dbusdir;
25 +#endif
26    ExpatParseContext context;
27    DBusString dirname;
28    
29 @@ -209,6 +215,12 @@
30        goto failed;
31      }
32    
33 +#ifdef DBUS_WIN
34 +  dbusdir = _dbus_get_working_dir();
35 +  if (dbusdir)
36 +     parser = bus_config_parser_new (dbusdir, is_toplevel, parent);
37 +  else  
38 +#endif
39    parser = bus_config_parser_new (&dirname, is_toplevel, parent);
40    if (parser == NULL)
41      {
42 Index: bus/config-loader-libxml.c
43 ===================================================================
44 RCS file: /cvs/dbus/dbus/bus/config-loader-libxml.c,v
45 retrieving revision 1.8
46 diff -u -r1.8 config-loader-libxml.c
47 --- bus/config-loader-libxml.c  10 Aug 2004 03:06:59 -0000      1.8
48 +++ bus/config-loader-libxml.c  8 Mar 2007 20:25:40 -0000
49 @@ -134,6 +134,9 @@
50      }
51  }
52  
53 +#ifdef DBUS_WIN
54 +  DBusString *_dbus_get_working_dir(void);
55 +#endif
56  
57  BusConfigParser*
58  bus_config_load (const DBusString      *file,
59 @@ -147,7 +150,9 @@
60    DBusString dirname, data;
61    DBusError tmp_error;
62    int ret;
63 -  
64 +#ifdef DBUS_WIN
65 +  DBusString *dbusdir;
66 +#endif
67    _DBUS_ASSERT_ERROR_IS_CLEAR (error);
68    
69    parser = NULL;
70 @@ -177,13 +182,19 @@
71        xmlSetGenericErrorFunc (NULL, xml_shut_up);
72      }
73  
74 +#ifdef DBUS_WIN
75 +  dbusdir = _dbus_get_working_dir();
76 +  if (dbusdir)
77 +     parser = bus_config_parser_new (dbusdir, is_toplevel, parent);
78 +  else  
79 +#endif
80    if (!_dbus_string_get_dirname (file, &dirname))
81      {
82        _DBUS_SET_OOM (error);
83        goto failed;
84      }
85 -  
86    parser = bus_config_parser_new (&dirname, is_toplevel, parent);
87 +  
88    if (parser == NULL)
89      {
90        _DBUS_SET_OOM (error);
91 Index: bus/config-parser.c
92 ===================================================================
93 RCS file: /cvs/dbus/dbus/bus/config-parser.c,v
94 retrieving revision 1.47
95 diff -u -r1.47 config-parser.c
96 --- bus/config-parser.c 26 Jan 2007 16:10:09 -0000      1.47
97 +++ bus/config-parser.c 8 Mar 2007 20:25:40 -0000
98 @@ -3070,10 +3071,15 @@
99  
100  static const char *test_service_dir_matches[] = 
101          {
102 +#ifdef DBUS_WIN
103 +         DBUS_DATADIR"/dbus-1/services",
104 +         NULL,
105 +#else
106           "/testusr/testlocal/testshare/dbus-1/services",
107           "/testusr/testshare/dbus-1/services",
108           DBUS_DATADIR"/dbus-1/services",
109           "/testhome/foo/.testlocal/testshare/dbus-1/services",         
110 +#endif 
111           NULL
112          };
113  
114 @@ -3082,11 +3088,32 @@
115  {
116    DBusList *dirs;
117    DBusList *link;
118 +  DBusString progs;
119 +  const char *common_progs;
120    int i;
121  
122 +  common_progs = _dbus_getenv ("CommonProgramFiles");
123 +  if (common_progs) 
124 +    {
125 +      if (!_dbus_string_init (&progs))
126 +        return FALSE;
127 +
128 +      if (!_dbus_string_append (&progs, common_progs)) 
129 +        {
130 +          _dbus_string_free (&progs);
131 +          return FALSE;
132 +        }
133 +
134 +      if (!_dbus_string_append (&progs, "/dbus-1/services")) 
135 +        {
136 +          _dbus_string_free (&progs);
137 +          return FALSE;
138 +        }
139 +      test_service_dir_matches[1] = _dbus_string_get_const_data(&progs);
140 +    }
141    dirs = NULL;
142  
143 -  printf ("Testing retriving the default session service directories\n");
144 +  printf ("Testing retrieving the default session service directories\n");
145    if (!_dbus_get_standard_session_servicedirs (&dirs))
146      _dbus_assert_not_reached ("couldn't get stardard dirs");
147  
148 @@ -3097,7 +3124,7 @@
149        
150        printf ("    default service dir: %s\n", (char *)link->data);
151        _dbus_string_init_const (&path, (char *)link->data);
152 -      if (!_dbus_string_ends_with_c_str (&path, "share/dbus-1/services"))
153 +      if (!_dbus_string_ends_with_c_str (&path, "dbus-1/services"))
154          {
155            printf ("error with default session service directories\n");
156            return FALSE;
157 @@ -3150,6 +3177,7 @@
158        return FALSE;
159      }
160      
161 +  _dbus_string_free (&progs);
162    return TRUE;
163  }
164                            
165 Index: bus/dispatch.c
166 ===================================================================
167 RCS file: /cvs/dbus/dbus/bus/dispatch.c,v
168 retrieving revision 1.79
169 diff -u -r1.79 dispatch.c
170 --- bus/dispatch.c      8 Mar 2007 08:30:17 -0000       1.79
171 +++ bus/dispatch.c      8 Mar 2007 20:25:42 -0000
172 @@ -34,7 +34,7 @@
173  #include "test.h"
174  #include <dbus/dbus-internals.h>
175  #include <string.h>
176 -
177 +
178  static dbus_bool_t
179  send_one_message (DBusConnection *connection,
180                    BusContext     *context,
181 @@ -428,6 +428,11 @@
182      }
183  }
184  
185 +#ifdef DBUS_WIN
186 +#include <tools/dbus-print-message.h>
187 +#include <tools/dbus-print-message.c>
188 +#endif
189 +
190  static void
191  spin_connection_until_authenticated (BusContext     *context,
192                                       DBusConnection *connection)
193 @@ -439,6 +444,19 @@
194        bus_test_run_bus_loop (context, FALSE);
195        bus_test_run_clients_loop (FALSE);
196      }
197 +#ifdef DBUS_WIN
198 +  if ( dbus_connection_get_dispatch_status(connection) != DBUS_DISPATCH_COMPLETE)
199 +    {
200 +      DBusMessage *message;
201 +         message = dbus_connection_pop_message (connection);
202 +         printf ("spin_connection_until_authenticated failed,\n");
203 +         printf ("because of a non dispatched message:\n");
204 +         print_message(message, FALSE);
205 +         printf ("\n");         
206 +         _dbus_assert_not_reached ("spin_connection_until_authenticated failed\n ");
207 +    }
208 +#endif
209 +
210    _dbus_verbose (" ... done spinning to auth connection %p\n", connection);
211  }
212  
213 @@ -2699,9 +2717,12 @@
214          }
215        else
216          {
217 +/* no DBUS_ERROR_NO_MEMORY on windows (no have_fork_errnum)*/
218 +#ifndef DBUS_WIN_FIXME
219            warn_unexpected (connection, message, "not this error");
220  
221            goto out;
222 +#endif
223          }
224      }
225    else
226 @@ -2812,7 +2833,7 @@
227    return retval;
228  }
229  #endif
230 -
231 +
232  #define TEST_ECHO_MESSAGE "Test echo message"
233  #define TEST_RUN_HELLO_FROM_SELF_MESSAGE "Test sending message to self"
234  
235 @@ -4064,29 +4085,36 @@
236        _dbus_assert_not_reached ("initial connection setup failed");
237      }
238    
239 +#ifdef DBUS_WIN_FIXME
240 +  _dbus_warn("TODO: dispatch.c create_and_hello test\n");
241 +#else
242    check1_try_iterations (context, "create_and_hello",
243                           check_hello_connection);
244 +#endif
245    
246    check2_try_iterations (context, foo, "nonexistent_service_no_auto_start",
247                           check_nonexistent_service_no_auto_start);
248  
249 -#ifdef DBUS_WIN_FIXME
250 +#ifdef DBUS_WIN_FIXME
251    _dbus_warn("TODO: dispatch.c segfault_service_no_auto_start test\n");
252  #else
253    check2_try_iterations (context, foo, "segfault_service_no_auto_start",
254                           check_segfault_service_no_auto_start);
255  #endif
256    
257 +#ifdef DBUS_WIN_FIXME
258 +  _dbus_warn("TODO: dispatch.c existent_service_no_auto_start\n");
259 +#else
260    check2_try_iterations (context, foo, "existent_service_no_auto_start",
261                           check_existent_service_no_auto_start);
262    
263    check2_try_iterations (context, foo, "nonexistent_service_auto_start",
264                           check_nonexistent_service_auto_start);
265 -  
266 +#endif
267  
268  #ifdef DBUS_WIN_FIXME    
269    _dbus_warn("TODO: dispatch.c segfault_service_auto_start test\n");
270 -#else
271 +#else
272    check2_try_iterations (context, foo, "segfault_service_auto_start",
273                           check_segfault_service_auto_start);
274  #endif
275 @@ -4106,8 +4134,12 @@
276    if (!check_existent_service_auto_start (context, foo))
277      _dbus_assert_not_reached ("existent service auto start failed");
278  
279 +#ifdef DBUS_WIN_FIXME  
280 +  _dbus_warn("TODO: dispatch.c check_shell_service_success_auto_start test\n");
281 +#else
282    if (!check_shell_service_success_auto_start (context, foo))
283      _dbus_assert_not_reached ("shell success service auto start failed");
284 +#endif
285  
286    _dbus_verbose ("Disconnecting foo, bar, and baz\n");
287  
288 @@ -4158,8 +4190,12 @@
289        _dbus_assert_not_reached ("initial connection setup failed");
290      }
291    
292 +#ifdef DBUS_WIN_FIXME  
293 +  _dbus_warn("TODO: dispatch.c: create_and_hello_sha1 test\n");
294 +#else
295    check1_try_iterations (context, "create_and_hello_sha1",
296                           check_hello_connection);
297 +#endif
298  
299    kill_client_connection_unchecked (foo);
300  
301 Index: bus/main.c
302 ===================================================================
303 RCS file: /cvs/dbus/dbus/bus/main.c,v
304 retrieving revision 1.36
305 diff -u -r1.36 main.c
306 --- bus/main.c  20 Dec 2006 06:18:19 -0000      1.36
307 +++ bus/main.c  8 Mar 2007 20:25:40 -0000
308 @@ -254,6 +254,12 @@
309    dbus_bool_t print_pid;
310    int force_fork;
311  
312 +#ifdef _WIN32
313 +       extern int _dbus_init_working_dir(char *s);
314 +       if (!_dbus_init_working_dir(argv[0]))
315 +               return 1;
316 +#endif
317 +
318    if (!_dbus_string_init (&config_file))
319      return 1;
320  
321 Index: bus/policy.c
322 ===================================================================
323 RCS file: /cvs/dbus/dbus/bus/policy.c,v
324 retrieving revision 1.24
325 diff -u -r1.24 policy.c
326 --- bus/policy.c        12 Dec 2006 21:24:07 -0000      1.24
327 +++ bus/policy.c        8 Mar 2007 20:25:40 -0000
328 @@ -324,9 +324,13 @@
329  
330    if (!dbus_connection_get_unix_user (connection, &uid))
331      {
332 +#ifdef DBUS_WIN
333 +               _dbus_verbose ("policy.c: dbus_connection_get_unix_user check disabled under windows\n");
334 +#else
335        dbus_set_error (error, DBUS_ERROR_FAILED,
336                        "No user ID known for connection, cannot determine security policy\n");
337        goto failed;
338 +#endif
339      }
340  
341    if (_dbus_hash_table_get_n_entries (policy->rules_by_uid) > 0)
342 Index: dbus/dbus-bus.c
343 ===================================================================
344 RCS file: /cvs/dbus/dbus/dbus/dbus-bus.c,v
345 retrieving revision 1.64
346 diff -u -r1.64 dbus-bus.c
347 --- dbus/dbus-bus.c     28 Oct 2006 01:41:37 -0000      1.64
348 +++ dbus/dbus-bus.c     8 Mar 2007 20:25:40 -0000
349 @@ -350,8 +350,10 @@
350  {
351    int i;
352    
353 +#if !defined(DBUS_WIN) && !defined(DBUS_WINCE)
354 +   // qt example pong says "QMutex::lock: Deadlock detected"
355    _DBUS_LOCK (bus);
356 -
357 +#endif
358    /* We are expecting to have the connection saved in only one of these
359     * slots, but someone could in a pathological case set system and session
360     * bus to the same bus or something. Or set one of them to the starter
361 @@ -366,7 +368,9 @@
362          }
363      }
364  
365 +#if !defined(DBUS_WIN) && !defined(DBUS_WINCE)
366    _DBUS_UNLOCK (bus);
367 +#endif
368  }
369  
370  static DBusConnection *
371 Index: dbus/dbus-connection.c
372 ===================================================================
373 RCS file: /cvs/dbus/dbus/dbus/dbus-connection.c,v
374 retrieving revision 1.154
375 diff -u -r1.154 dbus-connection.c
376 --- dbus/dbus-connection.c      15 Nov 2006 03:07:59 -0000      1.154
377 +++ dbus/dbus-connection.c      8 Mar 2007 20:25:37 -0000
378 @@ -4790,14 +4790,6 @@
379    _dbus_return_val_if_fail (connection != NULL, FALSE);
380    _dbus_return_val_if_fail (uid != NULL, FALSE);
381  
382 -#ifdef DBUS_WIN
383 -  /* FIXME this should be done at a lower level, but it's kind of hard,
384 -   * just want to be sure we don't ship with this API returning
385 -   * some weird internal fake uid for 1.0
386 -   */
387 -  return FALSE;
388 -#endif
389 -  
390    CONNECTION_LOCK (connection);
391  
392    if (!_dbus_transport_get_is_authenticated (connection->transport))
393 @@ -4829,14 +4821,6 @@
394    _dbus_return_val_if_fail (connection != NULL, FALSE);
395    _dbus_return_val_if_fail (pid != NULL, FALSE);
396  
397 -#ifdef DBUS_WIN
398 -  /* FIXME this should be done at a lower level, but it's kind of hard,
399 -   * just want to be sure we don't ship with this API returning
400 -   * some weird internal fake uid for 1.0
401 -   */
402 -  return FALSE;
403 -#endif
404 -  
405    CONNECTION_LOCK (connection);
406  
407    if (!_dbus_transport_get_is_authenticated (connection->transport))
408 Index: dbus/dbus-connection.h
409 ===================================================================
410 RCS file: /cvs/dbus/dbus/dbus/dbus-connection.h,v
411 retrieving revision 1.49
412 diff -u -r1.49 dbus-connection.h
413 --- dbus/dbus-connection.h      15 Nov 2006 03:07:59 -0000      1.49
414 +++ dbus/dbus-connection.h      8 Mar 2007 20:25:40 -0000
415 @@ -330,6 +330,9 @@
416   */
417  
418  int          dbus_watch_get_fd      (DBusWatch        *watch);
419 +#if defined (DBUS_COMPILATION)
420 +int          dbus_watch_get_handle  (DBusWatch        *watch);
421 +#endif
422  unsigned int dbus_watch_get_flags   (DBusWatch        *watch);
423  void*        dbus_watch_get_data    (DBusWatch        *watch);
424  void         dbus_watch_set_data    (DBusWatch        *watch,
425 Index: dbus/dbus-internals.c
426 ===================================================================
427 RCS file: /cvs/dbus/dbus/dbus/dbus-internals.c,v
428 retrieving revision 1.55
429 diff -u -r1.55 dbus-internals.c
430 --- dbus/dbus-internals.c       15 Nov 2006 01:52:01 -0000      1.55
431 +++ dbus/dbus-internals.c       8 Mar 2007 20:25:40 -0000
432 @@ -295,7 +295,7 @@
433  #include <pthread.h>
434  #endif
435  
436 -static inline void
437 +static void
438  _dbus_verbose_init (void)
439  {
440    if (!verbose_initted)
441 Index: dbus/dbus-mainloop.c
442 ===================================================================
443 RCS file: /cvs/dbus/dbus/dbus/dbus-mainloop.c,v
444 retrieving revision 1.19
445 diff -u -r1.19 dbus-mainloop.c
446 --- dbus/dbus-mainloop.c        20 Oct 2006 03:04:59 -0000      1.19
447 +++ dbus/dbus-mainloop.c        8 Mar 2007 20:25:40 -0000
448 @@ -90,8 +90,8 @@
449    Callback callback;
450    DBusTimeout *timeout;
451    DBusTimeoutFunction function;
452 -  unsigned long last_tv_sec;
453 -  unsigned long last_tv_usec;
454 +  long last_tv_sec;
455 +  long last_tv_usec;
456  } TimeoutCallback;
457  
458  #define WATCH_CALLBACK(callback)   ((WatchCallback*)callback)
459 @@ -598,7 +598,7 @@
460  
461  #if MAINLOOP_SPEW
462                _dbus_verbose ("  skipping watch on fd %d as it was out of memory last time\n",
463 -                             dbus_watch_get_fd (wcb->watch));
464 +                             dbus_watch_get_handle (wcb->watch));
465  #endif
466              }
467            else if (dbus_watch_get_enabled (wcb->watch))
468 @@ -609,7 +609,7 @@
469                    
470                flags = dbus_watch_get_flags (wcb->watch);
471                    
472 -              fds[n_fds].fd = dbus_watch_get_fd (wcb->watch);
473 +              fds[n_fds].fd = dbus_watch_get_handle (wcb->watch);
474                fds[n_fds].revents = 0;
475                fds[n_fds].events = 0;
476                if (flags & DBUS_WATCH_READABLE)
477 @@ -628,7 +628,7 @@
478              {
479  #if MAINLOOP_SPEW
480                _dbus_verbose ("  skipping disabled watch on fd %d  %s\n",
481 -                             dbus_watch_get_fd (wcb->watch),
482 +                             dbus_watch_get_handle (wcb->watch),
483                               watch_flags_to_string (dbus_watch_get_flags (wcb->watch)));
484  #endif
485              }
486 @@ -640,8 +640,8 @@
487    timeout = -1;
488    if (loop->timeout_count > 0)
489      {
490 -      unsigned long tv_sec;
491 -      unsigned long tv_usec;
492 +      long tv_sec;
493 +      long tv_usec;
494        
495        _dbus_get_current_time (&tv_sec, &tv_usec);
496            
497 @@ -710,8 +710,8 @@
498  
499    if (loop->timeout_count > 0)
500      {
501 -      unsigned long tv_sec;
502 -      unsigned long tv_usec;
503 +      long tv_sec;
504 +      long tv_usec;
505  
506        _dbus_get_current_time (&tv_sec, &tv_usec);
507  
508 @@ -883,6 +883,8 @@
509    
510    loop->depth -= 1;
511  
512 + _dbus_daemon_release ();
513 +
514    _dbus_verbose ("Quit main loop, depth %d -> %d\n",
515                   loop->depth + 1, loop->depth);
516  }
517 Index: dbus/dbus-server-socket.c
518 ===================================================================
519 RCS file: /cvs/dbus/dbus/dbus/dbus-server-socket.c,v
520 retrieving revision 1.3
521 diff -u -r1.3 dbus-server-socket.c
522 --- dbus/dbus-server-socket.c   1 Oct 2006 15:36:18 -0000       1.3
523 +++ dbus/dbus-server-socket.c   8 Mar 2007 20:25:40 -0000
524 @@ -161,7 +161,7 @@
525        int client_fd;
526        int listen_fd;
527        
528 -      listen_fd = dbus_watch_get_fd (watch);
529 +      listen_fd = dbus_watch_get_handle (watch);
530  
531        client_fd = _dbus_accept (listen_fd);
532        
533 Index: dbus/dbus-server.c
534 ===================================================================
535 RCS file: /cvs/dbus/dbus/dbus/dbus-server.c,v
536 retrieving revision 1.54
537 diff -u -r1.54 dbus-server.c
538 --- dbus/dbus-server.c  21 Oct 2006 23:09:18 -0000      1.54
539 +++ dbus/dbus-server.c  8 Mar 2007 20:25:40 -0000
540 @@ -509,8 +509,10 @@
541                                     DBusServer      **server_p,
542                                     DBusError        *error);
543  } listen_funcs[] = {
544 -  { _dbus_server_listen_socket },
545 -  { _dbus_server_listen_platform_specific }
546 +  { _dbus_server_listen_socket }
547 +#ifndef DBUS_WIN
548 +  , { _dbus_server_listen_platform_specific }
549 +#endif
550  #ifdef DBUS_BUILD_TESTS
551    , { _dbus_server_listen_debug_pipe }
552  #endif
553 @@ -1114,6 +1116,13 @@
554  dbus_bool_t
555  _dbus_server_test (void)
556  {
557 +#if defined(DBUS_WIN) || defined(DBUS_WINCE)
558 +  const char *valid_addresses[] = {
559 +    "tcp:port=1234",
560 +    "tcp:host=localhost,port=1234",
561 +    "tcp:host=localhost,port=1234;tcp:port=5678",
562 +  };
563 +#else
564    const char *valid_addresses[] = {
565      "tcp:port=1234",
566      "unix:path=./boogie",
567 @@ -1121,7 +1130,7 @@
568      "tcp:host=localhost,port=1234;tcp:port=5678",
569      "tcp:port=1234;unix:path=./boogie",
570    };
571 -
572 +#endif
573    DBusServer *server;
574    int i;
575    
576 Index: dbus/dbus-spawn.c
577 ===================================================================
578 RCS file: /cvs/dbus/dbus/dbus/dbus-spawn.c,v
579 retrieving revision 1.25
580 diff -u -r1.25 dbus-spawn.c
581 --- dbus/dbus-spawn.c   4 Mar 2007 19:14:03 -0000       1.25
582 +++ dbus/dbus-spawn.c   8 Mar 2007 20:25:40 -0000
583 @@ -720,7 +720,7 @@
584    if (condition & DBUS_WATCH_HANGUP)
585      revents |= _DBUS_POLLHUP;
586  
587 -  fd = dbus_watch_get_fd (watch);
588 +  fd = dbus_watch_get_handle (watch);
589  
590    if (fd == sitter->error_pipe_from_child)
591      handle_error_pipe (sitter, revents);
592 Index: dbus/dbus-sysdeps-util.c
593 ===================================================================
594 RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps-util.c,v
595 retrieving revision 1.10
596 diff -u -r1.10 dbus-sysdeps-util.c
597 --- dbus/dbus-sysdeps-util.c    13 Dec 2006 01:18:07 -0000      1.10
598 +++ dbus/dbus-sysdeps-util.c    8 Mar 2007 20:25:41 -0000
599 @@ -82,7 +82,7 @@
600    double val;
601    int pos;
602  
603 -#ifdef DBUS_WIN
604 +#if defined(DBUS_WIN) || defined(DBUS_WINCE)
605    check_dirname ("foo\\bar", "foo");
606    check_dirname ("foo\\\\bar", "foo");
607    check_dirname ("foo/\\/bar", "foo");
608 @@ -141,6 +141,7 @@
609        exit (1);
610      }
611  
612 +#ifndef DBUS_WIN_FIXME
613    _dbus_string_init_const (&str, "0xff");
614    if (!_dbus_string_parse_double (&str,
615                                   0, &val, &pos))
616 @@ -158,6 +159,8 @@
617        _dbus_warn ("_dbus_string_parse_double of \"0xff\" returned wrong position %d", pos);
618        exit (1);
619      }
620 +#endif
621 +
622  #ifdef DBUS_WIN
623    check_path_absolute ("c:/", TRUE);
624    check_path_absolute ("c:/foo", TRUE);
625 Index: dbus/dbus-sysdeps.c
626 ===================================================================
627 RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.c,v
628 retrieving revision 1.120
629 diff -u -r1.120 dbus-sysdeps.c
630 --- dbus/dbus-sysdeps.c 1 Jan 2007 21:29:59 -0000       1.120
631 +++ dbus/dbus-sysdeps.c 8 Mar 2007 20:25:41 -0000
632 @@ -119,11 +119,14 @@
633         * will get upset about.
634         */
635        
636 -      putenv_value = malloc (len + 1);
637 +      putenv_value = malloc (len + 2);
638        if (putenv_value == NULL)
639          return FALSE;
640  
641        strcpy (putenv_value, varname);
642 +#if defined(DBUS_WIN)
643 +      strcat (putenv_value, "=");
644 +#endif
645        
646        return (putenv (putenv_value) == 0);
647  #endif
648 @@ -413,6 +416,10 @@
649  ascii_strtod (const char *nptr,
650               char      **endptr)
651  {
652 +  /* FIXME: The Win32 C library's strtod() doesn't handle hex.
653 +   * Presumably many Unixes don't either.
654 +   */
655 +
656    char *fail_pos;
657    double val;
658    struct lconv *locale_data;
659 Index: dbus/dbus-sysdeps.h
660 ===================================================================
661 RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.h,v
662 retrieving revision 1.69
663 diff -u -r1.69 dbus-sysdeps.h
664 --- dbus/dbus-sysdeps.h 8 Mar 2007 20:25:15 -0000       1.69
665 +++ dbus/dbus-sysdeps.h 8 Mar 2007 20:25:41 -0000
666 @@ -119,6 +119,7 @@
667   * 
668   */
669  
670 +void        _dbus_daemon_release   (void);
671  dbus_bool_t _dbus_open_tcp_socket  (int              *fd,
672                                      DBusError        *error);
673  dbus_bool_t _dbus_close_socket     (int               fd,
674 Index: dbus/dbus-test.c
675 ===================================================================
676 RCS file: /cvs/dbus/dbus/dbus/dbus-test.c,v
677 retrieving revision 1.44
678 diff -u -r1.44 dbus-test.c
679 --- dbus/dbus-test.c    15 Nov 2006 03:07:59 -0000      1.44
680 +++ dbus/dbus-test.c    8 Mar 2007 20:25:41 -0000
681 @@ -156,7 +156,9 @@
682    
683    run_test ("hash", specific_test, _dbus_hash_test);
684  
685 +#if !defined(DBUS_WINCE)
686    run_data_test ("spawn", specific_test, _dbus_spawn_test, test_data_dir);
687 +#endif
688    
689    run_data_test ("userdb", specific_test, _dbus_userdb_test, test_data_dir);
690    
691 Index: dbus/dbus-threads.c
692 ===================================================================
693 RCS file: /cvs/dbus/dbus/dbus/dbus-threads.c,v
694 retrieving revision 1.36
695 diff -u -r1.36 dbus-threads.c
696 --- dbus/dbus-threads.c 28 Oct 2006 01:41:37 -0000      1.36
697 +++ dbus/dbus-threads.c 8 Mar 2007 20:25:41 -0000
698 @@ -810,7 +810,11 @@
699  dbus_bool_t
700  _dbus_threads_init_debug (void)
701  {
702 +#if defined(DBUS_WIN)
703 +  return _dbus_threads_init_platform_specific();
704 +#else
705    return dbus_threads_init (&fake_functions);
706 +#endif
707  }
708  
709  #endif /* DBUS_BUILD_TESTS */
710 Index: dbus/dbus-transport-socket.h
711 ===================================================================
712 RCS file: /cvs/dbus/dbus/dbus/dbus-transport-socket.h,v
713 retrieving revision 1.2
714 diff -u -r1.2 dbus-transport-socket.h
715 --- dbus/dbus-transport-socket.h        16 Sep 2006 19:24:08 -0000      1.2
716 +++ dbus/dbus-transport-socket.h        8 Mar 2007 20:25:42 -0000
717 @@ -25,6 +25,10 @@
718  
719  #include <dbus/dbus-transport-protected.h>
720  
721 +#if defined(DBUS_WIN)
722 +#include <dbus/dbus-sockets-win.h>
723 +#endif
724 +
725  DBUS_BEGIN_DECLS
726  
727  DBusTransport*          _dbus_transport_new_for_socket     (int                fd,
728 Index: dbus/dbus-transport.c
729 ===================================================================
730 RCS file: /cvs/dbus/dbus/dbus/dbus-transport.c,v
731 retrieving revision 1.54
732 diff -u -r1.54 dbus-transport.c
733 --- dbus/dbus-transport.c       17 Oct 2006 20:52:13 -0000      1.54
734 +++ dbus/dbus-transport.c       8 Mar 2007 20:25:42 -0000
735 @@ -310,9 +310,11 @@
736                                      DBusTransport   **transport_p,
737                                      DBusError        *error);
738  } open_funcs[] = {
739 -  { _dbus_transport_open_socket },
740 -  { _dbus_transport_open_platform_specific },
741 -  { _dbus_transport_open_autolaunch }
742 +  { _dbus_transport_open_socket }
743 +#ifndef DBUS_WIN
744 +  , { _dbus_transport_open_platform_specific }
745 +#endif
746 +  , { _dbus_transport_open_autolaunch }
747  #ifdef DBUS_BUILD_TESTS
748    , { _dbus_transport_open_debug_pipe }
749  #endif
750 @@ -674,7 +676,7 @@
751    if (transport->disconnected)
752      return TRUE;
753  
754 -  if (dbus_watch_get_fd (watch) < 0)
755 +  if (dbus_watch_get_handle (watch) < 0)
756      {
757        _dbus_warn_check_failed ("Tried to handle an invalidated watch; this watch should have been removed\n");
758        return TRUE;
759 Index: dbus/dbus-watch.c
760 ===================================================================
761 RCS file: /cvs/dbus/dbus/dbus/dbus-watch.c,v
762 retrieving revision 1.22
763 diff -u -r1.22 dbus-watch.c
764 --- dbus/dbus-watch.c   21 Oct 2006 21:57:31 -0000      1.22
765 +++ dbus/dbus-watch.c   8 Mar 2007 20:25:42 -0000
766 @@ -286,7 +286,7 @@
767              
768              _dbus_verbose ("Adding a %s watch on fd %d using newly-set add watch function\n",
769                             watch_type,
770 -                           dbus_watch_get_fd (link->data));
771 +                           dbus_watch_get_handle (link->data));
772            }
773  #endif /* DBUS_ENABLE_VERBOSE_MODE */
774            
775 @@ -302,7 +302,7 @@
776                                                               link2);
777                    
778                    _dbus_verbose ("Removing watch on fd %d using newly-set remove function because initial add failed\n",
779 -                                 dbus_watch_get_fd (link2->data));
780 +                                 dbus_watch_get_handle (link2->data));
781                    
782                    (* remove_function) (link2->data, data);
783                    
784 @@ -359,7 +359,7 @@
785    if (watch_list->add_watch_function != NULL)
786      {
787        _dbus_verbose ("Adding watch on fd %d\n",
788 -                     dbus_watch_get_fd (watch));
789 +                     dbus_watch_get_handle (watch));
790        
791        if (!(* watch_list->add_watch_function) (watch,
792                                                 watch_list->watch_data))
793 @@ -390,7 +390,7 @@
794    if (watch_list->remove_watch_function != NULL)
795      {
796        _dbus_verbose ("Removing watch on fd %d\n",
797 -                     dbus_watch_get_fd (watch));
798 +                     dbus_watch_get_handle (watch));
799        
800        (* watch_list->remove_watch_function) (watch,
801                                               watch_list->watch_data);
802 @@ -422,7 +422,7 @@
803    if (watch_list->watch_toggled_function != NULL)
804      {
805        _dbus_verbose ("Toggling watch %p on fd %d to %d\n",
806 -                     watch, dbus_watch_get_fd (watch), watch->enabled);
807 +                     watch, dbus_watch_get_handle (watch), watch->enabled);
808        
809        (* watch_list->watch_toggled_function) (watch,
810                                                watch_list->watch_data);
811 @@ -490,10 +490,32 @@
812   * @returns the file descriptor to watch.
813   */
814  int
815 +dbus_watch_get_handle (DBusWatch *watch)
816 +{
817 +  return watch->fd;
818 +}
819 +
820 +#if defined(DBUS_WIN)
821 +// never used by the dbus code
822 +#include "dbus-sysdeps-win.h"
823 +int 
824 +dbus_watch_get_fd (DBusWatch *watch)
825 +{
826 +       DBusSocket *p;
827 +       if (watch->fd != -1) {
828 +           _dbus_handle_to_socket(watch->fd,&p);
829 +           return p->fd;
830 +       }
831 +       else
832 +               return -1;
833 +}
834 +#else
835 +int
836  dbus_watch_get_fd (DBusWatch *watch)
837  {
838    return watch->fd;
839  }
840 +#endif
841  
842  /**
843   * Gets flags from DBusWatchFlags indicating
844 @@ -546,7 +568,7 @@
845                       DBusFreeFunction  free_data_function)
846  {
847    _dbus_verbose ("Setting watch fd %d data to data = %p function = %p from data = %p function = %p\n",
848 -                 dbus_watch_get_fd (watch),
849 +                 dbus_watch_get_handle (watch),
850                   data, free_data_function, watch->data, watch->free_data_function);
851    
852    if (watch->free_data_function != NULL)