Unverified Commit 4c718f7b by alanminko Committed by GitHub

Merge pull request #218 from seccipon/master

1. Fix bug (using pDesign without check if == NULL) 2. Switch type of variables containing file size to (int => long)
parents 7f22cc07 d785775f
...@@ -548,10 +548,10 @@ typedef struct buflist { ...@@ -548,10 +548,10 @@ typedef struct buflist {
struct buflist * next; struct buflist * next;
} buflist; } buflist;
char * Io_MvLoadFileBz2( char * pFileName, int * pnFileSize ) char * Io_MvLoadFileBz2( char * pFileName, long * pnFileSize )
{ {
FILE * pFile; FILE * pFile;
int nFileSize = 0; long nFileSize = 0;
char * pContents; char * pContents;
BZFILE * b; BZFILE * b;
int bzError, RetValue; int bzError, RetValue;
...@@ -628,12 +628,12 @@ char * Io_MvLoadFileBz2( char * pFileName, int * pnFileSize ) ...@@ -628,12 +628,12 @@ char * Io_MvLoadFileBz2( char * pFileName, int * pnFileSize )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
static char * Io_MvLoadFileGz( char * pFileName, int * pnFileSize ) static char * Io_MvLoadFileGz( char * pFileName, long * pnFileSize )
{ {
const int READ_BLOCK_SIZE = 100000; const int READ_BLOCK_SIZE = 100000;
gzFile pFile; gzFile pFile;
char * pContents; 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 pFile = gzopen( pFileName, "rb" ); // if pFileName doesn't end in ".gz" then this acts as a passthrough to fopen
pContents = ABC_ALLOC( char, nFileSize ); pContents = ABC_ALLOC( char, nFileSize );
readBlock = 0; readBlock = 0;
...@@ -665,7 +665,7 @@ static char * Io_MvLoadFileGz( char * pFileName, int * pnFileSize ) ...@@ -665,7 +665,7 @@ static char * Io_MvLoadFileGz( char * pFileName, int * pnFileSize )
static char * Io_MvLoadFile( char * pFileName ) static char * Io_MvLoadFile( char * pFileName )
{ {
FILE * pFile; FILE * pFile;
int nFileSize; long nFileSize;
char * pContents; char * pContents;
int RetValue; int RetValue;
if ( !strncmp(pFileName+strlen(pFileName)-4,".bz2",4) ) 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 ...@@ -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" ); fprintf( stdout, "Reading network from file has failed.\n" );
return NULL; return NULL;
} }
if ( fCheck && (Abc_NtkBlackboxNum(pNtk) || Abc_NtkWhiteboxNum(pNtk)) )
if ( fCheck && (Abc_NtkBlackboxNum(pNtk) || Abc_NtkWhiteboxNum(pNtk)) && pNtk->pDesign )
{ {
int i, fCycle = 0; int i, fCycle = 0;
Abc_Ntk_t * pModel; Abc_Ntk_t * pModel;
// fprintf( stdout, "Warning: The network contains hierarchy.\n" ); // fprintf( stdout, "Warning: The network contains hierarchy.\n" );
......
...@@ -60,7 +60,8 @@ Vec_Ptr_t * Sim_UtilInfoAlloc( int nSize, int nWords, int fClean ) ...@@ -60,7 +60,8 @@ Vec_Ptr_t * Sim_UtilInfoAlloc( int nSize, int nWords, int fClean )
int i; int i;
assert( nSize > 0 && nWords > 0 ); assert( nSize > 0 && nWords > 0 );
vInfo = Vec_PtrAlloc( nSize ); 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 ) if ( fClean )
memset( vInfo->pArray[0], 0, sizeof(unsigned) * nSize * nWords ); memset( vInfo->pArray[0], 0, sizeof(unsigned) * nSize * nWords );
for ( i = 1; i < nSize; i++ ) 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