summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristof Pintaske <cp@openoffice.org>2001-10-08 14:04:06 +0000
committerChristof Pintaske <cp@openoffice.org>2001-10-08 14:04:06 +0000
commitb3ca4a00205b187539fe4dc173020dea70a484fa (patch)
treedaf1a88c7500618e1437d4f7132ff96f21a7d52c
parent9549d877ec9422d975bfeac359e347614dd1cb9e (diff)
#92847# corrected file url handling
-rw-r--r--psprint/source/printergfx/printerjob.cxx50
-rw-r--r--psprint/source/printergfx/text_gfx.cxx14
2 files changed, 40 insertions, 24 deletions
diff --git a/psprint/source/printergfx/printerjob.cxx b/psprint/source/printergfx/printerjob.cxx
index 06f5f3706fa7..7060548842bf 100644
--- a/psprint/source/printergfx/printerjob.cxx
+++ b/psprint/source/printergfx/printerjob.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: printerjob.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: hr $ $Date: 2001-09-27 16:14:22 $
+ * last change: $Author: cp $ $Date: 2001-10-08 15:03:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -138,17 +138,26 @@ AppendPS (FILE* pDst, osl::File* pSrc, sal_uChar* pBuffer,
osl::File*
PrinterJob::CreateSpoolFile (const rtl::OUString& rName, const rtl::OUString& rExtension)
{
+ osl::File::RC nError = osl::File::E_None;
+ osl::File* pFile = NULL;
- rtl::OUString aFileName = maSpoolDirName + rtl::OUString::createFromAscii ("/")
- + rName + rExtension;
- rtl::OUString aNormFileName;
- osl::File::getFileURLFromSystemPath( aFileName, aNormFileName );
+ rtl::OUString aFile = rName + rExtension;
+ rtl::OUString aFileURL;
+ nError = osl::File::getFileURLFromSystemPath( aFile, aFileURL );
+ if (nError != osl::File::E_None)
+ return NULL;
+ aFileURL = maSpoolDirName + rtl::OUString::createFromAscii ("/") + aFileURL;
- osl::File* pFile = new osl::File (aNormFileName);
- pFile->open (OpenFlag_Read | OpenFlag_Write | OpenFlag_Create);
- pFile->setAttributes (aNormFileName,
- osl_File_Attribute_OwnWrite | osl_File_Attribute_OwnRead );
+ pFile = new osl::File (aFileURL);
+ nError = pFile->open (OpenFlag_Read | OpenFlag_Write | OpenFlag_Create);
+ if (nError != osl::File::E_None)
+ {
+ delete pFile;
+ return NULL;
+ }
+ pFile->setAttributes (aFileURL,
+ osl_File_Attribute_OwnWrite | osl_File_Attribute_OwnRead);
return pFile;
}
@@ -300,7 +309,7 @@ void
removeSpoolDir (const rtl::OUString& rSpoolDir)
{
rtl::OUString aSysPath;
- if( osl_File_E_None != osl::File::getSystemPathFromFileURL( rSpoolDir, aSysPath ) )
+ if( osl::File::E_None != osl::File::getSystemPathFromFileURL( rSpoolDir, aSysPath ) )
{
// Conversion did not work, as this is quite a dangerous action,
// we should abort here ....
@@ -536,13 +545,18 @@ PrinterJob::EndJob ()
pPageBody != maPageList.end() && pPageHead != maHeaderList.end();
pPageBody++, pPageHead++)
{
- (*pPageHead)->open(OpenFlag_Read);
- AppendPS (pDestFILE, *pPageHead, pBuffer);
- (*pPageHead)->close();
-
- (*pPageBody)->open(OpenFlag_Read);
- AppendPS (pDestFILE, *pPageBody, pBuffer);
- (*pPageBody)->close();
+ osl::File::RC nError = (*pPageHead)->open(OpenFlag_Read);
+ if (nError == osl::File::E_None)
+ {
+ AppendPS (pDestFILE, *pPageHead, pBuffer);
+ (*pPageHead)->close();
+ }
+ nError = (*pPageBody)->open(OpenFlag_Read);
+ if (nError == osl::File::E_None)
+ {
+ AppendPS (pDestFILE, *pPageBody, pBuffer);
+ (*pPageBody)->close();
+ }
}
AppendPS (pDestFILE, mpJobTrailer, pBuffer);
diff --git a/psprint/source/printergfx/text_gfx.cxx b/psprint/source/printergfx/text_gfx.cxx
index 5462cb8e3f8e..8e141e83030a 100644
--- a/psprint/source/printergfx/text_gfx.cxx
+++ b/psprint/source/printergfx/text_gfx.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: text_gfx.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: pl $ $Date: 2001-07-27 07:58:33 $
+ * last change: $Author: cp $ $Date: 2001-10-08 15:04:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -177,10 +177,12 @@ PrinterGfx::PSUploadPS1Font (sal_Int32 nFontID)
WritePS (mpPageHeader, pFontResource);
- aFontFile.open (OpenFlag_Read);
- convertPfbToPfa (aFontFile, *mpPageHeader);
- aFontFile.close ();
-
+ osl::File::RC nError = aFontFile.open (OpenFlag_Read);
+ if (nError == osl::File::E_None)
+ {
+ convertPfbToPfa (aFontFile, *mpPageHeader);
+ aFontFile.close ();
+ }
WritePS (mpPageHeader, "%%EndResource\n");
// add the fontid to the list