A number of other corrections around CalmaFullDump, which had
mistakenly recast the input file routines from zlib back to stdio; only the output file routines should have been changed.
This commit is contained in:
parent
b643f44659
commit
0c38707542
|
|
@ -588,14 +588,14 @@ calmaDumpStructure(def, outf, calmaDefHash, filename)
|
||||||
int datatype;
|
int datatype;
|
||||||
|
|
||||||
READI2(nbytes);
|
READI2(nbytes);
|
||||||
if (feof(calmaInputFile))
|
if (FEOF(calmaInputFile))
|
||||||
{
|
{
|
||||||
/* Unexpected end-of-file */
|
/* Unexpected end-of-file */
|
||||||
fseek(calmaInputFile, -(CALMAHEADERLENGTH), SEEK_END);
|
FSEEK(calmaInputFile, -(CALMAHEADERLENGTH), SEEK_END);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rtype = getc(calmaInputFile);
|
rtype = FGETC(calmaInputFile);
|
||||||
datatype = getc(calmaInputFile);
|
datatype = FGETC(calmaInputFile);
|
||||||
switch (rtype) {
|
switch (rtype) {
|
||||||
case CALMA_BGNSTR:
|
case CALMA_BGNSTR:
|
||||||
UNREADRH(nbytes, rtype);
|
UNREADRH(nbytes, rtype);
|
||||||
|
|
@ -642,7 +642,7 @@ calmaDumpStructure(def, outf, calmaDefHash, filename)
|
||||||
while (nbytes-- > 0)
|
while (nbytes-- > 0)
|
||||||
{
|
{
|
||||||
int byte;
|
int byte;
|
||||||
if ((byte = getc(calmaInputFile)) < 0)
|
if ((byte = FGETC(calmaInputFile)) < 0)
|
||||||
{
|
{
|
||||||
TxError("End of file with %d bytes remaining to be read.\n",
|
TxError("End of file with %d bytes remaining to be read.\n",
|
||||||
nbytes);
|
nbytes);
|
||||||
|
|
@ -682,7 +682,7 @@ syntaxerror:
|
||||||
void
|
void
|
||||||
calmaFullDump(def, fi, outf, filename)
|
calmaFullDump(def, fi, outf, filename)
|
||||||
CellDef *def;
|
CellDef *def;
|
||||||
FILE *fi;
|
FILETYPE fi;
|
||||||
FILE *outf;
|
FILE *outf;
|
||||||
char *filename;
|
char *filename;
|
||||||
{
|
{
|
||||||
|
|
@ -702,8 +702,8 @@ calmaFullDump(def, fi, outf, filename)
|
||||||
|
|
||||||
HashInit(&calmaDefHash, 32, 0);
|
HashInit(&calmaDefHash, 32, 0);
|
||||||
|
|
||||||
calmaInputFile = fi;
|
|
||||||
cifReadCellDef = def;
|
cifReadCellDef = def;
|
||||||
|
calmaInputFile = fi;
|
||||||
|
|
||||||
/* Read and ignore the GDS-II header */
|
/* Read and ignore the GDS-II header */
|
||||||
|
|
||||||
|
|
@ -771,7 +771,7 @@ calmaFullDump(def, fi, outf, filename)
|
||||||
else
|
else
|
||||||
HashSetValue(he, StrDup(NULL, ""));
|
HashSetValue(he, StrDup(NULL, ""));
|
||||||
|
|
||||||
while (calmaDumpStructure(def, outf, &calmaDefHash, filename))
|
while (calmaDumpStructure(def, fi, outf, &calmaDefHash, filename))
|
||||||
if (SigInterruptPending)
|
if (SigInterruptPending)
|
||||||
goto done;
|
goto done;
|
||||||
calmaSkipExact(CALMA_ENDLIB);
|
calmaSkipExact(CALMA_ENDLIB);
|
||||||
|
|
@ -949,7 +949,7 @@ calmaProcessDef(def, outf, do_library)
|
||||||
dlong cval;
|
dlong cval;
|
||||||
int namelen;
|
int namelen;
|
||||||
char *modName;
|
char *modName;
|
||||||
FILE *fi;
|
FILETYPE fi;
|
||||||
|
|
||||||
/* Handle compressed files */
|
/* Handle compressed files */
|
||||||
|
|
||||||
|
|
@ -980,10 +980,10 @@ calmaProcessDef(def, outf, do_library)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use PaOpen() so the paths searched are the same as were */
|
/* Use PaZOpen() so the paths searched are the same as were */
|
||||||
/* searched to find the .mag file that indicated this GDS file. */
|
/* searched to find the .mag file that indicated this GDS file. */
|
||||||
|
|
||||||
fi = PaOpen(modName, "r", "", Path, CellLibPath, &retfilename);
|
fi = PaZOpen(modName, "r", "", Path, CellLibPath, &retfilename);
|
||||||
if (fi == NULL)
|
if (fi == NULL)
|
||||||
{
|
{
|
||||||
/* This is a rare error, but if the subcell is inside */
|
/* This is a rare error, but if the subcell is inside */
|
||||||
|
|
@ -1022,7 +1022,7 @@ calmaProcessDef(def, outf, do_library)
|
||||||
if (he == NULL)
|
if (he == NULL)
|
||||||
calmaFullDump(def, fi, outf, retfilename);
|
calmaFullDump(def, fi, outf, retfilename);
|
||||||
|
|
||||||
fclose(fi);
|
FCLOSE(fi);
|
||||||
def->cd_flags |= CDVENDORGDS;
|
def->cd_flags |= CDVENDORGDS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1060,12 +1060,12 @@ calmaProcessDef(def, outf, do_library)
|
||||||
if (strlen(def->cd_name) & 0x1) structstart--;
|
if (strlen(def->cd_name) & 0x1) structstart--;
|
||||||
structstart -= 2;
|
structstart -= 2;
|
||||||
|
|
||||||
fseek(fi, structstart, SEEK_SET);
|
FSEEK(fi, structstart, SEEK_SET);
|
||||||
|
|
||||||
/* Read the structure name and check against the CellDef name */
|
/* Read the structure name and check against the CellDef name */
|
||||||
defsize = (size_t)(cellstart - structstart);
|
defsize = (size_t)(cellstart - structstart);
|
||||||
buffer = (char *)mallocMagic(defsize + 1);
|
buffer = (char *)mallocMagic(defsize + 1);
|
||||||
numbytes = fread(buffer, sizeof(char), (size_t)defsize, fi);
|
numbytes = FREAD(buffer, sizeof(char), (size_t)defsize, fi);
|
||||||
if (numbytes == defsize)
|
if (numbytes == defsize)
|
||||||
{
|
{
|
||||||
buffer[defsize] = '\0';
|
buffer[defsize] = '\0';
|
||||||
|
|
@ -1105,7 +1105,7 @@ calmaProcessDef(def, outf, do_library)
|
||||||
defsize = (size_t)(cellend - cellstart);
|
defsize = (size_t)(cellend - cellstart);
|
||||||
buffer = (char *)mallocMagic(defsize);
|
buffer = (char *)mallocMagic(defsize);
|
||||||
|
|
||||||
numbytes = fread(buffer, sizeof(char), (size_t)defsize, fi);
|
numbytes = FREAD(buffer, sizeof(char), (size_t)defsize, fi);
|
||||||
|
|
||||||
if (numbytes == defsize)
|
if (numbytes == defsize)
|
||||||
{
|
{
|
||||||
|
|
@ -1147,7 +1147,7 @@ calmaProcessDef(def, outf, do_library)
|
||||||
}
|
}
|
||||||
freeMagic(buffer);
|
freeMagic(buffer);
|
||||||
}
|
}
|
||||||
fclose(fi);
|
FCLOSE(fi);
|
||||||
|
|
||||||
if (modName != filename)
|
if (modName != filename)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -55,4 +55,8 @@ extern void CalmaTechInit();
|
||||||
extern bool CalmaGenerateArray();
|
extern bool CalmaGenerateArray();
|
||||||
extern void CalmaReadError();
|
extern void CalmaReadError();
|
||||||
|
|
||||||
|
#ifdef HAVE_ZLIB
|
||||||
|
extern bool CalmaWriteZ();
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _CALMA_H */
|
#endif /* _CALMA_H */
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,7 @@ typedef enum { LABEL_TYPE_NONE, LABEL_TYPE_TEXT, LABEL_TYPE_PORT, LABEL_TYPE_CEL
|
||||||
|
|
||||||
/* Globals for Calma reading */
|
/* Globals for Calma reading */
|
||||||
extern FILETYPE calmaInputFile;
|
extern FILETYPE calmaInputFile;
|
||||||
|
extern FILE *calmaInputFileNoCompression;
|
||||||
extern char *calmaFilename;
|
extern char *calmaFilename;
|
||||||
extern int calmaReadScale1;
|
extern int calmaReadScale1;
|
||||||
extern int calmaReadScale2;
|
extern int calmaReadScale2;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue