Subversion Repositories Kolibri OS

Rev

Rev 1693 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1693 Rev 3065
Line 136... Line 136...
136
 
136
 
Line 137... Line 137...
137
  /* Make sure stdio is set up.  */
137
  /* Make sure stdio is set up.  */
Line 138... Line -...
138
 
-
 
139
  CHECK_INIT (ptr, fp);
138
 
Line 140... Line 139...
140
 
139
  CHECK_INIT (ptr, fp);
141
  __sfp_lock_acquire ();
140
 
Line 154... Line 153...
154
 
153
 
155
  if ((seekfn = fp->_seek) == NULL)
154
  if ((seekfn = fp->_seek) == NULL)
156
    {
155
    {
157
      ptr->_errno = ESPIPE;	/* ??? */
156
      ptr->_errno = ESPIPE;	/* ??? */
158
      _funlockfile (fp);
-
 
159
      __sfp_lock_release ();
157
      _funlockfile (fp);
160
      return EOF;
158
      return EOF;
Line 161... Line 159...
161
    }
159
    }
162
 
160
 
Line 180... Line 178...
180
	{
178
	{
181
	  curoff = seekfn (ptr, fp->_cookie, (_fpos_t) 0, SEEK_CUR);
179
	  curoff = seekfn (ptr, fp->_cookie, (_fpos_t) 0, SEEK_CUR);
182
	  if (curoff == -1L)
180
	  if (curoff == -1L)
183
	    {
181
	    {
184
	      _funlockfile (fp);
182
	      _funlockfile (fp);
185
	      __sfp_lock_release ();
-
 
186
	      return EOF;
183
	      return EOF;
187
	    }
184
	    }
188
	}
185
	}
189
      if (fp->_flags & __SRD)
186
      if (fp->_flags & __SRD)
190
	{
187
	{
Line 206... Line 203...
206
      break;
203
      break;
Line 207... Line 204...
207
 
204
 
208
    default:
205
    default:
209
      ptr->_errno = EINVAL;
206
      ptr->_errno = EINVAL;
210
      _funlockfile (fp);
-
 
211
      __sfp_lock_release ();
207
      _funlockfile (fp);
212
      return (EOF);
208
      return (EOF);
Line 213... Line 209...
213
    }
209
    }
214
 
210
 
Line 266... Line 262...
266
    }
262
    }
267
  if ((long)target != target)
263
  if ((long)target != target)
268
    {
264
    {
269
      ptr->_errno = EOVERFLOW;
265
      ptr->_errno = EOVERFLOW;
270
      _funlockfile (fp);
266
      _funlockfile (fp);
271
      __sfp_lock_release ();
-
 
272
      return EOF;
267
      return EOF;
273
    }
268
    }
Line 274... Line 269...
274
 
269
 
275
  if (!havepos)
270
  if (!havepos)
Line 323... Line 318...
323
      if (HASUB (fp))
318
      if (HASUB (fp))
324
	FREEUB (ptr, fp);
319
	FREEUB (ptr, fp);
325
      fp->_flags &= ~__SEOF;
320
      fp->_flags &= ~__SEOF;
326
      memset (&fp->_mbstate, 0, sizeof (_mbstate_t));
321
      memset (&fp->_mbstate, 0, sizeof (_mbstate_t));
327
      _funlockfile (fp);
322
      _funlockfile (fp);
328
      __sfp_lock_release ();
-
 
329
      return 0;
323
      return 0;
330
    }
324
    }
Line 331... Line 325...
331
 
325
 
332
  /*
326
  /*
Line 354... Line 348...
354
      fp->_p += n;
348
      fp->_p += n;
355
      fp->_r -= n;
349
      fp->_r -= n;
356
    }
350
    }
357
  memset (&fp->_mbstate, 0, sizeof (_mbstate_t));
351
  memset (&fp->_mbstate, 0, sizeof (_mbstate_t));
358
  _funlockfile (fp);
352
  _funlockfile (fp);
359
  __sfp_lock_release ();
-
 
360
  return 0;
353
  return 0;
Line 361... Line 354...
361
 
354
 
362
  /*
355
  /*
363
   * We get here if we cannot optimise the seek ... just
356
   * We get here if we cannot optimise the seek ... just
Line 367... Line 360...
367
dumb:
360
dumb:
368
  if (_fflush_r (ptr, fp)
361
  if (_fflush_r (ptr, fp)
369
      || seekfn (ptr, fp->_cookie, offset, whence) == POS_ERR)
362
      || seekfn (ptr, fp->_cookie, offset, whence) == POS_ERR)
370
    {
363
    {
371
      _funlockfile (fp);
364
      _funlockfile (fp);
372
      __sfp_lock_release ();
-
 
373
      return EOF;
365
      return EOF;
374
    }
366
    }
375
  /* success: clear EOF indicator and discard ungetc() data */
367
  /* success: clear EOF indicator and discard ungetc() data */
376
  if (HASUB (fp))
368
  if (HASUB (fp))
377
    FREEUB (ptr, fp);
369
    FREEUB (ptr, fp);
Line 386... Line 378...
386
     optimization is then allowed if no subsequent flush
378
     optimization is then allowed if no subsequent flush
387
     is performed.  */
379
     is performed.  */
388
  fp->_flags &= ~__SNPT;
380
  fp->_flags &= ~__SNPT;
389
  memset (&fp->_mbstate, 0, sizeof (_mbstate_t));
381
  memset (&fp->_mbstate, 0, sizeof (_mbstate_t));
390
  _funlockfile (fp);
382
  _funlockfile (fp);
391
  __sfp_lock_release ();
-
 
392
  return 0;
383
  return 0;
393
}
384
}
Line 394... Line 385...
394
 
385