mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-30 02:14:45 +08:00
transfer.c (write_block): Add test for end-of-file condition, removed from mem_alloc_w_at.
2005-10-07 Jerry DeLisle <jvdelisle@verizon.net> * io/transfer.c (write_block): Add test for end-of-file condition, removed from mem_alloc_w_at. (next_record_w): Clean up checks for NULL pointer returns from s_alloc_w. * io/unix.c (mem_alloc_w_at): Remove call to generate_error end-of-file. * io/write.c (write_float): Add checks for NULL pointer returns from write_block calls. (write_integer): Same. From-SVN: r105092
This commit is contained in:
parent
3e352c00e1
commit
aed6ee2453
@ -1,3 +1,12 @@
|
||||
2005-10-07 Jerry DeLisle <jvdelisle@verizon.net>
|
||||
|
||||
* io/transfer.c (write_block): Add test for end-of-file condition,
|
||||
removed from mem_alloc_w_at. (next_record_w): Clean up checks for
|
||||
NULL pointer returns from s_alloc_w.
|
||||
* io/unix.c (mem_alloc_w_at): Remove call to generate_error end-of-file.
|
||||
* io/write.c (write_float): Add checks for NULL pointer returns from
|
||||
write_block calls. (write_integer): Same.
|
||||
|
||||
2005-10-03 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* runtime/memory.c (allocate_size): Malloc 1 byte if size == 0.
|
||||
|
@ -305,6 +305,12 @@ write_block (int length)
|
||||
current_unit->bytes_left -= (gfc_offset)length;
|
||||
dest = salloc_w (current_unit->s, &length);
|
||||
|
||||
if (dest == NULL)
|
||||
{
|
||||
generate_error (ERROR_END, NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ioparm.size != NULL)
|
||||
*ioparm.size += length;
|
||||
|
||||
@ -1559,16 +1565,20 @@ next_record_w (void)
|
||||
{
|
||||
bytes_left = (int) current_unit->bytes_left;
|
||||
p = salloc_w (current_unit->s, &bytes_left);
|
||||
if (p != NULL)
|
||||
if (p == NULL)
|
||||
{
|
||||
generate_error (ERROR_END, NULL);
|
||||
return;
|
||||
}
|
||||
memset(p, ' ', bytes_left);
|
||||
current_unit->bytes_left = current_unit->recl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
length = 1;
|
||||
p = salloc_w (current_unit->s, &length);
|
||||
if (p==NULL)
|
||||
goto io_error;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -630,10 +630,7 @@ mem_alloc_w_at (unix_stream * s, int *len, gfc_offset where)
|
||||
return NULL;
|
||||
|
||||
if (m > s->file_length)
|
||||
{
|
||||
generate_error (ERROR_END, NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s->logical_offset = m;
|
||||
|
||||
|
@ -832,6 +832,8 @@ write_float (fnode *f, const char *source, int len)
|
||||
|
||||
if (nb == 0) nb = 4;
|
||||
p = write_block (nb);
|
||||
if (p == NULL)
|
||||
return;
|
||||
if (nb < 3)
|
||||
{
|
||||
memset (p, '*',nb);
|
||||
@ -903,6 +905,8 @@ write_float (fnode *f, const char *source, int len)
|
||||
if (nb > 0)
|
||||
{
|
||||
p = write_block (nb);
|
||||
if (p == NULL)
|
||||
return;
|
||||
memset (p, ' ', nb);
|
||||
}
|
||||
}
|
||||
@ -1277,6 +1281,8 @@ write_integer (const char *source, int length)
|
||||
if(width < digits )
|
||||
width = digits ;
|
||||
p = write_block (width) ;
|
||||
if (p == NULL)
|
||||
return;
|
||||
if (no_leading_blank)
|
||||
{
|
||||
memcpy (p, q, digits);
|
||||
|
Loading…
Reference in New Issue
Block a user