]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
Update ppdRasterMatchPPDSize() return value
authorVikrant <vikrantmalik051@gmail.com>
Thu, 16 Jul 2020 11:47:32 +0000 (17:17 +0530)
committerVikrant <vikrantmalik051@gmail.com>
Thu, 16 Jul 2020 11:47:32 +0000 (17:17 +0530)
ppd/ppd.h
ppd/raster-interpret.c

index 32068bf3b2390ba5d878699168dab313f6613163..055334929116f8c9b43bc6469fc4715d010f4403 100644 (file)
--- a/ppd/ppd.h
+++ b/ppd/ppd.h
@@ -574,7 +574,7 @@ extern int          ppdPageSizeLimits(ppd_file_t *ppd,
                                          ppd_size_t *maximum);
 
 /**** New in libppd (cups-filters) ****/
-extern ppd_size_t      *ppdRasterMatchPPDSize(cups_page_header2_t *header,
+extern int             ppdRasterMatchPPDSize(cups_page_header2_t *header,
                                                ppd_file_t *ppd,
                                                double margins[4],
                                                double dimensions[4],
index 4b49425b2a1694dc0cd10140b03da52a7b285799..d205530a8cb8e5efd86f7f828139eabd2c1a5f65 100644 (file)
@@ -500,7 +500,7 @@ ppdRasterInterpretPPD(
  * 'ppdRasterMatchPageSize()' - Match PPD page size to header page size.
  */
 
-ppd_size_t *                           /* O - Matched Size on success, NULL on failure */
+int                                    /* O - 0 on success, -1 on failure */
 ppdRasterMatchPPDSize(
     cups_page_header2_t *header,       /* I - Page header to match */
     ppd_file_t         *ppd,           /* I - PPD file */
@@ -514,6 +514,17 @@ ppdRasterMatchPPDSize(
   int          i = 0;                  /* Loop variable */
   char         pageSizeRequested[64];  /* Requested PageSize */
 
+  if (!header)
+  {
+    _ppdRasterAddError("Page header cannot be NULL!\n");
+    return (-1);
+  }
+  if (!ppd)
+  {
+    _ppdRasterAddError("PPD file not found!\n");
+    return (-1);
+  }
+
   strncpy(pageSizeRequested, header->cupsPageSizeName, 64); /* Prefer user-selected page size. */
   memset(dimensions, 0, sizeof(double)*2);
   memset(margins, 0, sizeof(double)*4);
@@ -626,7 +637,7 @@ ppdRasterMatchPPDSize(
     snprintf(header->cupsPageSizeName, 64, "Custom.%dx%d", header->PageSize[0], header->PageSize[1]);
   }
 
-  return size_matched;
+  return 0;
 }
 
 /*