… | |
… | |
199 | |
199 | |
200 | if (facedata *d = face_data (ix.idx, faceset)) |
200 | if (facedata *d = face_data (ix.idx, faceset)) |
201 | { |
201 | { |
202 | if (fxix) |
202 | if (fxix) |
203 | { |
203 | { |
204 | // 9 bytes is enough for fx_FFFOOO, 40 leaves some room for image data |
204 | // only transfer something if the amount of data transferred |
|
|
205 | // has a healthy relation to the header overhead |
|
|
206 | if (avail <= 40) |
|
|
207 | break; |
|
|
208 | |
|
|
209 | // 9 bytes is enough for fx_FFFOOO |
205 | int chunk = min (min (avail - 40, MAXSOCKBUF - 9), ix.ofs); |
210 | int chunk = min (min (avail, MAXSOCKBUF - 9), (int)ix.ofs); |
206 | |
211 | |
207 | if (chunk <= 0) |
212 | if (chunk <= 0) |
208 | break; |
213 | break; |
209 | |
214 | |
210 | ix.ofs -= chunk; |
215 | ix.ofs -= chunk; |
… | |
… | |
224 | } |
229 | } |
225 | } |
230 | } |
226 | else |
231 | else |
227 | ix.ofs = 0; |
232 | ix.ofs = 0; |
228 | |
233 | |
229 | int consumed = ol - outputbuffer_len (); |
234 | int consumed = outputbuffer_len () - ol; |
230 | |
235 | |
231 | avail -= consumed; |
236 | avail -= consumed; |
232 | rate_avail -= consumed; |
237 | rate_avail -= consumed; |
233 | |
238 | |
234 | ol = outputbuffer_len (); |
239 | ol = outputbuffer_len (); |
235 | |
240 | |
236 | if (!ix.ofs) |
241 | if (!ix.ofs) |
237 | { |
242 | { |
238 | ixface.pop_back (); |
243 | ixface.pop_back (); |
|
|
244 | |
239 | if (ixface.empty ()) |
245 | if (ixface.empty ()) |
240 | break; |
246 | break; |
241 | } |
247 | } |
242 | } |
248 | } |
243 | } |
249 | } |