Eeschema: Fix off-by-one in saving bitmaps

This commit is contained in:
Jean-Noel Avila 2016-11-09 09:46:35 +01:00 committed by jean-pierre charras
parent 66aee09388
commit 58af5bc3a4
2 changed files with 3 additions and 4 deletions

View File

@ -107,9 +107,8 @@ bool BITMAP_BASE::SaveData( FILE* aFile ) const
// Write binary data in hexadecimal form (ASCII)
wxStreamBuffer* buffer = stream.GetOutputStreamBuffer();
char* begin = (char*) buffer->GetBufferStart();
int ii;
for( ii = 0; begin <= buffer->GetBufferEnd(); begin++, ii++ )
for( int ii = 0; begin < buffer->GetBufferEnd(); begin++, ii++ )
{
if( ii >= 32 )
{
@ -140,7 +139,7 @@ void BITMAP_BASE::SaveData( wxArrayString& aPngStrings ) const
char* begin = (char*) buffer->GetBufferStart();
wxString line;
for( int ii = 0; begin <= buffer->GetBufferEnd(); begin++, ii++ )
for( int ii = 0; begin < buffer->GetBufferEnd(); begin++, ii++ )
{
if( ii >= 32 )
{

View File

@ -1707,7 +1707,7 @@ void SCH_LEGACY_PLUGIN::saveBitmap( SCH_BITMAP* aBitmap )
wxStreamBuffer* buffer = stream.GetOutputStreamBuffer();
char* begin = (char*) buffer->GetBufferStart();
for( int ii = 0; begin <= buffer->GetBufferEnd(); begin++, ii++ )
for( int ii = 0; begin < buffer->GetBufferEnd(); begin++, ii++ )
{
if( ii >= 32 )
{