Home | History | Annotate | Download | only in libjingle
      1 Only in libjingle-0.4.0: Makefile.in
      2 diff -r libjingle-0.4.0/README libjingle/files/README
      3 1,39c1,39
      4 < Libjingle
      5 < 
      6 < Libjingle is a set of components provided by Google to interoperate with Google
      7 < Talk's peer-to-peer and voice capabilities. This package will create several
      8 < static libraries you may link to your project as needed.
      9 < 
     10 < -talk               - No source files in talk/, just these subdirectories
     11 < |-base              - Contains basic low-level portable utility functions for 
     12 < |                     things like threads and sockets
     13 < |-p2p               - The P2P stack
     14 <   |-base            - Base p2p functionality
     15 <   |-client          - Hooks to tie it into XMPP
     16 < |-session           - Signaling
     17 <   |-phone           - Signaling code specific to making phone calls
     18 < |-third_party       - Components that aren't ours
     19 <   |-mediastreamer   - Media components for dealing with sound hardware and 
     20 <   |                   voice codecs
     21 < |-xmllite           - XML parser
     22 < |-xmpp              - XMPP engine
     23 < 
     24 < In addition, this package contains two examples in talk/examples which 
     25 < illustrate the basic concepts of how the provided classes work.
     26 < 
     27 < The xmllite component of libjingle depends on expat. You can download expat 
     28 < from http://expat.sourceforge.net/.
     29 < 
     30 < mediastreamer, the media components used by the example applications depend on
     31 < the oRTP and iLBC components from linphone, which can be found at 
     32 < http://www.linphone.org. Linphone, in turn depends on GLib, which can be found
     33 < at http://www.gtk.org. This GLib dependency should be removed in future 
     34 < releases.
     35 < 
     36 < Building Libjingle
     37 < 
     38 < Once the dependencies are installed, run ./configure. ./configure will return
     39 < an error if it failed to locate the proper dependencies. If ./configure
     40 < succeeds, run 'make' to build the components and examples.
     41 < 
     42 < When the build is complete, you can run the call example from 
     43 ---
     44 > Libjingle
     45 > 
     46 > Libjingle is a set of components provided by Google to interoperate with Google
     47 > Talk's peer-to-peer and voice capabilities. This package will create several
     48 > static libraries you may link to your project as needed.
     49 > 
     50 > -talk               - No source files in talk/, just these subdirectories
     51 > |-base              - Contains basic low-level portable utility functions for 
     52 > |                     things like threads and sockets
     53 > |-p2p               - The P2P stack
     54 >   |-base            - Base p2p functionality
     55 >   |-client          - Hooks to tie it into XMPP
     56 > |-session           - Signaling
     57 >   |-phone           - Signaling code specific to making phone calls
     58 > |-third_party       - Components that aren't ours
     59 >   |-mediastreamer   - Media components for dealing with sound hardware and 
     60 >   |                   voice codecs
     61 > |-xmllite           - XML parser
     62 > |-xmpp              - XMPP engine
     63 > 
     64 > In addition, this package contains two examples in talk/examples which 
     65 > illustrate the basic concepts of how the provided classes work.
     66 > 
     67 > The xmllite component of libjingle depends on expat. You can download expat 
     68 > from http://expat.sourceforge.net/.
     69 > 
     70 > mediastreamer, the media components used by the example applications depend on
     71 > the oRTP and iLBC components from linphone, which can be found at 
     72 > http://www.linphone.org. Linphone, in turn depends on GLib, which can be found
     73 > at http://www.gtk.org. This GLib dependency should be removed in future 
     74 > releases.
     75 > 
     76 > Building Libjingle
     77 > 
     78 > Once the dependencies are installed, run ./configure. ./configure will return
     79 > an error if it failed to locate the proper dependencies. If ./configure
     80 > succeeds, run 'make' to build the components and examples.
     81 > 
     82 > When the build is complete, you can run the call example from 
     83 41,57c41,57
     84 < 
     85 < Relay Server
     86 < 
     87 < Libjingle will also build a relay server that may be used to relay traffic
     88 < when a direct peer-to-peer connection could not be established. The relay
     89 < server will build in talk/p2p/base/relayserver and will listen on UDP
     90 < ports 5000 and 5001. See the Libjingle Developer Guide at 
     91 < http://code.google.com/apis/talk/index.html for information about configuring
     92 < a client to use this relay server.
     93 < 
     94 < STUN Server
     95 < 
     96 < Lastly, Libjingle builds a STUN server which implements the STUN protocol for
     97 < Simple Traversal of UDP over NAT. The STUN server is built as
     98 < talk/p2p/base/stunserver and listens on UDP port 7000. See the Libjingle
     99 < Developer Guide at http://code.google.com/apis/talk/index.html for information
    100 < about configuring a client to use this STUN server.
    101 ---
    102 > 
    103 > Relay Server
    104 > 
    105 > Libjingle will also build a relay server that may be used to relay traffic
    106 > when a direct peer-to-peer connection could not be established. The relay
    107 > server will build in talk/p2p/base/relayserver and will listen on UDP
    108 > ports 5000 and 5001. See the Libjingle Developer Guide at 
    109 > http://code.google.com/apis/talk/index.html for information about configuring
    110 > a client to use this relay server.
    111 > 
    112 > STUN Server
    113 > 
    114 > Lastly, Libjingle builds a STUN server which implements the STUN protocol for
    115 > Simple Traversal of UDP over NAT. The STUN server is built as
    116 > talk/p2p/base/stunserver and listens on UDP port 7000. See the Libjingle
    117 > Developer Guide at http://code.google.com/apis/talk/index.html for information
    118 > about configuring a client to use this STUN server.
    119 diff -r libjingle-0.4.0/README.win libjingle/files/README.win
    120 1,24c1,24
    121 < 1. Install Visual C++ Express 2005.  It is free from this link:
    122 <    http://msdn.microsoft.com/vstudio/express/visualc/
    123 < 
    124 < 2. Install the platform SDK and integrate it into VC++ express
    125 <    http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
    126 < 
    127 < 3. Download and install binary package for expat:
    128 <    http://sourceforge.net/project/showfiles.php?group_id=10127&package_id=11277
    129 < 
    130 < 4. Update the Visual C++ directories in the Projects and Solutions section in the Options dialog box
    131 <    Library files: C:\expat-VERSION\StaticLibs
    132 <    Include files: C:\expat-VERSION\Source\Lib
    133 <    where VERSION is the version of expat you've downoaded
    134 < 
    135 < 5. Unzip the libjingle files and open the solution.
    136 < 
    137 < 6. If you wish to build the call example with GIPS Voice Engine Lite, download Voice Engine Lite from http://developer.globalipsound.com
    138 < 
    139 < 7. Extract the Interface and Library directories from the Voice Engine Lite zip file into talk\third_party\gips
    140 < 
    141 < 8. Open talk\third_party\gips\expiration.h and set the GIPS_EXPIRATION #defines to the expiration date provided by GIPS and remove the #error directive
    142 < 
    143 < 9. Build the solution
    144 < 
    145 ---
    146 > 1. Install Visual C++ Express 2005.  It is free from this link:
    147 >    http://msdn.microsoft.com/vstudio/express/visualc/
    148 > 
    149 > 2. Install the platform SDK and integrate it into VC++ express
    150 >    http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
    151 > 
    152 > 3. Download and install binary package for expat:
    153 >    http://sourceforge.net/project/showfiles.php?group_id=10127&package_id=11277
    154 > 
    155 > 4. Update the Visual C++ directories in the Projects and Solutions section in the Options dialog box
    156 >    Library files: C:\expat-VERSION\StaticLibs
    157 >    Include files: C:\expat-VERSION\Source\Lib
    158 >    where VERSION is the version of expat you've downoaded
    159 > 
    160 > 5. Unzip the libjingle files and open the solution.
    161 > 
    162 > 6. If you wish to build the call example with GIPS Voice Engine Lite, download Voice Engine Lite from http://developer.globalipsound.com
    163 > 
    164 > 7. Extract the Interface and Library directories from the Voice Engine Lite zip file into talk\third_party\gips
    165 > 
    166 > 8. Open talk\third_party\gips\expiration.h and set the GIPS_EXPIRATION #defines to the expiration date provided by GIPS and remove the #error directive
    167 > 
    168 > 9. Build the solution
    169 > 
    170 Only in libjingle-0.4.0: aclocal.m4
    171 Only in libjingle-0.4.0: config.guess
    172 diff -r libjingle-0.4.0/config.h libjingle/files/config.h
    173 14c14
    174 < #define HAVE_ALSA_ASOUNDLIB_H 1
    175 ---
    176 > /* #undef HAVE_ALSA_ASOUNDLIB_H */
    177 23c23
    178 < #define HAVE_GLIB 1
    179 ---
    180 > /* #undef HAVE_GLIB */
    181 38c38
    182 < #define HAVE_ORTP 1
    183 ---
    184 > /* #undef HAVE_ORTP */
    185 41c41
    186 < #define HAVE_SPEEX 1
    187 ---
    188 > /* #undef HAVE_SPEEX */
    189 47c47
    190 < #define HAVE_SPEEX_SPEEX_H 1
    191 ---
    192 > /* #undef HAVE_SPEEX_SPEEX_H */
    193 71c71
    194 < #define LINUX 1
    195 ---
    196 > /* #undef LINUX */
    197 113c113
    198 < #define __ALSA_ENABLED__ 1
    199 ---
    200 > /* #undef __ALSA_ENABLED__ */
    201 Only in libjingle-0.4.0: config.h.in
    202 Only in libjingle-0.4.0: config.sub
    203 Only in libjingle-0.4.0: configure
    204 Only in libjingle-0.4.0: depcomp
    205 Only in libjingle-0.4.0: install-sh
    206 Only in libjingle-0.4.0: ltmain.sh
    207 Only in libjingle-0.4.0: missing
    208 Only in libjingle-0.4.0/talk: Makefile.in
    209 Only in libjingle-0.4.0/talk/base: Makefile.in
    210 diff -r libjingle-0.4.0/talk/base/asynchttprequest.cc libjingle/files/talk/base/asynchttprequest.cc
    211 73c73
    212 <     talk_base::SSLAdapter * ssl_adapter = talk_base::SSLAdapter::Create(socket);
    213 ---
    214 >     talk_base::SSLAdapter * ssl_adapter = factory_->CreateSSLAdapter(socket);
    215 75c75,81
    216 <     ssl_adapter->StartSSL(hostname_.c_str(), true);
    217 ---
    218 >     int error = ssl_adapter->StartSSL(hostname_.c_str(),
    219 >                                       use_restartable_ssl_sockets_);
    220 >     if (error != 0) {
    221 >       LOG(LS_WARNING) << "Could not start SSL; error = " << error;
    222 >       delete ssl_adapter;
    223 >       return 0;
    224 >     }
    225 diff -r libjingle-0.4.0/talk/base/asynchttprequest.h libjingle/files/talk/base/asynchttprequest.h
    226 23,24c23
    227 <   public SignalThread,
    228 <   public sigslot::has_slots<> {
    229 ---
    230 >   public SignalThread {
    231 106c105,106
    232 <       binary_mode_(false), agent_(user_agent) { }
    233 ---
    234 >       binary_mode_(false), agent_(user_agent),
    235 >       ignore_bad_cert_(false), use_restartable_ssl_sockets_(false) { }
    236 114a115,120
    237 >   bool use_restartable_ssl_sockets() const {
    238 >     return use_restartable_ssl_sockets_;
    239 >   }
    240 >   void SetUseRestartableSSLSockets(bool use_restartable_ssl_sockets) {
    241 >     use_restartable_ssl_sockets_ = use_restartable_ssl_sockets;
    242 >   }
    243 133a140
    244 >   bool use_restartable_ssl_sockets_;
    245 diff -r libjingle-0.4.0/talk/base/asynctcpsocket.cc libjingle/files/talk/base/asynctcpsocket.cc
    246 31a32,33
    247 > #include <cstring>
    248 > 
    249 diff -r libjingle-0.4.0/talk/base/autodetectproxy.cc libjingle/files/talk/base/autodetectproxy.cc
    250 29c29
    251 < #include "talk/base/httpcommon.h"
    252 ---
    253 > #include "talk/base/httpcommon-inl.h"
    254 114c114
    255 <   Thread::Current()->MessageQueue::Stop();
    256 ---
    257 >   Thread::Current()->Quit();
    258 diff -r libjingle-0.4.0/talk/base/autodetectproxy.h libjingle/files/talk/base/autodetectproxy.h
    259 22c22
    260 < class AutoDetectProxy : public SignalThread, public sigslot::has_slots<> {
    261 ---
    262 > class AutoDetectProxy : public SignalThread {
    263 diff -r libjingle-0.4.0/talk/base/base64.h libjingle/files/talk/base/base64.h
    264 26,27c26,27
    265 <   static const std::string Base64::Base64Table;
    266 <   static const std::string::size_type Base64::DecodeTable[];
    267 ---
    268 >   static const std::string Base64Table;
    269 >   static const std::string::size_type DecodeTable[];
    270 diff -r libjingle-0.4.0/talk/base/common.h libjingle/files/talk/base/common.h
    271 54c54
    272 < #define stdmax(x,y) max(x,y)
    273 ---
    274 > #define stdmax(x,y) _max(x,y)
    275 114,119d113
    276 < // A macro to disallow the evil copy constructor and operator= functions
    277 < // This should be used in the private: declarations for a class
    278 < #define DISALLOW_EVIL_CONSTRUCTORS(TypeName)    \
    279 <   TypeName(const TypeName&);                    \
    280 <   void operator=(const TypeName&)
    281 < 
    282 diff -r libjingle-0.4.0/talk/base/criticalsection.h libjingle/files/talk/base/criticalsection.h
    283 39c39
    284 < #ifdef _DEBUG
    285 ---
    286 > #if !defined(NDEBUG)
    287 41c41
    288 < #endif  // _DEBUG
    289 ---
    290 > #endif  // !defined(NDEBUG)
    291 83c83
    292 < public:
    293 ---
    294 >  public:
    295 85a86
    296 >     pthread_mutexattr_init(&mutex_attribute);
    297 87a89,90
    298 >     pthread_mutexattr_destroy(&mutex_attribute);
    299 >     TRACK_OWNER(thread_ = 0);
    300 93a97
    301 >     TRACK_OWNER(thread_ = pthread_self());
    302 95a100
    303 >     TRACK_OWNER(thread_ = 0);
    304 98c103,110
    305 < private:
    306 ---
    307 > 
    308 > #if CS_TRACK_OWNER
    309 >   bool CurrentThreadIsOwner() const {
    310 >     return pthread_equal(thread_, pthread_self());
    311 >   }
    312 > #endif  // CS_TRACK_OWNER
    313 > 
    314 >  private:
    315 99a112
    316 >   TRACK_OWNER(pthread_t thread_);
    317 diff -r libjingle-0.4.0/talk/base/cryptstring.h libjingle/files/talk/base/cryptstring.h
    318 30a31
    319 > #include <string.h>
    320 diff -r libjingle-0.4.0/talk/base/diskcache.cc libjingle/files/talk/base/diskcache.cc
    321 43c43
    322 < #ifdef _DEBUG
    323 ---
    324 > #if !defined(NDEBUG)
    325 45c45
    326 < #else  // !_DEBUG
    327 ---
    328 > #else  // defined(NDEBUG)
    329 47c47
    330 < #endif  // !_DEBUG
    331 ---
    332 > #endif  // !defined(NDEBUG)
    333 231c231
    334 < #ifdef _DEBUG
    335 ---
    336 > #if !defined(NDEBUG)
    337 238c238
    338 < #endif  // _DEBUG
    339 ---
    340 > #endif  // !defined(NDEBUG)
    341 diff -r libjingle-0.4.0/talk/base/diskcache_win32.cc libjingle/files/talk/base/diskcache_win32.cc
    342 38c38
    343 <       entry->streams = max(entry->streams, index + 1);
    344 ---
    345 >       entry->streams = _max(entry->streams, index + 1);
    346 diff -r libjingle-0.4.0/talk/base/helpers.cc libjingle/files/talk/base/helpers.cc
    347 38a39
    348 > #include <wincrypt.h>
    349 diff -r libjingle-0.4.0/talk/base/host.cc libjingle/files/talk/base/host.cc
    350 30a31
    351 > #include <cstdlib>
    352 diff -r libjingle-0.4.0/talk/base/httpclient.cc libjingle/files/talk/base/httpclient.cc
    353 670a671
    354 >         HttpAuthContext *context = context_.get();
    355 676c677,678
    356 <           *context_.use(), response, auth_method);
    357 ---
    358 >           context, response, auth_method);
    359 >         context_.reset(context);
    360 diff -r libjingle-0.4.0/talk/base/httpcommon.h libjingle/files/talk/base/httpcommon.h
    361 172c172
    362 < inline const uint16 UrlDefaultPort(bool secure) {
    363 ---
    364 > inline uint16 UrlDefaultPort(bool secure) {
    365 diff -r libjingle-0.4.0/talk/base/logging.cc libjingle/files/talk/base/logging.cc
    366 27a28
    367 > #include <stdio.h>
    368 76c77
    369 < #if _DEBUG
    370 ---
    371 > #if LOGGING
    372 78c79
    373 < #else  // !_DEBUG
    374 ---
    375 > #else
    376 80c81
    377 < #endif  // !_DEBUG
    378 ---
    379 > #endif
    380 diff -r libjingle-0.4.0/talk/base/logging.h libjingle/files/talk/base/logging.h
    381 67a68,69
    382 > 
    383 > #if defined(SAFE_TO_DEFINE_TALK_BASE_LOGGING_MACROS)
    384 70a73
    385 > #endif // defined(SAFE_TO_DEFINE_TALK_BASE_LOGGING_MACROS)
    386 195a199
    387 > #if defined(SAFE_TO_DEFINE_TALK_BASE_LOGGING_MACROS)
    388 197c201
    389 < #if defined(_DEBUG) && !defined(NDEBUG)
    390 ---
    391 > #if !defined(NDEBUG)
    392 290a295
    393 > #endif  // defined(SAFE_TO_DEFINE_TALK_BASE_LOGGING_MACROS)
    394 diff -r libjingle-0.4.0/talk/base/messagequeue.cc libjingle/files/talk/base/messagequeue.cc
    395 98,99c98,99
    396 <     new_ss = true;
    397 <     ss_ = new PhysicalSocketServer();
    398 ---
    399 >     default_ss_.reset(new PhysicalSocketServer());
    400 >     ss_ = default_ss_.get();
    401 103a104,107
    402 >   // The signal is done from here to ensure
    403 >   // that it always gets called when the queue
    404 >   // is going away.
    405 >   SignalQueueDestroyed();
    406 108,109d111
    407 <   if (new_ss)
    408 <     delete ss_;
    409 113,115d114
    410 <   if (new_ss)
    411 <     delete ss_;
    412 <   new_ss = false;
    413 119c118
    414 < void MessageQueue::Stop() {
    415 ---
    416 > void MessageQueue::Quit() {
    417 124c123
    418 < bool MessageQueue::IsStopping() {
    419 ---
    420 > bool MessageQueue::IsQuitting() {
    421 diff -r libjingle-0.4.0/talk/base/messagequeue.h libjingle/files/talk/base/messagequeue.h
    422 35a36
    423 > #include "talk/base/scoped_ptr.h"
    424 162,164c163,164
    425 < 
    426 <   virtual void Stop();
    427 <   virtual bool IsStopping();
    428 ---
    429 >   virtual void Quit();
    430 >   virtual bool IsQuitting();
    431 188a189,192
    432 >   // When this signal is sent out, any references to this queue should
    433 >   // no longer be used.
    434 >   sigslot::signal0<> SignalQueueDestroyed;
    435 > 
    436 192a197,198
    437 >   // If a server isn't supplied in the constructor, use this one.
    438 >   scoped_ptr<SocketServer> default_ss_;
    439 diff -r libjingle-0.4.0/talk/base/natserver.cc libjingle/files/talk/base/natserver.cc
    440 28a29
    441 > #include <cstring>
    442 diff -r libjingle-0.4.0/talk/base/natsocketfactory.cc libjingle/files/talk/base/natsocketfactory.cc
    443 29a30
    444 > #include <cstring>
    445 diff -r libjingle-0.4.0/talk/base/openssladapter.cc libjingle/files/talk/base/openssladapter.cc
    446 619c619
    447 < #ifdef _DEBUG
    448 ---
    449 > #if !defined(NDEBUG)
    450 707c707
    451 < #if _DEBUG
    452 ---
    453 > #if !defined(NDEBUG)
    454 736c736
    455 < #endif  // _DEBUG
    456 ---
    457 > #endif  // !defined(NDEBUG)
    458 740c740
    459 < #if _DEBUG
    460 ---
    461 > #if !defined(NDEBUG)
    462 798c798
    463 < #ifdef _DEBUG
    464 ---
    465 > #if !defined(NDEBUG)
    466 diff -r libjingle-0.4.0/talk/base/openssladapter.h libjingle/files/talk/base/openssladapter.h
    467 72c72
    468 < #if _DEBUG
    469 ---
    470 > #if !defined(NDEBUG)
    471 74c74
    472 < #endif  // !_DEBUG
    473 ---
    474 > #endif  // !defined(NDEBUG)
    475 diff -r libjingle-0.4.0/talk/base/physicalsocketserver.cc libjingle/files/talk/base/physicalsocketserver.cc
    476 61a62
    477 > #include "talk/base/winsock_initializer.h"
    478 67,86d67
    479 < #ifdef WIN32
    480 < class WinsockInitializer {
    481 < public:
    482 <   WinsockInitializer() {
    483 <     WSADATA wsaData;
    484 <     WORD wVersionRequested = MAKEWORD(1, 0);
    485 <     err_ = WSAStartup(wVersionRequested, &wsaData);
    486 <   }
    487 <   ~WinsockInitializer() {
    488 <     WSACleanup();
    489 <   }
    490 <   int error() {
    491 <     return err_;
    492 <   }
    493 < private:
    494 <   int err_;
    495 < };
    496 < WinsockInitializer g_winsockinit;
    497 < #endif
    498 < 
    499 124a106,108
    500 > #ifdef WIN32
    501 >     EnsureWinsockInit();
    502 > #endif
    503 187c171,177
    504 <       addr2.Resolve(); // TODO: Do this async later?
    505 ---
    506 >       // TODO: Do this async later?
    507 >       if (!addr2.Resolve()) {
    508 >         LOG(LS_ERROR) << "Resolving addr failed";
    509 >         UpdateLastError();
    510 >         Close();
    511 >         return SOCKET_ERROR;
    512 >       }
    513 265a256,259
    514 >       LOG(LS_WARNING) << "EOF from socket; deferring close event";
    515 >       // Must turn this back on so that the select() loop will notice the close
    516 >       // event.
    517 >       enabled_events_ |= kfRead;
    518 402a397
    519 >   virtual bool IsDescriptorClosed() = 0;
    520 452a448,451
    521 >   virtual bool IsDescriptorClosed() {
    522 >     return false;
    523 >   }
    524 > 
    525 490a490,497
    526 >   virtual bool IsDescriptorClosed() {
    527 >     // We don't have a reliable way of distinguishing end-of-stream
    528 >     // from readability.  So test on each readable call.  Is this
    529 >     // inefficient?  Probably.
    530 >     char ch;
    531 >     return (0 == ::recv(s_, &ch, 1, MSG_PEEK));
    532 >   }
    533 > 
    534 546a554,557
    535 >   virtual bool IsDescriptorClosed() {
    536 >     return false;
    537 >   }
    538 > 
    539 916c927,931
    540 <           ff |= kfRead;
    541 ---
    542 >           if (pdispatcher->IsDescriptorClosed()) {
    543 >             ff |= kfClose;
    544 >           } else {
    545 >             ff |= kfRead;
    546 >           }
    547 diff -r libjingle-0.4.0/talk/base/proxydetect.cc libjingle/files/talk/base/proxydetect.cc
    548 205,206c205,206
    549 <   const char* list = slist.c_str();
    550 <   while (*list) {
    551 ---
    552 >   const char* clist = slist.c_str();
    553 >   while (*clist) {
    554 208,209c208,209
    555 <     if (isspace(*list)) {
    556 <       ++list;
    557 ---
    558 >     if (isspace(*clist)) {
    559 >       ++clist;
    560 214,217c214,217
    561 <     const char * start = list;
    562 <     if (const char * end = strchr(list, sep)) {
    563 <       len = (end - list);
    564 <       list += len + 1;
    565 ---
    566 >     const char * start = clist;
    567 >     if (const char * end = strchr(clist, sep)) {
    568 >       len = (end - clist);
    569 >       clist += len + 1;
    570 219,220c219,220
    571 <       len = strlen(list);
    572 <       list += len;
    573 ---
    574 >       len = strlen(clist);
    575 >       clist += len;
    576 diff -r libjingle-0.4.0/talk/base/schanneladapter.cc libjingle/files/talk/base/schanneladapter.cc
    577 607c607
    578 <   size_t read = min(cb, readable.size());
    579 ---
    580 >   size_t read = _min(cb, readable.size());
    581 diff -r libjingle-0.4.0/talk/base/scoped_ptr.h libjingle/files/talk/base/scoped_ptr.h
    582 36,257c36
    583 < namespace talk_base {
    584 < 
    585 < template <typename T>
    586 < class scoped_ptr {
    587 <  private:
    588 < 
    589 <   T* ptr;
    590 < 
    591 <   scoped_ptr(scoped_ptr const &);
    592 <   scoped_ptr & operator=(scoped_ptr const &);
    593 < 
    594 <  public:
    595 < 
    596 <   typedef T element_type;
    597 < 
    598 <   explicit scoped_ptr(T* p = 0): ptr(p) {}
    599 < 
    600 <   ~scoped_ptr() {
    601 <     typedef char type_must_be_complete[sizeof(T)];
    602 <     delete ptr;
    603 <   }
    604 < 
    605 <   void reset(T* p = 0) {
    606 <     typedef char type_must_be_complete[sizeof(T)];
    607 < 
    608 <     if (ptr != p) {
    609 <       delete ptr;
    610 <       ptr = p;
    611 <     }
    612 <   }
    613 < 
    614 <   T& operator*() const {
    615 <     assert(ptr != 0);
    616 <     return *ptr;
    617 <   }
    618 < 
    619 <   T* operator->() const  {
    620 <     assert(ptr != 0);
    621 <     return ptr;
    622 <   }
    623 < 
    624 <   T* get() const  {
    625 <     return ptr;
    626 <   }
    627 < 
    628 <   void swap(scoped_ptr & b) {
    629 <     T* tmp = b.ptr;
    630 <     b.ptr = ptr;
    631 <     ptr = tmp;
    632 <   }
    633 < 
    634 <   T* release() {
    635 <     T* tmp = ptr;
    636 <     ptr = 0;
    637 <     return tmp;
    638 <   }
    639 <   
    640 <   T** accept() {
    641 <     if (ptr) {
    642 <       delete ptr;
    643 <       ptr = 0;
    644 <     }
    645 <     return &ptr;
    646 <   }
    647 < 
    648 <   T** use() {
    649 <     return &ptr;
    650 <   }
    651 < };
    652 < 
    653 < template<typename T> inline
    654 < void swap(scoped_ptr<T>& a, scoped_ptr<T>& b) {
    655 <   a.swap(b);
    656 < }
    657 < 
    658 < 
    659 < 
    660 < 
    661 < //  scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to
    662 < //  is guaranteed, either on destruction of the scoped_array or via an explicit
    663 < //  reset(). Use shared_array or std::vector if your needs are more complex.
    664 < 
    665 < template<typename T>
    666 < class scoped_array {
    667 <  private:
    668 < 
    669 <   T* ptr;
    670 < 
    671 <   scoped_array(scoped_array const &);
    672 <   scoped_array & operator=(scoped_array const &);
    673 < 
    674 <  public:
    675 < 
    676 <   typedef T element_type;
    677 < 
    678 <   explicit scoped_array(T* p = 0) : ptr(p) {}
    679 < 
    680 <   ~scoped_array() {
    681 <     typedef char type_must_be_complete[sizeof(T)];
    682 <     delete[] ptr;
    683 <   }
    684 < 
    685 <   void reset(T* p = 0) {
    686 <     typedef char type_must_be_complete[sizeof(T)];
    687 < 
    688 <     if (ptr != p) {
    689 <       delete [] ptr;
    690 <       ptr = p;
    691 <     }
    692 <   }
    693 < 
    694 <   T& operator[](std::ptrdiff_t i) const {
    695 <     assert(ptr != 0);
    696 <     assert(i >= 0);
    697 <     return ptr[i];
    698 <   }
    699 < 
    700 <   T* get() const {
    701 <     return ptr;
    702 <   }
    703 < 
    704 <   void swap(scoped_array & b) {
    705 <     T* tmp = b.ptr;
    706 <     b.ptr = ptr;
    707 <     ptr = tmp;
    708 <   }
    709 < 
    710 <   T* release() {
    711 <     T* tmp = ptr;
    712 <     ptr = 0;
    713 <     return tmp;
    714 <   }
    715 < 
    716 <   T** accept() {
    717 <     if (ptr) {
    718 <       delete [] ptr;
    719 <       ptr = 0;
    720 <     }
    721 <     return &ptr;
    722 <   }
    723 < };
    724 < 
    725 < template<class T> inline
    726 < void swap(scoped_array<T>& a, scoped_array<T>& b) {
    727 <   a.swap(b);
    728 < }
    729 < 
    730 < // scoped_ptr_malloc<> is similar to scoped_ptr<>, but it accepts a
    731 < // second template argument, the function used to free the object.
    732 < 
    733 < template<typename T, void (*FF)(void*) = free> class scoped_ptr_malloc {
    734 <  private:
    735 < 
    736 <   T* ptr;
    737 < 
    738 <   scoped_ptr_malloc(scoped_ptr_malloc const &);
    739 <   scoped_ptr_malloc & operator=(scoped_ptr_malloc const &);
    740 < 
    741 <  public:
    742 < 
    743 <   typedef T element_type;
    744 < 
    745 <   explicit scoped_ptr_malloc(T* p = 0): ptr(p) {}
    746 < 
    747 <   ~scoped_ptr_malloc() {
    748 <     typedef char type_must_be_complete[sizeof(T)];
    749 <     FF(static_cast<void*>(ptr));
    750 <   }
    751 < 
    752 <   void reset(T* p = 0) {
    753 <     typedef char type_must_be_complete[sizeof(T)];
    754 < 
    755 <     if (ptr != p) {
    756 <       FF(static_cast<void*>(ptr));
    757 <       ptr = p;
    758 <     }
    759 <   }
    760 < 
    761 <   T& operator*() const {
    762 <     assert(ptr != 0);
    763 <     return *ptr;
    764 <   }
    765 < 
    766 <   T* operator->() const {
    767 <     assert(ptr != 0);
    768 <     return ptr;
    769 <   }
    770 < 
    771 <   T* get() const {
    772 <     return ptr;
    773 <   }
    774 < 
    775 <   void swap(scoped_ptr_malloc & b) {
    776 <     T* tmp = b.ptr;
    777 <     b.ptr = ptr;
    778 <     ptr = tmp;
    779 <   }
    780 < 
    781 <   T* release() {
    782 <     T* tmp = ptr;
    783 <     ptr = 0;
    784 <     return tmp;
    785 <   }
    786 < 
    787 <   T** accept() {
    788 <     if (ptr) {
    789 <       FF(static_cast<void*>(ptr));
    790 <       ptr = 0;
    791 <     }
    792 <     return &ptr;
    793 <   }
    794 < };
    795 < 
    796 < template<typename T, void (*FF)(void*)> inline
    797 < void swap(scoped_ptr_malloc<T,FF>& a, scoped_ptr_malloc<T,FF>& b) {
    798 <   a.swap(b);
    799 < }
    800 < 
    801 < } // namespace talk_base
    802 < 
    803 < // TODO: get rid of this global using 
    804 < using talk_base::scoped_ptr;
    805 ---
    806 > #include "base/scoped_ptr.h"
    807 diff -r libjingle-0.4.0/talk/base/signalthread.cc libjingle/files/talk/base/signalthread.cc
    808 12a13,15
    809 >   main_->SignalQueueDestroyed.connect(this,
    810 >                                       &SignalThread::OnMainThreadDestroyed);
    811 >   refcount_ = 1;
    812 15a19,23
    813 > void SignalThread::OnMainThreadDestroyed() {
    814 >   EnterExit ee(this);
    815 >   main_ = NULL;
    816 > }
    817 > 
    818 19a28
    819 >   EnterExit ee(this);
    820 25a35
    821 >   EnterExit ee(this);
    822 27c37
    823 <   if (kInit == state_) {
    824 ---
    825 >   if (kInit == state_ || kComplete == state_) {
    826 36c46,47
    827 < void SignalThread::Destroy() {
    828 ---
    829 > void SignalThread::Destroy(bool wait) {
    830 >   EnterExit ee(this);
    831 39,40c50,51
    832 <     delete this;
    833 <   } else if (kRunning == state_) {
    834 ---
    835 >     refcount_--;
    836 >   } else if (kRunning == state_ || kReleasing == state_) {
    837 42,47c53,63
    838 <     // A couple tricky issues here:
    839 <     // 1) Thread::Stop() calls Join(), which we don't want... we just want
    840 <     //    to stop the MessageQueue, which causes ContinueWork() to return false.
    841 <     // 2) OnWorkStop() must follow Stop(), so that when the thread wakes up
    842 <     //    due to OWS(), ContinueWork() will return false.
    843 <     worker_.MessageQueue::Stop();
    844 ---
    845 >     // OnWorkStop() must follow Quit(), so that when the thread wakes up due to
    846 >     // OWS(), ContinueWork() will return false.
    847 >     if (wait) {
    848 >       // Release the thread's lock so that it can return from ::Run.
    849 >       cs_.Leave(); 
    850 >       worker_.Stop();
    851 >       cs_.Enter();
    852 >       refcount_--;
    853 >     } else {
    854 >       worker_.Quit();
    855 >     }
    856 54a71
    857 >   EnterExit ee(this);
    858 57c74
    859 <     delete this;
    860 ---
    861 >     refcount_--;
    862 66a84
    863 >   EnterExit ee(this);
    864 71a90
    865 >   EnterExit ee(this);
    866 81a101,111
    867 >       // Before signaling that the work is done, make sure that the worker
    868 >       // thread actually is done. We got here because DoWork() finished and
    869 >       // Run() posted the ST_MSG_WORKER_DONE message. This means the worker
    870 >       // thread is about to go away anyway, but sometimes it doesn't actually
    871 >       // finish before SignalWorkDone is processed, and for a reusable
    872 >       // SignalThread this makes an assert in thread.cc fire.
    873 >       //
    874 >       // Calling Stop() on the worker ensures that the OS thread that underlies
    875 >       // the worker will finish, and will be set to NULL, enabling us to call
    876 >       // Start() again.
    877 >       worker_.Stop();
    878 85c115
    879 <       delete this;
    880 ---
    881 >       refcount_--;
    882 92c122,127
    883 <   main_->Post(this, ST_MSG_WORKER_DONE);
    884 ---
    885 >   {
    886 >     EnterExit ee(this);
    887 >     if (main_) {
    888 >       main_->Post(this, ST_MSG_WORKER_DONE);
    889 >     }
    890 >   }
    891 diff -r libjingle-0.4.0/talk/base/signalthread.h libjingle/files/talk/base/signalthread.h
    892 15a16,19
    893 > //   Periodic tasks: Wait for SignalWorkDone, then eventually call Start()
    894 > //    again to repeat the task. When the instance isn't needed anymore,
    895 > //    call Release. DoWork, OnWorkStart and OnWorkStop are called again,
    896 > //    on a new thread.
    897 22c26
    898 < class SignalThread : protected MessageHandler {
    899 ---
    900 > class SignalThread : public sigslot::has_slots<>, protected MessageHandler {
    901 35,36c39,41
    902 <   // SignalWorkDone will not be signalled.
    903 <   void Destroy();
    904 ---
    905 >   // SignalWorkDone will not be signalled.  If wait is true, does not return
    906 >   // until the thread is deleted.
    907 >   void Destroy(bool wait);
    908 53c58
    909 <   
    910 ---
    911 > 
    912 57c62
    913 <   // Context: Worker Thread.  Subclass should call periodically to
    914 ---
    915 >   // Context: Worker Thread.  Subclass should call periodically to 
    916 67c72
    917 <   
    918 ---
    919 >  
    920 79a85,106
    921 >   class EnterExit {
    922 >     friend class SignalThread;
    923 >    
    924 >     SignalThread * t_;
    925 >    
    926 >     EnterExit(SignalThread * t) : t_(t) {
    927 >       t_->cs_.Enter();
    928 >       t_->refcount_ += 1;
    929 >     }
    930 >     ~EnterExit() {
    931 >       bool d = (0 == (--(t_->refcount_)));
    932 >       t_->cs_.Leave();
    933 >       if (d)
    934 >         delete t_;
    935 >     }
    936 >   };
    937 > 
    938 >   friend class EnterExit;
    939 >  
    940 >   CriticalSection cs_;
    941 >   int refcount_;
    942 > 
    943 80a108
    944 >   void OnMainThreadDestroyed();
    945 84c112,118
    946 <   enum State { kInit, kRunning, kComplete, kStopping, kReleasing } state_;
    947 ---
    948 >   enum State {
    949 >     kInit,            // Initialized, but not started
    950 >     kRunning,         // Started and doing work
    951 >     kReleasing,       // Same as running, but to be deleted when work is done
    952 >     kComplete,        // Work is done
    953 >     kStopping,        // Work is being interrupted
    954 >   } state_;
    955 diff -r libjingle-0.4.0/talk/base/sigslot.h libjingle/files/talk/base/sigslot.h
    956 530c530
    957 < #ifdef _DEBUG
    958 ---
    959 > #if !defined(NDEBUG)
    960 676c676
    961 < #ifdef _DEBUG
    962 ---
    963 > #if !defined(NDEBUG)
    964 807c807
    965 < #ifdef _DEBUG
    966 ---
    967 > #if !defined(NDEBUG)
    968 937c937
    969 < #ifdef _DEBUG
    970 ---
    971 > #if !defined(NDEBUG)
    972 1067c1067
    973 < #ifdef _DEBUG
    974 ---
    975 > #if !defined(NDEBUG)
    976 1199c1199
    977 < #ifdef _DEBUG
    978 ---
    979 > #if !defined(NDEBUG)
    980 1331c1331
    981 < #ifdef _DEBUG
    982 ---
    983 > #if !defined(NDEBUG)
    984 1463c1463
    985 < #ifdef _DEBUG
    986 ---
    987 > #if !defined(NDEBUG)
    988 1596c1596
    989 < #ifdef _DEBUG
    990 ---
    991 > #if !defined(NDEBUG)
    992 diff -r libjingle-0.4.0/talk/base/socket.h libjingle/files/talk/base/socket.h
    993 77a78
    994 > #undef ETIMEDOUT // remove pthread.h's definition
    995 diff -r libjingle-0.4.0/talk/base/socketadapters.cc libjingle/files/talk/base/socketadapters.cc
    996 43a44,45
    997 > #include <cstring>
    998 > 
    999 diff -r libjingle-0.4.0/talk/base/socketaddress.cc libjingle/files/talk/base/socketaddress.cc
   1000 52c52
   1001 < #ifdef _DEBUG
   1002 ---
   1003 > #if !defined(NDEBUG)
   1004 54c54
   1005 < #else // !_DEBUG
   1006 ---
   1007 > #else // defined(NDEBUG)
   1008 56c56
   1009 < #endif // !_DEBUG
   1010 ---
   1011 > #endif // !defined(NDEBUG)
   1012 diff -r libjingle-0.4.0/talk/base/socketfactory.h libjingle/files/talk/base/socketfactory.h
   1013 32a33
   1014 > #include "talk/base/ssladapter.h"
   1015 46a48,52
   1016 > 
   1017 >   // Wraps the given socket in an SSL adapter.
   1018 >   virtual SSLAdapter* CreateSSLAdapter(AsyncSocket* socket) {
   1019 >     return SSLAdapter::Create(socket);
   1020 >   }
   1021 diff -r libjingle-0.4.0/talk/base/socketpool.cc libjingle/files/talk/base/socketpool.cc
   1022 142d141
   1023 <     ASSERT(false);
   1024 189d187
   1025 <       ASSERT(false);
   1026 diff -r libjingle-0.4.0/talk/base/ssladapter.cc libjingle/files/talk/base/ssladapter.cc
   1027 34c34,35
   1028 < #define SSL_USE_OPENSSL 1
   1029 ---
   1030 > // Turn off OpenSSL
   1031 > //#define SSL_USE_OPENSSL 1
   1032 84a86
   1033 > #if SSL_USE_OPENSSL || SSL_USE_SCHANNEL
   1034 85a88,90
   1035 > #else
   1036 >   return NULL;
   1037 > #endif
   1038 diff -r libjingle-0.4.0/talk/base/stream.cc libjingle/files/talk/base/stream.cc
   1039 27a28
   1040 > #include <stdio.h>
   1041 diff -r libjingle-0.4.0/talk/base/stringencode.cc libjingle/files/talk/base/stringencode.cc
   1042 34a35
   1043 > #include <stdlib.h>
   1044 525c526
   1045 < #ifdef _DEBUG
   1046 ---
   1047 > #if !defined(NDEBUG)
   1048 575c576
   1049 < #endif  // _DEBUG
   1050 ---
   1051 > #endif  // !defined(NDEBUG)
   1052 diff -r libjingle-0.4.0/talk/base/stringutils.cc libjingle/files/talk/base/stringutils.cc
   1053 72c72
   1054 < #if _DEBUG
   1055 ---
   1056 > #if !defined(NDEBUG)
   1057 76c76
   1058 < #endif  // _DEBUG
   1059 ---
   1060 > #endif  // !defined(NDEBUG)
   1061 diff -r libjingle-0.4.0/talk/base/stringutils.h libjingle/files/talk/base/stringutils.h
   1062 33a34
   1063 > #include <string.h>
   1064 87a89
   1065 > #if 0
   1066 93a96
   1067 > #endif
   1068 200,208d202
   1069 < size_t sprintfn(CTYPE* buffer, size_t buflen, const CTYPE* format, ...) {
   1070 <   va_list args;
   1071 <   va_start(args, format);
   1072 <   size_t len = vsprintfn(buffer, buflen, format, args);
   1073 <   va_end(args);
   1074 <   return len;
   1075 < }
   1076 < 
   1077 < template<class CTYPE>
   1078 218a213,221
   1079 > template<class CTYPE>
   1080 > size_t sprintfn(CTYPE* buffer, size_t buflen, const CTYPE* format, ...) {
   1081 >   va_list args;
   1082 >   va_start(args, format);
   1083 >   size_t len = vsprintfn(buffer, buflen, format, args);
   1084 >   va_end(args);
   1085 >   return len;
   1086 > }
   1087 > 
   1088 272c275
   1089 <   inline static const char* Traits<char>::empty_str() { return ""; }
   1090 ---
   1091 >   inline static const char* empty_str() { return ""; }
   1092 diff -r libjingle-0.4.0/talk/base/task.cc libjingle/files/talk/base/task.cc
   1093 5c5
   1094 <  * Redistribution and use in source and binary forms, with or without 
   1095 ---
   1096 >  * Redistribution and use in source and binary forms, with or without
   1097 8c8
   1098 <  *  1. Redistributions of source code must retain the above copyright notice, 
   1099 ---
   1100 >  *  1. Redistributions of source code must retain the above copyright notice,
   1101 13c13
   1102 <  *  3. The name of the author may not be used to endorse or promote products 
   1103 ---
   1104 >  *  3. The name of the author may not be used to endorse or promote products
   1105 17c17
   1106 <  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
   1107 ---
   1108 >  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   1109 19c19
   1110 <  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
   1111 ---
   1112 >  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   1113 23,24c23,24
   1114 <  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
   1115 <  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
   1116 ---
   1117 >  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
   1118 >  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
   1119 141c141
   1120 <   if (aborted_ || done_)
   1121 ---
   1122 >   if (done_)
   1123 150c150
   1124 <       Wake();  // to self-delete
   1125 ---
   1126 >       GetRunner()->WakeTasks();
   1127 diff -r libjingle-0.4.0/talk/base/taskrunner.h libjingle/files/talk/base/taskrunner.h
   1128 63a64,68
   1129 >   bool HasPendingTimeoutTask() {
   1130 >     return next_timeout_task_ != NULL &&
   1131 >         next_timeout_task_->TimedOut();
   1132 >   }
   1133 > 
   1134 diff -r libjingle-0.4.0/talk/base/testclient.cc libjingle/files/talk/base/testclient.cc
   1135 29a30
   1136 > #include <cstring>
   1137 diff -r libjingle-0.4.0/talk/base/thread.cc libjingle/files/talk/base/thread.cc
   1138 100a101,105
   1139 > bool ThreadManager::ThreadActive(Thread *thread) {
   1140 >   CritScope cs(&crit_);
   1141 >   return(std::find(threads_.begin(), threads_.end(), thread) != threads_.end());
   1142 > }
   1143 > 
   1144 103a109
   1145 >   stopped_ = false;
   1146 124,125c130,135
   1147 <   pthread_create(&thread_, &attr, PreRun, this);
   1148 <   started_ = true;
   1149 ---
   1150 >   CritScope cs(&started_crit_);
   1151 >   // Make sure Join() hasn't been called yet.
   1152 >   if (stopped_)
   1153 >     return;
   1154 >   if (pthread_create(&thread_, &attr, PreRun, this) == 0)
   1155 >       started_ = true;
   1156 128a139,140
   1157 >   CritScope cs(&started_crit_);
   1158 >   stopped_ = true;
   1159 131a144
   1160 >     started_ = false;
   1161 168a182,185
   1162 >   CritScope cs(&started_crit_);
   1163 >   // Make sure Join() hasn't been called yet.
   1164 >   if (stopped_)
   1165 >     return;
   1166 181a199,200
   1167 >   CritScope cs(&started_crit_);
   1168 >   stopped_ = true;
   1169 191a211,213
   1170 >   // Make sure the thread hasn't been deleted.
   1171 >   if (!g_thmgr.ThreadActive(thread))
   1172 >     return NULL;
   1173 207c229
   1174 <   MessageQueue::Stop();
   1175 ---
   1176 >   MessageQueue::Quit();
   1177 329c351
   1178 <       return false;
   1179 ---
   1180 >       return !IsQuitting();
   1181 diff -r libjingle-0.4.0/talk/base/thread.h libjingle/files/talk/base/thread.h
   1182 57a58
   1183 >   bool ThreadActive(Thread *thread);
   1184 134a136
   1185 >   CriticalSection started_crit_;
   1186 135a138
   1187 >   bool stopped_;
   1188 diff -r libjingle-0.4.0/talk/base/urlencode.cc libjingle/files/talk/base/urlencode.cc
   1189 0a1,2
   1190 > #include <stdlib.h>
   1191 > #include <string.h>
   1192 Only in libjingle-0.4.0/talk/base: win32socketserver.cc
   1193 Only in libjingle-0.4.0/talk/base: win32socketserver.h
   1194 Only in libjingle/files/talk/base: win32window.cc
   1195 diff -r libjingle-0.4.0/talk/base/winping.cc libjingle/files/talk/base/winping.cc
   1196 133c133
   1197 <   return sizeof(ICMP_ECHO_REPLY) + max(8UL, data_size);
   1198 ---
   1199 >   return sizeof(ICMP_ECHO_REPLY) + _max((uint32)(8UL), data_size);
   1200 317c317
   1201 < } // namespace talk_base
   1202 \ No newline at end of file
   1203 ---
   1204 > } // namespace talk_base
   1205 Only in libjingle/files/talk/base: winsock_initializer.cc
   1206 Only in libjingle/files/talk/base: winsock_initializer.h
   1207 Only in libjingle-0.4.0/talk: examples
   1208 Only in libjingle-0.4.0/talk: libjingle.sln
   1209 Only in libjingle-0.4.0/talk: libjingle.vcproj
   1210 Only in libjingle-0.4.0/talk: p2p
   1211 Only in libjingle-0.4.0/talk: session
   1212 Only in libjingle-0.4.0/talk: third_party
   1213 Only in libjingle-0.4.0/talk/xmllite: Makefile.in
   1214 diff -r libjingle-0.4.0/talk/xmllite/qname.cc libjingle/files/talk/xmllite/qname.cc
   1215 39c39
   1216 <   int result = ns.size() * 101;
   1217 ---
   1218 >   int result = static_cast<int>(ns.size()) * 101;
   1219 diff -r libjingle-0.4.0/talk/xmllite/qname.h libjingle/files/talk/xmllite/qname.h
   1220 64d63
   1221 <       refcount_(1),
   1222 66c65,66
   1223 <       localPart_(local) {}
   1224 ---
   1225 >       localPart_(local),
   1226 >       refcount_(1) {}
   1227 diff -r libjingle-0.4.0/talk/xmllite/xmlelement.cc libjingle/files/talk/xmllite/xmlelement.cc
   1228 88c88,89
   1229 <     pLastChild_(NULL) {
   1230 ---
   1231 >     pLastChild_(NULL),
   1232 >     cdata_(false) {
   1233 97c98,99
   1234 <     pLastChild_(NULL) {
   1235 ---
   1236 >     pLastChild_(NULL),
   1237 >     cdata_(false) {
   1238 125a128
   1239 >   cdata_ = elt.cdata_;
   1240 133c136,137
   1241 <   pLastChild_(NULL) {
   1242 ---
   1243 >   pLastChild_(NULL),
   1244 >   cdata_(false) {
   1245 393a398,403
   1246 > XmlElement::AddCDATAText(const char * buf, int len) {
   1247 >   cdata_ = true;
   1248 >   AddParsedText(buf, len);
   1249 > }
   1250 > 
   1251 > void
   1252 diff -r libjingle-0.4.0/talk/xmllite/xmlelement.h libjingle/files/talk/xmllite/xmlelement.h
   1253 203a204,206
   1254 >   // Note: CDATA is not supported by XMPP, therefore using this function will
   1255 >   // generate non-XMPP compatible XML.
   1256 >   void AddCDATAText(const char * buf, int len);
   1257 217a221,222
   1258 >   bool IsCDATA() const { return cdata_; }
   1259 > 
   1260 228a234
   1261 >   bool cdata_;
   1262 diff -r libjingle-0.4.0/talk/xmllite/xmlparser.cc libjingle/files/talk/xmllite/xmlparser.cc
   1263 28,29d27
   1264 < #include "talk/xmllite/xmlparser.h"
   1265 < 
   1266 35a34
   1267 > #include "talk/xmllite/xmlconstants.h"
   1268 38c37
   1269 < #include "talk/xmllite/xmlconstants.h"
   1270 ---
   1271 > #include "talk/xmllite/xmlparser.h"
   1272 119a119,121
   1273 >   context_.SetPosition(XML_GetCurrentLineNumber(expat_),
   1274 >                        XML_GetCurrentColumnNumber(expat_),
   1275 >                        XML_GetCurrentByteIndex(expat_));
   1276 127a130,132
   1277 >   context_.SetPosition(XML_GetCurrentLineNumber(expat_),
   1278 >                        XML_GetCurrentColumnNumber(expat_),
   1279 >                        XML_GetCurrentByteIndex(expat_));
   1280 134a140,142
   1281 >   context_.SetPosition(XML_GetCurrentLineNumber(expat_),
   1282 >                        XML_GetCurrentColumnNumber(expat_),
   1283 >                        XML_GetCurrentByteIndex(expat_));
   1284 168c176,180
   1285 <   if (XML_Parse(expat_, data, static_cast<int>(len), isFinal) != XML_STATUS_OK)
   1286 ---
   1287 >   if (XML_Parse(expat_, data, static_cast<int>(len), isFinal) !=
   1288 >       XML_STATUS_OK) {
   1289 >     context_.SetPosition(XML_GetCurrentLineNumber(expat_),
   1290 >                          XML_GetCurrentColumnNumber(expat_),
   1291 >                          XML_GetCurrentByteIndex(expat_));
   1292 169a182
   1293 >   }
   1294 193c206,209
   1295 <     raised_(XML_ERROR_NONE) {
   1296 ---
   1297 >     raised_(XML_ERROR_NONE),
   1298 >     line_number_(0),
   1299 >     column_number_(0),
   1300 >     byte_index_(0) {
   1301 247c263,285
   1302 < XmlParser::ParseContext::~ParseContext() {
   1303 ---
   1304 > void
   1305 > XmlParser::ParseContext::SetPosition(XML_Size line, XML_Size column,
   1306 >                                      XML_Index byte_index) {
   1307 >   line_number_ = line;
   1308 >   column_number_ = column;
   1309 >   byte_index_ = byte_index;
   1310 > }
   1311 > 
   1312 > void
   1313 > XmlParser::ParseContext::GetPosition(unsigned long * line,
   1314 >                                      unsigned long * column,
   1315 >                                      unsigned long * byte_index) {
   1316 >   if (line != NULL) {
   1317 >     *line = static_cast<unsigned long>(line_number_);
   1318 >   }
   1319 > 
   1320 >   if (column != NULL) {
   1321 >     *column = static_cast<unsigned long>(column_number_);
   1322 >   }
   1323 > 
   1324 >   if (byte_index != NULL) {
   1325 >     *byte_index = static_cast<unsigned long>(byte_index_);
   1326 >   }
   1327 249a288
   1328 > XmlParser::ParseContext::~ParseContext() {
   1329 251a291
   1330 > }
   1331 diff -r libjingle-0.4.0/talk/xmllite/xmlparser.h libjingle/files/talk/xmllite/xmlparser.h
   1332 48a49,50
   1333 >   virtual void GetPosition(unsigned long * line, unsigned long * column,
   1334 >                            unsigned long * byte_index) = 0;
   1335 85a88,89
   1336 >     virtual void GetPosition(unsigned long * line, unsigned long * column,
   1337 >                              unsigned long * byte_index);
   1338 91a96
   1339 >     void SetPosition(XML_Size line, XML_Size column, XML_Index byte_index);
   1340 96a102,104
   1341 >     XML_Size line_number_;
   1342 >     XML_Size column_number_;
   1343 >     XML_Index byte_index_;
   1344 diff -r libjingle-0.4.0/talk/xmllite/xmlprinter.cc libjingle/files/talk/xmllite/xmlprinter.cc
   1345 46a47
   1346 >   void PrintCDATAText(const std::string & text);
   1347 134,136c135,141
   1348 <       if (pchild->IsText())
   1349 <         PrintBodyText(pchild->AsText()->Text());
   1350 <       else
   1351 ---
   1352 >       if (pchild->IsText()) {
   1353 >         if (element->IsCDATA()) {
   1354 >           PrintCDATAText(pchild->AsText()->Text());
   1355 >         } else {
   1356 >           PrintBodyText(pchild->AsText()->Text());
   1357 >         }
   1358 >       } else
   1359 188a194,197
   1360 > void
   1361 > XmlPrinterImpl::PrintCDATAText(const std::string & text) {
   1362 >   *pout_ << "<![CDATA[" << text << "]]>";
   1363 > }
   1364 Only in libjingle-0.4.0/talk/xmpp: Makefile.in
   1365 Only in libjingle-0.4.0/talk/xmpp: constants.cc
   1366 Only in libjingle-0.4.0/talk/xmpp: constants.h
   1367 diff -r libjingle-0.4.0/talk/xmpp/jid.cc libjingle/files/talk/xmpp/jid.cc
   1368 33c33
   1369 < #include "talk/xmpp/constants.h"
   1370 ---
   1371 > #include "talk/xmpp/xmppconstants.h"
   1372 diff -r libjingle-0.4.0/talk/xmpp/plainsaslhandler.h libjingle/files/talk/xmpp/plainsaslhandler.h
   1373 31d30
   1374 < #include "talk/xmpp/saslhandler.h"
   1375 32a32,34
   1376 > #include <string>
   1377 > 
   1378 > #include "talk/xmpp/saslhandler.h"
   1379 68a71,76
   1380 > 
   1381 >   virtual bool GetTlsServerInfo(const talk_base::SocketAddress& server,
   1382 >                                 std::string* tls_server_hostname,
   1383 >                                 std::string* tls_server_domain) {
   1384 >     return false;
   1385 >   }
   1386 diff -r libjingle-0.4.0/talk/xmpp/prexmppauth.h libjingle/files/talk/xmpp/prexmppauth.h
   1387 33d32
   1388 < #include "talk/xmpp/saslhandler.h"
   1389 64c63
   1390 < class PreXmppAuth : public SaslHandler {
   1391 ---
   1392 > class PreXmppAuth {
   1393 diff -r libjingle-0.4.0/talk/xmpp/saslcookiemechanism.h libjingle/files/talk/xmpp/saslcookiemechanism.h
   1394 33c33
   1395 < #include "talk/xmpp/constants.h"
   1396 ---
   1397 > #include "talk/xmpp/xmppconstants.h"
   1398 40,41c40,55
   1399 <   SaslCookieMechanism(const std::string & mechanism, const std::string & username, const std::string & cookie) :
   1400 <     mechanism_(mechanism), username_(username), cookie_(cookie) {}
   1401 ---
   1402 >   SaslCookieMechanism(const std::string & mechanism,
   1403 >                       const std::string & username,
   1404 >                       const std::string & cookie,
   1405 >                       const std::string & token_service)
   1406 >     : mechanism_(mechanism),
   1407 >       username_(username),
   1408 >       cookie_(cookie),
   1409 >       token_service_(token_service) {}
   1410 > 
   1411 >   SaslCookieMechanism(const std::string & mechanism,
   1412 >                       const std::string & username,
   1413 >                       const std::string & cookie)
   1414 >     : mechanism_(mechanism),
   1415 >       username_(username),
   1416 >       cookie_(cookie),
   1417 >       token_service_("") {}
   1418 48a63,67
   1419 >     if (!token_service_.empty()) {
   1420 >       el->AddAttr(
   1421 >           QName(true, "http://www.google.com/talk/protocol/auth", "service"),
   1422 >           token_service_);
   1423 >     }
   1424 62a82
   1425 >   std::string token_service_;
   1426 diff -r libjingle-0.4.0/talk/xmpp/saslhandler.h libjingle/files/talk/xmpp/saslhandler.h
   1427 31a32,34
   1428 > #include <vector>
   1429 > 
   1430 > #include "talk/base/socketaddress.h"
   1431 53a57,63
   1432 > 
   1433 >   // Fills in the tls server hostname/domain to use for the given
   1434 >   // server (and returns true).  Return false if you want the defaults
   1435 >   // to be used.
   1436 >   virtual bool GetTlsServerInfo(const talk_base::SocketAddress& server,
   1437 >                                 std::string* tls_server_hostname,
   1438 >                                 std::string* tls_server_domain) = 0;
   1439 diff -r libjingle-0.4.0/talk/xmpp/saslmechanism.cc libjingle/files/talk/xmpp/saslmechanism.cc
   1440 30c30
   1441 < #include "talk/xmpp/constants.h"
   1442 ---
   1443 > #include "talk/xmpp/xmppconstants.h"
   1444 diff -r libjingle-0.4.0/talk/xmpp/xmppclient.cc libjingle/files/talk/xmpp/xmppclient.cc
   1445 30c30
   1446 < #include "talk/xmpp/constants.h"
   1447 ---
   1448 > #include "talk/xmpp/xmppconstants.h"
   1449 32a33
   1450 > #include "talk/xmpp/saslhandler.h"
   1451 68a70
   1452 >   scoped_ptr<SaslHandler> sasl_handler_;
   1453 93c95,99
   1454 < XmppClient::Connect(const XmppClientSettings & settings, const std::string & lang, AsyncSocket * socket, PreXmppAuth * pre_auth) {
   1455 ---
   1456 > XmppClient::Connect(const XmppClientSettings & settings,
   1457 >                     const std::string & lang,
   1458 >                     AsyncSocket * socket,
   1459 >                     PreXmppAuth * pre_auth,
   1460 >                     SaslHandler * sasl_handler) {
   1461 113,125c119,125
   1462 <   //
   1463 <   // The talk.google.com server expects you to use "gmail.com" in the
   1464 <   // stream, and expects the domain certificate to be "gmail.com" as well.
   1465 <   // For all other servers, we leave the strings empty, which causes
   1466 <   // the jid's domain to be used.  "foo (a] example.com" -> stream to="example.com"
   1467 <   // tls certificate for "example.com"
   1468 <   //
   1469 <   // This is only true when using Gaia auth, so let's say if there's no preauth,
   1470 <   // we should use the actual server name
   1471 <   if ((settings.server().IPAsString() == buzz::STR_TALK_GOOGLE_COM ||
   1472 <       settings.server().IPAsString() == buzz::STR_TALKX_L_GOOGLE_COM) && 
   1473 <       pre_auth != NULL) {
   1474 <     d_->engine_->SetTlsServer(buzz::STR_GMAIL_COM, buzz::STR_GMAIL_COM);
   1475 ---
   1476 >   if (sasl_handler) {
   1477 >     std::string tls_server_hostname, tls_server_domain;
   1478 >     if (sasl_handler->GetTlsServerInfo(settings.server(),
   1479 >                                        &tls_server_hostname,
   1480 >                                        &tls_server_domain)) {
   1481 >       d_->engine_->SetTlsServer(tls_server_hostname, tls_server_domain);
   1482 >     }
   1483 139a140
   1484 >   d_->sasl_handler_.reset(sasl_handler);
   1485 200a202,209
   1486 >   if (d_->sasl_handler_.get()) {
   1487 >     d_->engine_->SetSaslHandler(d_->sasl_handler_.release());
   1488 >   }
   1489 >   else {
   1490 >     d_->engine_->SetSaslHandler(new PlainSaslHandler(
   1491 >         d_->engine_->GetUser(), d_->pass_, d_->allow_plain_));
   1492 >   }
   1493 > 
   1494 209,210d217
   1495 <     d_->engine_->SetSaslHandler(new PlainSaslHandler(
   1496 <               d_->engine_->GetUser(), d_->pass_, d_->allow_plain_));
   1497 253,254d259
   1498 <   // transfer ownership of pre_auth_ to engine
   1499 <   d_->engine_->SetSaslHandler(d_->pre_auth_.release());
   1500 261a267,268
   1501 >     d_->pre_engine_error_ = XmppEngine::ERROR_SOCKET;
   1502 >     d_->pre_engine_subcode_ = d_->socket_->GetError();
   1503 347c354
   1504 < //#ifdef _DEBUG
   1505 ---
   1506 > //#if !defined(NDEBUG)
   1507 375c382
   1508 < //#ifdef _DEBUG
   1509 ---
   1510 > //#if !defined(NDEBUG)
   1511 diff -r libjingle-0.4.0/talk/xmpp/xmppclient.h libjingle/files/talk/xmpp/xmppclient.h
   1512 42a43
   1513 > class SaslHandler;
   1514 80c81,82
   1515 <                            PreXmppAuth * preauth);
   1516 ---
   1517 >                            PreXmppAuth * preauth,
   1518 >                            SaslHandler * sasl_handler);
   1519 141c143
   1520 <   std::string XmppClient::GetStateName(int state) const {
   1521 ---
   1522 >   std::string GetStateName(int state) const {
   1523 diff -r libjingle-0.4.0/talk/xmpp/xmppclientsettings.h libjingle/files/talk/xmpp/xmppclientsettings.h
   1524 31d30
   1525 < #include "talk/p2p/base/port.h"
   1526 32a32,45
   1527 > #include "talk/base/proxyinfo.h"
   1528 > 
   1529 > namespace cricket {
   1530 > 
   1531 > // This enum was taken from talk/p2p/base/port.h, which is the only
   1532 > // thing we actually need from the p2p directory.
   1533 > enum ProtocolType {
   1534 >   PROTO_UDP,
   1535 >   PROTO_TCP,
   1536 >   PROTO_SSLTCP,
   1537 >   PROTO_LAST = PROTO_SSLTCP
   1538 > };
   1539 > 
   1540 > }  // namespace cricket
   1541 59a73,75
   1542 >   void set_token_service(const std::string & token_service) {
   1543 >     token_service_ = token_service;
   1544 >   }
   1545 75a92
   1546 >   const std::string & token_service() const { return token_service_; }
   1547 93a111
   1548 >   std::string token_service_;
   1549 Only in libjingle/files/talk/xmpp: xmppconstants.cc
   1550 Only in libjingle/files/talk/xmpp: xmppconstants.h
   1551 diff -r libjingle-0.4.0/talk/xmpp/xmppengineimpl.cc libjingle/files/talk/xmpp/xmppengineimpl.cc
   1552 37c37
   1553 < #include "talk/xmpp/constants.h"
   1554 ---
   1555 > #include "talk/xmpp/xmppconstants.h"
   1556 diff -r libjingle-0.4.0/talk/xmpp/xmppengineimpl_iq.cc libjingle/files/talk/xmpp/xmppengineimpl_iq.cc
   1557 32c32
   1558 < #include "talk/xmpp/constants.h"
   1559 ---
   1560 > #include "talk/xmpp/xmppconstants.h"
   1561 diff -r libjingle-0.4.0/talk/xmpp/xmpplogintask.cc libjingle/files/talk/xmpp/xmpplogintask.cc
   1562 34c34
   1563 < #include "talk/xmpp/constants.h"
   1564 ---
   1565 > #include "talk/xmpp/xmppconstants.h"
   1566 44c44
   1567 < #ifdef _DEBUG
   1568 ---
   1569 > #if !defined(NDEBUG)
   1570 59c59
   1571 < #endif  // _DEBUG
   1572 ---
   1573 > #endif  // !defined(NDEBUG)
   1574 103c103
   1575 < #if _DEBUG
   1576 ---
   1577 > #if !defined(NDEBUG)
   1578 106c106
   1579 < #endif  // _DEBUG
   1580 ---
   1581 > #endif  // !defined(NDEBUG)
   1582 218a219,221
   1583 >         auth->SetAttr(QN_GOOGLE_ALLOW_GENERATED_JID_XMPP_LOGIN, "true");
   1584 >         auth->SetAttr(QN_GOOGLE_AUTH_CLIENT_USES_FULL_BIND_RESULT, "true");
   1585 > 
   1586 diff -r libjingle-0.4.0/talk/xmpp/xmpplogintask.h libjingle/files/talk/xmpp/xmpplogintask.h
   1587 93c93
   1588 < #ifdef _DEBUG
   1589 ---
   1590 > #if !defined(NDEBUG)
   1591 95c95
   1592 < #endif  // _DEBUG
   1593 ---
   1594 > #endif  // !defined(NDEBUG)
   1595 diff -r libjingle-0.4.0/talk/xmpp/xmppstanzaparser.cc libjingle/files/talk/xmpp/xmppstanzaparser.cc
   1596 32c32
   1597 < #include "talk/xmpp/constants.h"
   1598 ---
   1599 > #include "talk/xmpp/xmppconstants.h"
   1600 diff -r libjingle-0.4.0/talk/xmpp/xmpptask.cc libjingle/files/talk/xmpp/xmpptask.cc
   1601 31c31
   1602 < #include "talk/xmpp/constants.h"
   1603 ---
   1604 > #include "talk/xmpp/xmppconstants.h"
   1605 40c40
   1606 < #ifdef _DEBUG
   1607 ---
   1608 > #if !defined(NDEBUG)
   1609 88c88
   1610 < #ifdef _DEBUG
   1611 ---
   1612 > #if !defined(NDEBUG)
   1613 174c174
   1614 < }
   1615 \ No newline at end of file
   1616 ---
   1617 > }
   1618 diff -r libjingle-0.4.0/talk/xmpp/xmpptask.h libjingle/files/talk/xmpp/xmpptask.h
   1619 80c80
   1620 < #ifdef _DEBUG
   1621 ---
   1622 > #if !defined(NDEBUG)
   1623 106,107c106,107
   1624 <   XmlElement *MakeIqResult(const XmlElement* query);
   1625 <   XmlElement *MakeIq(const std::string& type,
   1626 ---
   1627 >   static XmlElement *MakeIqResult(const XmlElement* query);
   1628 >   static XmlElement *MakeIq(const std::string& type,
   1629 123c123
   1630 < #ifdef _DEBUG
   1631 ---
   1632 > #if !defined(NDEBUG)
   1633 diff -r libjingle-0.4.0/talk/base/common.cc libjingle/files/talk/base/common.cc
   1634 62c62
   1635 < } // namespace talk_base
   1636 \ No newline at end of file
   1637 ---
   1638 > } // namespace talk_base
   1639 diff -r libjingle-0.4.0/talk/base/httpbase.cc libjingle/files/talk/base/httpbase.cc
   1640 154c154
   1641 <         if (sscanf(value, "%d", &data_size_) != 1) {
   1642 ---
   1643 >         if (sscanf(value, "%zu", &data_size_) != 1) {
   1644 diff -r libjingle-0.4.0/talk/base/httpcommon.cc libjingle/files/talk/base/httpcommon.cc
   1645 339c339
   1646 <                   &tval.tm_hour, &tval.tm_min, &tval.tm_sec, &zone)) {
   1647 ---
   1648 >                   &tval.tm_hour, &tval.tm_min, &tval.tm_sec, zone)) {
   1649 472c472
   1650 <   uint32 vmajor, vminor;
   1651 ---
   1652 >   unsigned long vmajor, vminor;
   1653 549,550c549,550
   1654 <   uint32 vmajor, vminor;
   1655 <   if ((sscanf(line, "HTTP/%lu.%lu %lu%n", &vmajor, &vminor, &scode, &pos) != 3)
   1656 ---
   1657 >   unsigned long vmajor, vminor;
   1658 >   if ((sscanf(line, "HTTP/%lu.%lu %lu%zu", &vmajor, &vminor, &scode, &pos) != 3)
   1659 693c693
   1660 <     sprintf(buffer, "%d", time(0));
   1661 ---
   1662 >     sprintf(buffer, "%ld", time(0));
   1663 diff -r libjingle-0.4.0/talk/base/httpcommon.h libjingle/files/talk/base/httpcommon.h
   1664 329c329
   1665 <   uint32 scode;
   1666 ---
   1667 >   unsigned long scode;
   1668 diff -r libjingle-0.4.0/talk/base/diskcache.cc libjingle/files/talk/base/diskcache.cc
   1669 300c300
   1670 <   if (1 != sscanf(pathname.extension().c_str(), ".%u", index))
   1671 ---
   1672 >   if (1 != sscanf(pathname.extension().c_str(), ".%zu", index))
   1673 diff -r libjingle-0.4.0/talk/base/logging.cc libjingle/files/talk/base/logging.cc
   1674 69c69
   1675 <   snprintf(buffer, sizeof(buffer), "0x%08lx", err);  
   1676 ---
   1677 >   snprintf(buffer, sizeof(buffer), "0x%08x", err);  
   1678 diff -r libjingle-0.4.0/talk/base/socketadapters.cc libjingle/files/talk/base/socketadapters.cc
   1679 360,361c360,361
   1680 <     uint32 code;
   1681 <     if (sscanf(data, "HTTP/%*lu.%*lu %lu", &code) != 1) {
   1682 ---
   1683 >     unsigned long code;
   1684 >     if (sscanf(data, "HTTP/%*u.%*u %lu", &code) != 1) {
   1685