~ubuntu-branches/debian/squeeze/kdesvn/squeeze

« back to all changes in this revision

Viewing changes to src/svnqt/svnstream.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2009-02-19 16:20:26 UTC
  • mfrom: (1.3.1 upstream) (8.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090219162026-p0nvkburr0ta23e6
Tags: 1.2.4-1
* New upstream release.
  - Reduced debug output on stderr. Closes: #431616

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
class SVNQT_NOEXPORT SvnStream_private
37
37
{
38
38
public:
39
 
    SvnStream_private(){m_Stream=0;m_LastError="";_context=0;cancel_timeout.start();}
40
 
    ~SvnStream_private(){qDebug("Time elapsed: %i ",cancel_timeout.elapsed());}
 
39
    SvnStream_private(){m_Stream=0;m_LastError="";_context=0;/*cancel_timeout.start();*/}
 
40
    ~SvnStream_private(){/*qDebug("Time elapsed: %i ",cancel_timeout.elapsed());*/}
41
41
 
42
42
    static svn_error_t * stream_write(void*baton,const char*data,apr_size_t*len);
43
43
    static svn_error_t * stream_read(void*baton,char*data,apr_size_t*len);
75
75
    svn_client_ctx_t*ctx = b->context();
76
76
 
77
77
    if (ctx&&ctx->cancel_func&&b->cancelElapsed()>50) {
78
 
        qDebug("Check cancel");
 
78
        //qDebug("Check cancel");
79
79
        SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
80
80
        b->cancelTimeReset();
81
81
    }
153
153
    m_Data->m_LastError = aError;
154
154
}
155
155
 
156
 
#if QT_VERSION < 0x040000
157
 
void SvnStream::setError(int ioError)const
158
 
{
159
 
   switch (ioError) {
160
 
       case IO_Ok:
161
 
            setError("Operation was successfull.");
162
 
            break;
163
 
        case IO_ReadError:
164
 
            setError("Could not read from device");
165
 
            break;
166
 
        case IO_WriteError:
167
 
            setError("Could not write to device");
168
 
            break;
169
 
        case IO_FatalError:
170
 
            setError("A fatal unrecoverable error occurred.");
171
 
            break;
172
 
        case IO_OpenError:
173
 
            setError("Could not open device or stream.");
174
 
            break;
175
 
        case IO_AbortError:
176
 
            setError("The operation was unexpectedly aborted.");
177
 
            break;
178
 
        case IO_TimeOutError:
179
 
            setError("The operation timed out.");
180
 
            break;
181
 
        case IO_UnspecifiedError:
182
 
            setError("An unspecified error happened on close.");
183
 
            break;
184
 
        default:
185
 
            setError("Unknown error happend.");
186
 
            break;
187
 
    }
188
 
}
189
 
#endif
190
 
 
191
156
class SvnByteStream_private {
192
157
public:
193
158
    SvnByteStream_private();
197
162
    QBuffer mBuf;
198
163
};
199
164
 
200
 
#if QT_VERSION < 0x040000
201
 
SvnByteStream_private::SvnByteStream_private()
202
 
    :mBuf(m_Content)
203
 
{
204
 
    mBuf.open(IO_WriteOnly);
205
 
}
206
 
#else
207
165
SvnByteStream_private::SvnByteStream_private()
208
166
    :mBuf(&m_Content, 0)
209
167
{
210
168
    mBuf.open(QFile::WriteOnly);
211
169
}
212
 
#endif
213
170
 
214
171
/* ByteStream implementation start */
215
172
SvnByteStream::SvnByteStream(svn_client_ctx_t * ctx)
217
174
{
218
175
    m_ByteData = new SvnByteStream_private;
219
176
    if (!m_ByteData->mBuf.isOpen()) {
220
 
#if QT_VERSION < 0x040000
221
 
        setError(m_ByteData->mBuf.status());
222
 
#else
223
177
        setError(m_ByteData->mBuf.errorString());
224
 
#endif
225
178
    }
226
179
}
227
180
 
232
185
 
233
186
long SvnByteStream::write(const char*aData,const unsigned long max)
234
187
{
235
 
#if QT_VERSION < 0x040000
236
 
    long i = m_ByteData->mBuf.writeBlock(aData,max);
237
 
    if (i<0) {
238
 
        setError(m_ByteData->mBuf.status());
239
 
    }
240
 
#else
241
188
    long i = m_ByteData->mBuf.write(aData,max);
242
189
    if (i<0) {
243
190
        setError(m_ByteData->mBuf.errorString());
244
191
    }
245
 
#endif
246
192
    return i;
247
193
}
248
194