Commit bfc65726 authored by Carlos Garcia Campos's avatar Carlos Garcia Campos
Browse files

Return an error code instead of a GBool when saving

parent f7c88148
......@@ -462,14 +462,14 @@ GBool PDFDoc::isLinearized() {
return lin;
}
GBool PDFDoc::saveAs(GooString *name, PDFWriteMode mode) {
int PDFDoc::saveAs(GooString *name, PDFWriteMode mode) {
FILE *f;
OutStream *outStr;
GBool res;
int res;
if (!(f = fopen(name->getCString(), "wb"))) {
error(-1, "Couldn't open file '%s'", name->getCString());
return gFalse;
return errOpenFile;
}
outStr = new FileOutStream(f,0);
res = saveAs(outStr, mode);
......@@ -478,7 +478,7 @@ GBool PDFDoc::saveAs(GooString *name, PDFWriteMode mode) {
return res;
}
GBool PDFDoc::saveAs(OutStream *outStr, PDFWriteMode mode) {
int PDFDoc::saveAs(OutStream *outStr, PDFWriteMode mode) {
// we don't support files with Encrypt at the moment
Object obj;
......@@ -486,7 +486,7 @@ GBool PDFDoc::saveAs(OutStream *outStr, PDFWriteMode mode) {
if (!obj.isNull())
{
obj.free();
return gFalse;
return errEncrypted;
}
obj.free();
......@@ -511,17 +511,17 @@ GBool PDFDoc::saveAs(OutStream *outStr, PDFWriteMode mode) {
}
}
return gTrue;
return errNone;
}
GBool PDFDoc::saveWithoutChangesAs(GooString *name) {
int PDFDoc::saveWithoutChangesAs(GooString *name) {
FILE *f;
OutStream *outStr;
GBool res;
int res;
if (!(f = fopen(name->getCString(), "wb"))) {
error(-1, "Couldn't open file '%s'", name->getCString());
return gFalse;
return errOpenFile;
}
outStr = new FileOutStream(f,0);
......@@ -533,7 +533,7 @@ GBool PDFDoc::saveWithoutChangesAs(GooString *name) {
return res;
}
GBool PDFDoc::saveWithoutChangesAs(OutStream *outStr) {
int PDFDoc::saveWithoutChangesAs(OutStream *outStr) {
int c;
str->reset();
......@@ -542,7 +542,7 @@ GBool PDFDoc::saveWithoutChangesAs(OutStream *outStr) {
}
str->close();
return gTrue;
return errNone;
}
void PDFDoc::saveIncrementalUpdate (OutStream* outStr)
......
......@@ -197,13 +197,13 @@ public:
double getPDFVersion() { return pdfVersion; }
// Save this file with another name.
GBool saveAs(GooString *name, PDFWriteMode mode=writeStandard);
int saveAs(GooString *name, PDFWriteMode mode=writeStandard);
// Save this file in the given output stream.
GBool saveAs(OutStream *outStr, PDFWriteMode mode=writeStandard);
int saveAs(OutStream *outStr, PDFWriteMode mode=writeStandard);
// Save this file with another name without saving changes
GBool saveWithoutChangesAs(GooString *name);
int saveWithoutChangesAs(GooString *name);
// Save this file in the given output stream without saving changes
GBool saveWithoutChangesAs(OutStream *outStr);
int saveWithoutChangesAs(OutStream *outStr);
// Return a pointer to the GUI (XPDFCore or WinPDFCore object).
void *getGUIData() { return guiData; }
......
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