gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. 8bf9901e124b34651281


From: Rob Savoye
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 8bf9901e124b346512817aa0de46a79a45a17d26
Date: Mon, 04 Oct 2010 00:03:49 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  8bf9901e124b346512817aa0de46a79a45a17d26 (commit)
      from  28c9cf11fc8b8ac8cb65d9734e86db738ce6c722 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=8bf9901e124b346512817aa0de46a79a45a17d26


commit 8bf9901e124b346512817aa0de46a79a45a17d26
Author: Rob Savoye <address@hidden>
Date:   Sun Oct 3 18:03:43 2010 -0600

    only indenting and minor formatting changes.

diff --git a/libbase/curl_adapter.cpp b/libbase/curl_adapter.cpp
index d0d7b3d..efd679b 100644
--- a/libbase/curl_adapter.cpp
+++ b/libbase/curl_adapter.cpp
@@ -214,16 +214,14 @@ CurlSession::~CurlSession()
 
     CURLSHcode code;
     int retries=0;
-    while ( (code=curl_share_cleanup(_shandle)) != CURLSHE_OK )
-    {
-        if ( ++retries > 10 )
-        {
+    while ( (code=curl_share_cleanup(_shandle)) != CURLSHE_OK ) {
+        if ( ++retries > 10 ) {
             log_error("Failed cleaning up share handle: %s. Giving up after "
-                    "%d retries.", curl_share_strerror(code), retries);
+                     "%d retries.", curl_share_strerror(code), retries);
             break;
         }
         log_error("Failed cleaning up share handle: %s. Will try again in "
-                "a second.", curl_share_strerror(code));
+                 "a second.", curl_share_strerror(code));
         gnashSleep(1000000);
     }
     _shandle = 0;
