Commit d785775f by Andrey Rogov

1. Fix bug (using pDesign without check if == NULL)

2. Switch type of variables containing file size to (int => long)
parent b4170615
......@@ -548,10 +548,10 @@ typedef struct buflist {
struct buflist * next;
} buflist;
char * Io_MvLoadFileBz2( char * pFileName, int * pnFileSize )
char * Io_MvLoadFileBz2( char * pFileName, long * pnFileSize )
{
FILE * pFile;
int nFileSize = 0;
long nFileSize = 0;
char * pContents;
BZFILE * b;
int bzError, RetValue;
......@@ -628,12 +628,12 @@ char * Io_MvLoadFileBz2( char * pFileName, int * pnFileSize )
SeeAlso []
***********************************************************************/
static char * Io_MvLoadFileGz( char * pFileName, int * pnFileSize )
static char * Io_MvLoadFileGz( char * pFileName, long * pnFileSize )
{
const int READ_BLOCK_SIZE = 100000;
gzFile pFile;
char * pContents;
int amtRead, readBlock, nFileSize = READ_BLOCK_SIZE;
long amtRead, readBlock, nFileSize = READ_BLOCK_SIZE;
pFile = gzopen( pFileName, "rb" ); // if pFileName doesn't end in ".gz" then this acts as a passthrough to fopen
pContents = ABC_ALLOC( char, nFileSize );
readBlock = 0;
......@@ -665,7 +665,7 @@ static char * Io_MvLoadFileGz( char * pFileName, int * pnFileSize )
static char * Io_MvLoadFile( char * pFileName )
{
FILE * pFile;
int nFileSize;
long nFileSize;
char * pContents;
int RetValue;
if ( !strncmp(pFileName+strlen(pFileName)-4,".bz2",4) )
......
......@@ -157,8 +157,10 @@ Abc_Ntk_t * Io_ReadNetlist( char * pFileName, Io_FileType_t FileType, int fCheck
fprintf( stdout, "Reading network from file has failed.\n" );
return NULL;
}
if ( fCheck && (Abc_NtkBlackboxNum(pNtk) || Abc_NtkWhiteboxNum(pNtk)) )
if ( fCheck && (Abc_NtkBlackboxNum(pNtk) || Abc_NtkWhiteboxNum(pNtk)) && pNtk->pDesign )
{
int i, fCycle = 0;
Abc_Ntk_t * pModel;
// fprintf( stdout, "Warning: The network contains hierarchy.\n" );
......
......@@ -60,7 +60,8 @@ Vec_Ptr_t * Sim_UtilInfoAlloc( int nSize, int nWords, int fClean )
int i;
assert( nSize > 0 && nWords > 0 );
vInfo = Vec_PtrAlloc( nSize );
vInfo->pArray[0] = ABC_ALLOC( unsigned, nSize * nWords );
vInfo->pArray[0] = ABC_ALLOC( unsigned, (long)nSize * (long)nWords );
assert( vInfo->pArray[0]);
if ( fClean )
memset( vInfo->pArray[0], 0, sizeof(unsigned) * nSize * nWords );
for ( i = 1; i < nSize; i++ )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment