X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.web-live.git;a=blobdiff_plain;f=pctb%2Focr.c;h=bb9576769e10a1d633ed6ebb7786d75e3bfcf585;hp=48c25c085661579d75d4eca2622802dcfb19151c;hb=8b3b006869bfdc6c2ddbf58d6709a73433abe2f9;hpb=3fad53f3bc8c29335f290c1fb5e2563b711becfc;ds=sidebyside diff --git a/pctb/ocr.c b/pctb/ocr.c index 48c25c0..bb95767 100644 --- a/pctb/ocr.c +++ b/pctb/ocr.c @@ -63,12 +63,19 @@ static void readdb(OcrReader *rd) { char lbuf[100]; FILE *db; + for (ctxi=0; ctxicontexts[ctxi]); + char *dbfname=0; asprintf(&dbfname,"%s/charset-%d.txt",get_vardir(),rd->h); eassert(dbfname); - db= fopen(dbfname,"r"); eassert(db); + db= fopen(dbfname,"r"); free(dbfname); + if (!db) { + eassert(errno==ENOENT); + return; + } FGETSLINE(db,lbuf); eassert(!strcmp(lbuf,"# ypp-sc-tools pctb font v1")); @@ -77,9 +84,6 @@ static void readdb(OcrReader *rd) { eassert(r==1); eassert(h==rd->h); - for (ctxi=0; ctxicontexts[ctxi]); - for (;;) { FGETSLINE(db,lbuf); if (!lbuf || lbuf[0]=='#') continue;