@@ -304,36 +302,35 @@ CurlSession::lockSharedHandle(CURL* handle, 
curl_lock_data data,
     // TODO: see if we may make use of the 'access' parameter
     UNUSED(access);
 
-    switch (data)
-    {
-        case CURL_LOCK_DATA_DNS:
-            //log_debug("Locking DNS cache mutex");
-            _dnscacheMutexLock.lock();
-            //log_debug("DNS cache mutex locked");
-            break;
-        case CURL_LOCK_DATA_COOKIE:
-            //log_debug("Locking cookies mutex");
-            _cookieMutexLock.lock(); 
-            //log_debug("Cookies mutex locked");
-            break;
-        case CURL_LOCK_DATA_SHARE:
-            //log_debug("Locking share mutex");
-            _shareMutexLock.lock(); 
-            //log_debug("Share mutex locked");
-            break;
-        case CURL_LOCK_DATA_SSL_SESSION:
-            log_error("lockSharedHandle: SSL session locking "
-                    "unsupported");
-            break;
-        case CURL_LOCK_DATA_CONNECT:
-            log_error("lockSharedHandle: connect locking unsupported");
-            break;
-        case CURL_LOCK_DATA_LAST:
-            log_error("lockSharedHandle: last locking unsupported ?!");
-            break;
-        default:
-            log_error("lockSharedHandle: unknown shared data %d", data);
+    switch (data) {
+    case CURL_LOCK_DATA_DNS:
+       //log_debug("Locking DNS cache mutex");
+       _dnscacheMutexLock.lock();
+       //log_debug("DNS cache mutex locked");
+       break;
+    case CURL_LOCK_DATA_COOKIE:
+       //log_debug("Locking cookies mutex");
+       _cookieMutexLock.lock(); 
+       //log_debug("Cookies mutex locked");
             break;
+    case CURL_LOCK_DATA_SHARE:
+       //log_debug("Locking share mutex");
+       _shareMutexLock.lock(); 
+       //log_debug("Share mutex locked");
+       break;
+    case CURL_LOCK_DATA_SSL_SESSION:
+       log_error("lockSharedHandle: SSL session locking "
+                 "unsupported");
+       break;
+    case CURL_LOCK_DATA_CONNECT:
+       log_error("lockSharedHandle: connect locking unsupported");
+       break;
+    case CURL_LOCK_DATA_LAST:
+       log_error("lockSharedHandle: last locking unsupported ?!");
+       break;
+    default:
+       log_error("lockSharedHandle: unknown shared data %d", data);
+       break;
     }
 }
 
@@ -344,34 +341,33 @@ CurlSession::unlockSharedHandle(CURL* handle, 
curl_lock_data data)
 
     // data defines what data libcurl wants to lock, and you must make
     // sure that only one lock is given at any time for each kind of data.
-    switch (data)
-    {
-        case CURL_LOCK_DATA_DNS:
-            //log_debug("Unlocking DNS cache mutex");
-            _dnscacheMutexLock.unlock();
-            break;
-        case CURL_LOCK_DATA_COOKIE:
-            //log_debug("Unlocking cookies mutex");
-            _cookieMutexLock.unlock();
-            break;
-        case CURL_LOCK_DATA_SHARE:
-            //log_debug("Unlocking share mutex");
-            _shareMutexLock.unlock();
-            break;
-        case CURL_LOCK_DATA_SSL_SESSION:
-            log_error("unlockSharedHandle: SSL session locking "
-                    "unsupported");
-            break;
-        case CURL_LOCK_DATA_CONNECT:
-            log_error("unlockSharedHandle: connect locking unsupported");
-            break;
-        case CURL_LOCK_DATA_LAST:
-            log_error("unlockSharedHandle: last locking unsupported ?!");
-            break;
-        default:
-            std::cerr << "unlockSharedHandle: unknown shared data " <<
-                data << std::endl;
-            break;
+    switch (data) {
+    case CURL_LOCK_DATA_DNS:
+       //log_debug("Unlocking DNS cache mutex");
+       _dnscacheMutexLock.unlock();
+       break;
+    case CURL_LOCK_DATA_COOKIE:
+       //log_debug("Unlocking cookies mutex");
+       _cookieMutexLock.unlock();
+       break;
+    case CURL_LOCK_DATA_SHARE:
+       //log_debug("Unlocking share mutex");
+       _shareMutexLock.unlock();
+       break;
+    case CURL_LOCK_DATA_SSL_SESSION:
+       log_error("unlockSharedHandle: SSL session locking "
+                 "unsupported");
+       break;
+    case CURL_LOCK_DATA_CONNECT:
+       log_error("unlockSharedHandle: connect locking unsupported");
+       break;
+    case CURL_LOCK_DATA_LAST:
+       log_error("unlockSharedHandle: last locking unsupported ?!");
+       break;
+    default:
+       std::cerr << "unlockSharedHandle: unknown shared data " <<
+           data << std::endl;
+       break;
     }
 }
 
@@ -540,9 +536,7 @@ CurlStreamFile::cache(void *from, std::streamsize size)
     std::fseek(_cache, 0, SEEK_END);
 
     std::streamsize wrote = std::fwrite(from, 1, size, _cache);
-    if ( wrote < 1 )
-    {
-
+    if ( wrote < 1 ) {
         boost::format fmt = boost::format("writing to cache file: requested "
                                           "%d, wrote %d (%s)") %
                                           size % wrote % std::strerror(errno);
@@ -562,8 +556,7 @@ CurlStreamFile::cache(void *from, std::streamsize size)
 void
 CurlStreamFile::fillCacheNonBlocking()
 {
-    if ( ! _running )
-    {
+    if ( ! _running ) {
 #if GNASH_CURL_VERBOSE
         log_debug("Not running: fillCacheNonBlocking returning");
 #endif
@@ -572,13 +565,11 @@ CurlStreamFile::fillCacheNonBlocking()
 
     CURLMcode mcode;
 
-    do
-    {
+    do {
         mcode = curl_multi_perform(_mhandle, &_running);
     } while (mcode == CURLM_CALL_MULTI_PERFORM); // && _running ?
 
-    if (mcode != CURLM_OK)
-    {
+    if (mcode != CURLM_OK) {
         throw GnashException(curl_multi_strerror(mcode));
     }
 
@@ -624,20 +615,18 @@ CurlStreamFile::fillCache(std::streamsize size)
 #endif
 
     WallClockTimer lastProgress; // timer since last progress
-    while (_running)
-    {
-
+    while (_running) {
         fillCacheNonBlocking(); // NOTE: will handle 404
-
+       
         // Do this here to avoid calling select()
         // when we have enough bytes anyway, or
         // we reached EOF
         if (_cached >= static_cast<size_t>(size) || !_running) break; 
-
+       
 #if GNASH_CURL_VERBOSE
         //log_debug("cached: %d, size: %d", _cached, size);
 #endif
-
+       
         // Zero these out _before_ calling curl_multi_fdset!
         FD_ZERO(&readfd);
         FD_ZERO(&writefd);
@@ -689,19 +678,15 @@ CurlStreamFile::fillCache(std::streamsize size)
 // select() will always fail on OS/2 and AmigaOS4 as we can't select
 // on file descriptors, only on sockets
 #if !defined(__OS2__) && !defined(__amigaos4__) && !defined(WIN32)
-        if ( ret == -1 )
-        {
-            if ( errno == EINTR )
-            {
+        if ( ret == -1 ) {
+            if ( errno == EINTR ) {
                 // we got interrupted by a signal
                 // let's consider this as a timeout
 #ifdef GNASH_CURL_VERBOSE
                 log_debug("select() was interrupted by a signal");
 #endif
                 ret = 0;
-            }
-            else
-            {
+            } else {
                 // something unexpected happened
                 boost::format fmt = boost::format(
                     "error polling data from connection to %s: %s ")
@@ -710,24 +695,20 @@ CurlStreamFile::fillCache(std::streamsize size)
             }
         }
 #endif
-        if ( ! ret )
-        {
+        if ( ! ret ) {
             // Timeout, check the clock to see
             // if we expired the user Timeout
 #ifdef GNASH_CURL_VERBOSE
             log_debug("select() timed out, elapsed is %u",
-                    lastProgress.elapsed());
+                     lastProgress.elapsed());
 #endif
-            if (userTimeout && lastProgress.elapsed() > userTimeout)
-            {
+            if (userTimeout && lastProgress.elapsed() > userTimeout) {
                 log_error(_("Timeout (%u milliseconds) while loading "
                             "from url %s"), userTimeout, _url);
                 // TODO: should we set _error here ?
                 return;
             }
-        }
-        else
-        {
+        } else {
             // Activity, reset the timer...
 #ifdef GNASH_CURL_VERBOSE
             log_debug("FD activity, resetting progress timer");
@@ -751,35 +732,30 @@ CurlStreamFile::processMessages()
     
     // The number of messages left in the queue (not used by us).
     int msgs;
-    while ((curl_msg = curl_multi_info_read(_mhandle, &msgs)))
-    {
-
+    while ((curl_msg = curl_multi_info_read(_mhandle, &msgs))) {
         // Only for completed transactions
         if (curl_msg->msg == CURLMSG_DONE) {
-
+           
             // HTTP transaction succeeded
             if (curl_msg->data.result == CURLE_OK) {
-
+               
                 long code;
-
+               
                 // Check HTTP response
                 curl_easy_getinfo(curl_msg->easy_handle,
-                          CURLINFO_RESPONSE_CODE, &code);
-
+                                 CURLINFO_RESPONSE_CODE, &code);
+               
                 if ( code >= 400 ) {
                     log_error ("HTTP response %ld from url %s",
                                         code, _url);
                     _error = true;
                     _running = false;
-                }
-                else {
+                } else {
                     log_debug ("HTTP response %ld from url %s",
-                                        code, _url);
+                              code, _url);
                 }
 
-            }
-            else {
-
+            } else {
                 // Transaction failed, pass on curl error.
                 log_error("CURL: %s", curl_easy_strerror(
                                     curl_msg->data.result));
@@ -818,8 +794,9 @@ CurlStreamFile::init(const std::string& url, const 
std::string& cachefile)
                     "a temporary file instead");
             _cache = std::tmpfile();
         }
+    } else {
+       _cache = std::tmpfile();
     }
-    else _cache = std::tmpfile();
 
     if ( ! _cache ) {
         throw GnashException("Could not create temporary cache file");
@@ -831,16 +808,15 @@ CurlStreamFile::init(const std::string& url, const 
std::string& cachefile)
     // Override cURL's default verification of SSL certificates
     // This is insecure, so log security warning.
     // Equivalent to curl -k or curl --insecure.
-    if (rcfile.insecureSSL())
-    {
+    if (rcfile.insecureSSL()) {
         log_security(_("Allowing connections to SSL sites with invalid "
-         "certificates"));        
-
+                      "certificates"));        
+       
         ccode = curl_easy_setopt(_handle, CURLOPT_SSL_VERIFYPEER, 0);
         if ( ccode != CURLE_OK ) {
             throw GnashException(curl_easy_strerror(ccode));
         }
-
+       
         ccode = curl_easy_setopt(_handle, CURLOPT_SSL_VERIFYHOST, 0);
         if ( ccode != CURLE_OK ) {
             throw GnashException(curl_easy_strerror(ccode));
@@ -1009,8 +985,7 @@ CurlStreamFile::CurlStreamFile(const std::string& url, 
const std::string& vars,
     _customHeaders = curl_slist_append(_customHeaders, "Expect:");
 
     for (NetworkAdapter::RequestHeaders::const_iterator i = headers.begin(),
-         e = headers.end(); i != e; ++i)
-    {
+            e = headers.end(); i != e; ++i) {
         // Check here to see whether header name is allowed.
         if (!NetworkAdapter::isHeaderAllowed(i->first)) continue;
         std::ostringstream os;
@@ -1099,17 +1074,15 @@ CurlStreamFile::readNonBlocking(void *dst, 
std::streamsize bytes)
     if ( eof() || _error ) return 0;
 
     fillCacheNonBlocking();
-    if ( _error )
-    {
+    if ( _error ) {
         // I guess an exception would be thrown in this case ?
         log_error("curl adaptor's fillCacheNonBlocking set _error "
-                "rather then throwing an exception");
+                 "rather then throwing an exception");
         return 0; 
     }
 
     std::streamsize actuallyRead = std::fread(dst, 1, bytes, _cache);
-    if ( _running )
-    {
+    if ( _running ) {
         // if we're still running drop any eof flag
         // on the cache
         clearerr(_cache);
@@ -1163,10 +1136,9 @@ CurlStreamFile::seek(std::streampos pos)
     fillCache(pos);
     if (_error) return false; // error can be set by fillCache
 
-    if (_cached < static_cast<size_t>(pos))
-    {
+    if (_cached < static_cast<size_t>(pos)) {
         log_error ("Warning: could not cache anough bytes on seek: %d "
-                "requested, %d cached", pos, _cached);
+                  "requested, %d cached", pos, _cached);
         return false; 
     }
 
@@ -1184,22 +1156,18 @@ void
 CurlStreamFile::go_to_end()
 {
     CURLMcode mcode;
-    while (_running > 0)
-    {
-        do
-        {
+    while (_running > 0) {
+        do {
             mcode=curl_multi_perform(_mhandle, &_running);
         } while ( mcode == CURLM_CALL_MULTI_PERFORM );
 
-        if ( mcode != CURLM_OK )
-        {
+        if ( mcode != CURLM_OK ) {
             throw IOException(curl_multi_strerror(mcode));
         }
-
+       
         long code;
         curl_easy_getinfo(_handle, CURLINFO_RESPONSE_CODE, &code);
-        if (code == 404) // file not found!
-        {
+        if (code == 404) {     // file not found!
             throw IOException("File not found");
         }
 
@@ -1214,8 +1182,7 @@ CurlStreamFile::go_to_end()
 size_t
 CurlStreamFile::size() const
 {
-    if ( ! _size )
-    {
+    if ( ! _size ) {
         double size;
         CURLcode ret = curl_easy_getinfo(_handle,
                 CURLINFO_CONTENT_LENGTH_DOWNLOAD, &size);
@@ -1444,5 +1411,5 @@ NetworkAdapter::reservedNames()
 
 // Local Variables:
 // mode: C++
-// indent-tabs-mode: t
+// indent-tabs-mode: null
 // End:

-----------------------------------------------------------------------

Summary of changes:
 libbase/curl_adapter.cpp |  237 ++++++++++++++++++++--------------------------
 1 files changed, 102 insertions(+), 135 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]