~ubuntu-branches/ubuntu/vivid/libspectre/vivid-proposed

« back to all changes in this revision

Viewing changes to libspectre/spectre-document.c

Tags: upstream-0.2.3
ImportĀ upstreamĀ versionĀ 0.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
        
70
70
        document->doc = psscan (filename, SCANSTYLE_NORMAL);
71
71
        if (!document->doc) {
72
 
                /* FIXME: OOM | INVALID_PS */
73
72
                document->status = SPECTRE_STATUS_LOAD_ERROR;
74
73
                return;
75
74
        }
80
79
                document->doc = NULL;
81
80
                
82
81
                return;
 
82
        } else if (document->doc->numpages == 0 && !document->doc->format) {
 
83
                /* Make sure it's a valid PS document */
 
84
                unsigned char *data = NULL;
 
85
                int            row_length;
 
86
 
 
87
                spectre_document_render (document, &data, &row_length);
 
88
                free (data);
 
89
                
 
90
                if (spectre_document_status (document)) {
 
91
                        document->status = SPECTRE_STATUS_LOAD_ERROR;
 
92
                        psdocdestroy (document->doc);
 
93
                        document->doc = NULL;
 
94
 
 
95
                        return;
 
96
                }
83
97
        }
84
98
 
85
99
        document->structured = ((!document->doc->epsf && document->doc->numpages > 0) ||