Georg Baum <[EMAIL PROTECTED]> writes:

| Index: src/support/filetools.C
| ===================================================================
| --- src/support/filetools.C   (Revision 13548)
| +++ src/support/filetools.C   (Arbeitskopie)
| @@ -1168,21 +1157,40 @@ string const readBB_from_PSFile(string c
|       string const format = getFormatFromContents(file_);
|  
|       if (format != "eps" && format != "ps") {
| -             readBB_lyxerrMessage(file_, zipped,"no(e)ps-format");
| +             lyxerr[Debug::GRAPHICS]
| +                     << "[readBB_from_PSFile] no(e)ps-format" << endl;
| +             if (zipped)
| +                     unlink(file_);
|               return string();
|       }
|  
| +     static boost::regex bbox_re(
| +             
"^%%BoundingBox:\\s*([[:digit:]]+)\\s+([[:digit:]]+)\\s+([[:digit:]]+)\\s+([[:digit:]]+)(.*)");
|       std::ifstream is(file_.c_str());
|       while (is) {
|               string s;
|               getline(is,s);
| -             if (contains(s,"%%BoundingBox:") && !contains(s,"atend")) {
| -                     string const bb = ltrim(s.substr(14));
| -                     readBB_lyxerrMessage(file_, zipped, bb);
| +             boost::smatch what;
| +             regex_match(s, what, bbox_re);
| +             if (what[0].matched) {

                if (regex_match(s, what, bbox_re)) {

instead.

If it is not a full match the it is not interesting.

I do not like the "if (zipped) unlink(file_)" spread all over.
Either a nicer solution should be found (RAII) or readBB_lyxerrMessage
should be retained.

-- 
        Lgb

Reply via email to