< prev index next >
src/java.desktop/share/native/libfreetype/src/base/ftstream.c
Print this page
*** 1,36 ****
! /***************************************************************************/
! /* */
! /* ftstream.c */
! /* */
! /* I/O stream support (body). */
! /* */
! /* Copyright 2000-2018 by */
! /* David Turner, Robert Wilhelm, and Werner Lemberg. */
! /* */
! /* This file is part of the FreeType project, and may only be used, */
! /* modified, and distributed under the terms of the FreeType project */
! /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
! /* this file you indicate that you have read the license and */
! /* understand and accept it fully. */
! /* */
! /***************************************************************************/
#include <ft2build.h>
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_DEBUG_H
! /*************************************************************************/
! /* */
! /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
! /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
! /* messages during execution. */
! /* */
#undef FT_COMPONENT
! #define FT_COMPONENT trace_stream
FT_BASE_DEF( void )
FT_Stream_OpenMemory( FT_Stream stream,
const FT_Byte* base,
--- 1,36 ----
! /****************************************************************************
! *
! * ftstream.c
! *
! * I/O stream support (body).
! *
! * Copyright (C) 2000-2019 by
! * David Turner, Robert Wilhelm, and Werner Lemberg.
! *
! * This file is part of the FreeType project, and may only be used,
! * modified, and distributed under the terms of the FreeType project
! * license, LICENSE.TXT. By continuing to use, modify, or distribute
! * this file you indicate that you have read the license and
! * understand and accept it fully.
! *
! */
#include <ft2build.h>
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_DEBUG_H
! /**************************************************************************
! *
! * The macro FT_COMPONENT is used in trace mode. It is an implicit
! * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
! * messages during execution.
! */
#undef FT_COMPONENT
! #define FT_COMPONENT stream
FT_BASE_DEF( void )
FT_Stream_OpenMemory( FT_Stream stream,
const FT_Byte* base,
*** 217,233 ****
{
if ( stream && stream->read )
{
FT_Memory memory = stream->memory;
#ifdef FT_DEBUG_MEMORY
ft_mem_free( memory, *pbytes );
- *pbytes = NULL;
#else
FT_FREE( *pbytes );
#endif
}
*pbytes = NULL;
}
FT_BASE_DEF( FT_Error )
--- 217,234 ----
{
if ( stream && stream->read )
{
FT_Memory memory = stream->memory;
+
#ifdef FT_DEBUG_MEMORY
ft_mem_free( memory, *pbytes );
#else
FT_FREE( *pbytes );
#endif
}
+
*pbytes = NULL;
}
FT_BASE_DEF( FT_Error )
*** 236,245 ****
--- 237,248 ----
{
FT_Error error = FT_Err_Ok;
FT_ULong read_bytes;
+ FT_TRACE7(( "FT_Stream_EnterFrame: %ld bytes\n", count ));
+
/* check for nested frame access */
FT_ASSERT( stream && stream->cursor == 0 );
if ( stream->read )
{
*** 279,288 ****
--- 282,292 ----
count, read_bytes ));
FT_FREE( stream->base );
error = FT_THROW( Invalid_Stream_Operation );
}
+
stream->cursor = stream->base;
stream->limit = stream->cursor + count;
stream->pos += read_bytes;
}
else
*** 319,342 ****
/* 0 records, like in some strange kern tables). */
/* */
/* In this case, the loader code handles the 0-length table */
/* gracefully; however, stream.cursor is really set to 0 by the */
/* FT_Stream_EnterFrame() call, and this is not an error. */
! /* */
FT_ASSERT( stream );
if ( stream->read )
{
FT_Memory memory = stream->memory;
#ifdef FT_DEBUG_MEMORY
ft_mem_free( memory, stream->base );
stream->base = NULL;
#else
FT_FREE( stream->base );
#endif
}
stream->cursor = NULL;
stream->limit = NULL;
}
--- 323,350 ----
/* 0 records, like in some strange kern tables). */
/* */
/* In this case, the loader code handles the 0-length table */
/* gracefully; however, stream.cursor is really set to 0 by the */
/* FT_Stream_EnterFrame() call, and this is not an error. */
!
! FT_TRACE7(( "FT_Stream_ExitFrame\n" ));
!
FT_ASSERT( stream );
if ( stream->read )
{
FT_Memory memory = stream->memory;
+
#ifdef FT_DEBUG_MEMORY
ft_mem_free( memory, stream->base );
stream->base = NULL;
#else
FT_FREE( stream->base );
#endif
}
+
stream->cursor = NULL;
stream->limit = NULL;
}
< prev index next >