Show
Ignore:
Timestamp:
03/21/12 18:36:20 (3 years ago)
Author:
robert
Message:

Ran script to remove trailing spaces and tabs

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/curl/ReaderWriterCURL.cpp

    r12916 r13041  
    1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield  
     1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield 
    22 * 
    3  * This library is open source and may be redistributed and/or modified under   
    4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or  
     3 * This library is open source and may be redistributed and/or modified under 
     4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
    55 * (at your option) any later version.  The full license is in LICENSE file 
    66 * included with this distribution, and on the openscenegraph.org website. 
    7  *  
     7 * 
    88 * This library is distributed in the hope that it will be useful, 
    99 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
     10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1111 * OpenSceneGraph Public License for more details. 
    1212*/ 
     
    4040// 
    4141//  StreamObject 
    42 //     
     42// 
    4343EasyCurl::StreamObject::StreamObject(std::ostream* outputStream, std::istream* inputStream, const std::string& cacheFileName): 
    4444    _outputStream(outputStream), 
     
    9898    // otherwise just return url assuming it has a filename at the end. 
    9999    // Typically, uploading will require cooperation with a server side 
    100     // script that requires parameters such as filename and/or session  
    101     // and/or authentication information, so in general the filename  
     100    // script that requires parameters such as filename and/or session 
     101    // and/or authentication information, so in general the filename 
    102102    // can not be assumed to be at the tail of the URL. 
    103103    std::string::size_type pos = url.find('?'); 
     
    120120    return fileName; 
    121121} 
    122      
     122 
    123123size_t EasyCurl::StreamMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data) 
    124124{ 
     
    139139{ 
    140140    OSG_INFO<<"EasyCurl::EasyCurl()"<<std::endl; 
    141      
     141 
    142142    _previousHttpAuthentication = 0; 
    143143    _connectTimeout = 0; // no timeout by default. 
     
    146146    _curl = curl_easy_init(); 
    147147 
    148     curl_easy_setopt(_curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");             
     148    curl_easy_setopt(_curl, CURLOPT_USERAGENT, "libcurl-agent/1.0"); 
    149149    curl_easy_setopt(_curl, CURLOPT_WRITEFUNCTION, StreamMemoryCallback); 
    150150    curl_easy_setopt(_curl, CURLOPT_FOLLOWLOCATION, 1L); 
     
    193193 
    194194    // Construct "multipart/form-data" (RFC 1867) form elements for file upload. 
    195     struct curl_httppost* post = NULL;   
    196     struct curl_httppost* last = NULL;   
    197     curl_formadd(&post, &last,  
    198         CURLFORM_COPYNAME, "upload",  
     195    struct curl_httppost* post = NULL; 
     196    struct curl_httppost* last = NULL; 
     197    curl_formadd(&post, &last, 
     198        CURLFORM_COPYNAME, "upload", 
    199199        CURLFORM_CONTENTTYPE, mimeType.c_str(), 
    200         CURLFORM_BUFFER, uploadFileName.c_str(),  
    201         CURLFORM_BUFFERPTR, postedContent,  
    202         CURLFORM_BUFFERLENGTH, contentLength,  
    203         CURLFORM_END);  
     200        CURLFORM_BUFFER, uploadFileName.c_str(), 
     201        CURLFORM_BUFFERPTR, postedContent, 
     202        CURLFORM_BUFFERLENGTH, contentLength, 
     203        CURLFORM_END); 
    204204 
    205205    // Tell curl to use HTTP POST to send the form data. 
     
    208208    CURLcode responseCode = curl_easy_perform(_curl); 
    209209 
    210     if (post) curl_formfree(post);  
     210    if (post) curl_formfree(post); 
    211211    if (postedContent) free(postedContent); 
    212212    curl_easy_setopt(_curl, CURLOPT_HTTPPOST, (void *)0); 
     
    234234void EasyCurl::setOptions(const std::string& proxyAddress, const std::string& fileName, StreamObject& sp, const osgDB::ReaderWriter::Options *options) 
    235235{ 
    236     const osgDB::AuthenticationMap* authenticationMap = (options && options->getAuthenticationMap()) ?  
     236    const osgDB::AuthenticationMap* authenticationMap = (options && options->getAuthenticationMap()) ? 
    237237            options->getAuthenticationMap() : 
    238238            osgDB::Registry::instance()->getAuthenticationMap(); 
     
    257257        0; 
    258258 
    259     // configure/reset authentication if required.         
     259    // configure/reset authentication if required. 
    260260    if (details) 
    261261    { 
     
    270270#if LIBCURL_VERSION_NUM >= 0x070a07 
    271271        if (details->httpAuthentication != _previousHttpAuthentication) 
    272         {  
    273             curl_easy_setopt(_curl, CURLOPT_HTTPAUTH, details->httpAuthentication);  
     272        { 
     273            curl_easy_setopt(_curl, CURLOPT_HTTPAUTH, details->httpAuthentication); 
    274274            _previousHttpAuthentication = details->httpAuthentication; 
    275275        } 
     
    289289        if (_previousHttpAuthentication!=0) 
    290290        { 
    291             curl_easy_setopt(_curl, CURLOPT_HTTPAUTH, 0);  
     291            curl_easy_setopt(_curl, CURLOPT_HTTPAUTH, 0); 
    292292            _previousHttpAuthentication = 0; 
    293293        } 
     
    312312        else 
    313313        { 
    314             curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &code);                     
     314            curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &code); 
    315315        } 
    316316 
     
    430430    easyCurl.setConnectionTimeout(connectTimeout); 
    431431    easyCurl.setTimeout(timeout); 
    432      
     432 
    433433    // Output requestBuffer via curl, and return responseBuffer in message of result. 
    434434    return easyCurl.write(proxyAddress, fullFileName, sp, options); 
     
    455455        std::istringstream iss(options->getOptionString()); 
    456456        std::string opt, optProxy, optProxyPort; 
    457         while (iss >> opt)  
     457        while (iss >> opt) 
    458458        { 
    459459            int index = opt.find( "=" ); 
     
    527527    long timeout = 0; 
    528528    getConnectionOptions(options, proxyAddress, connectTimeout, timeout); 
    529      
     529 
    530530    bool uncompress = false; 
    531      
     531 
    532532    if (ext=="gz" || ext=="osgz" || ext=="ivez") 
    533533    { 
    534534        OSG_INFO<<"CURL: Compressed file type "<<ext<<std::endl; 
    535          
     535 
    536536        #ifndef USE_ZLIB 
    537537            // don't have zlib so can't compile compressed formats 
    538538            return ReadResult::FILE_NOT_HANDLED; 
    539539        #endif 
    540          
     540 
    541541        uncompress = true; 
    542          
     542 
    543543        if (ext=="gz") 
    544544        { 
    545545            ext = osgDB::getFileExtension(osgDB::getNameLessExtension(fileName)); 
    546         }  
     546        } 
    547547        else if (ext=="osgz") 
    548548        { 
     
    556556        OSG_INFO<<"CURL: assuming file type "<<ext<<std::endl; 
    557557    } 
    558      
     558 
    559559    std::stringstream buffer; 
    560560 
    561561    EasyCurl::StreamObject sp(&buffer, NULL, std::string()); 
    562562    EasyCurl& easyCurl = getEasyCurl(); 
    563      
     563 
    564564    // setup the timeouts: 
    565565    easyCurl.setConnectionTimeout(connectTimeout); 
     
    589589        } 
    590590 
    591         // If there is still no reader, fail.         
     591        // If there is still no reader, fail. 
    592592        if ( !reader ) 
    593593        { 
     
    596596        } 
    597597 
    598         osg::ref_ptr<Options> local_opt = options ?  
    599             static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) :  
     598        osg::ref_ptr<Options> local_opt = options ? 
     599            static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : 
    600600            new Options; 
    601601 
     
    613613                return ReadResult::FILE_NOT_HANDLED; 
    614614            } 
    615              
     615 
    616616            buffer.str(uncompressed); 
    617617        } 
    618          
     618 
    619619        ReadResult readResult = readFile(objectType, reader, buffer, local_opt.get() ); 
    620620 
     
    686686 
    687687            destination.append((char*)out, have); 
    688              
     688 
    689689        } while (strm.avail_out == 0); 
    690690