~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/ngit/NGit/NGit.Util.IO/UnionInputStream.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
174
174
                /// <exception cref="System.IO.IOException"></exception>
175
175
                public override int Read(byte[] b, int off, int len)
176
176
                {
177
 
                        int cnt = 0;
178
 
                        while (0 < len)
 
177
                        if (len == 0)
 
178
                        {
 
179
                                return 0;
 
180
                        }
 
181
                        for (; ; )
179
182
                        {
180
183
                                InputStream @in = Head();
181
184
                                int n = @in.Read(b, off, len);
182
185
                                if (0 < n)
183
186
                                {
184
 
                                        cnt += n;
185
 
                                        off += n;
186
 
                                        len -= n;
 
187
                                        return n;
187
188
                                }
188
189
                                else
189
190
                                {
190
191
                                        if (@in == EOF)
191
192
                                        {
192
 
                                                return 0 < cnt ? cnt : -1;
 
193
                                                return -1;
193
194
                                        }
194
195
                                        else
195
196
                                        {
196
197
                                                Pop();
197
 
                                                if (0 < cnt)
198
 
                                                {
199
 
                                                        break;
200
 
                                                }
201
198
                                        }
202
199
                                }
203
200
                        }
204
 
                        return cnt;
205
201
                }
206
202
 
207
203
                /// <exception cref="System.IO.IOException"></exception>