Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libharu for openSUSE:Factory checked 
in at 2023-09-20 13:29:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libharu (Old)
 and      /work/SRC/openSUSE:Factory/.libharu.new.16627 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libharu"

Wed Sep 20 13:29:06 2023 rev:11 rq:1112158 version:2.4.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/libharu/libharu.changes  2023-06-30 
19:58:45.373602067 +0200
+++ /work/SRC/openSUSE:Factory/.libharu.new.16627/libharu.changes       
2023-09-20 13:31:41.324017374 +0200
@@ -1,0 +2,13 @@
+Tue Sep 19 05:58:01 UTC 2023 - Atri Bhattacharya <badshah...@gmail.com>
+
+- Update to version 2.4.4:
+  * Add copy hpdf_namedict.h at install [gh#libharu/libharu#265].
+  * Added page boundary support [gh#libharu/libharu#274].
+  * Fixed glyph index to be 16 bit unsigned instead of signed
+    [gh#libharu/libharu#277].
+  * Bug fixes [gh#libharu/libharu#255].
+  * Shared library has an SOVERSION now.
+  * Fixed HPDF_FToA for small values.
+- Drop libharu-so-versioning.patch: fixed upstream.
+
+-------------------------------------------------------------------

Old:
----
  libharu-2.4.3.tar.gz
  libharu-so-versioning.patch

New:
----
  libharu-2.4.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libharu.spec ++++++
--- /var/tmp/diff_new_pack.3NgFwb/_old  2023-09-20 13:31:43.328089172 +0200
+++ /var/tmp/diff_new_pack.3NgFwb/_new  2023-09-20 13:31:43.348089888 +0200
@@ -16,18 +16,16 @@
 #
 
 
-%define relver 2
+%define relver 2_4
 %define lname   libhpdf%{relver}
 Name:           libharu
-Version:        2.4.3
+Version:        2.4.4
 Release:        0
 Summary:        Library for generating PDF files
 License:        Zlib
 Group:          Productivity/Office/Other
 URL:            http://libharu.org
 Source0:        
https://github.com/libharu/libharu/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
-# PATCH-FIX-UPSTREAM libharu-so-versioning.patch gh#libharu/libharu#284 
badshah...@gmail.com -- Add correct versioning to shared object libhpdf.so
-Patch0:         libharu-so-versioning.patch
 BuildRequires:  cmake
 BuildRequires:  fdupes
 BuildRequires:  libpng-devel
@@ -49,7 +47,6 @@
 Summary:        Library for generating PDF files
 Group:          System/Libraries
 
-
 %description -n %{lname}
 libHaru is a library for generating PDF files.
 It supports the following features:

++++++ libharu-2.4.3.tar.gz -> libharu-2.4.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/CMakeLists.txt 
new/libharu-2.4.4/CMakeLists.txt
--- old/libharu-2.4.3/CMakeLists.txt    2022-10-14 12:04:02.000000000 +0200
+++ new/libharu-2.4.4/CMakeLists.txt    2023-09-18 21:47:01.000000000 +0200
@@ -121,6 +121,7 @@
     include/hpdf_info.h
     include/hpdf_list.h
     include/hpdf_mmgr.h
+    include/hpdf_namedict.h
     include/hpdf_objects.h
     include/hpdf_outline.h
     include/hpdf_pages.h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/include/hpdf.h 
new/libharu-2.4.4/include/hpdf.h
--- old/libharu-2.4.3/include/hpdf.h    2022-10-14 12:04:02.000000000 +0200
+++ new/libharu-2.4.4/include/hpdf.h    2023-09-18 21:47:01.000000000 +0200
@@ -256,6 +256,13 @@
 HPDF_Page_SetHeight  (HPDF_Page   page,
                       HPDF_REAL   value);
 
+HPDF_EXPORT(HPDF_STATUS)
+HPDF_Page_SetBoundary  (HPDF_Page           page,
+                        HPDF_PageBoundary   boundary,
+                        HPDF_REAL           left,
+                        HPDF_REAL           bottom,
+                        HPDF_REAL           right,
+                        HPDF_REAL           top);
 
 HPDF_EXPORT(HPDF_STATUS)
 HPDF_Page_SetSize  (HPDF_Page            page,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/include/hpdf_error.h 
new/libharu-2.4.4/include/hpdf_error.h
--- old/libharu-2.4.3/include/hpdf_error.h      2022-10-14 12:04:02.000000000 
+0200
+++ new/libharu-2.4.4/include/hpdf_error.h      2023-09-18 21:47:01.000000000 
+0200
@@ -145,7 +145,7 @@
 #define HPDF_INVALID_U3D_DATA                     0x1083
 #define HPDF_NAME_CANNOT_GET_NAMES                0x1084
 #define HPDF_INVALID_ICC_COMPONENT_NUM            0x1085
-/*                                                0x1086 */
+#define HPDF_PAGE_INVALID_BOUNDARY                0x1086
 /*                                                0x1087 */
 #define HPDF_INVALID_SHADING_TYPE                 0x1088
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/include/hpdf_types.h 
new/libharu-2.4.4/include/hpdf_types.h
--- old/libharu-2.4.3/include/hpdf_types.h      2022-10-14 12:04:02.000000000 
+0200
+++ new/libharu-2.4.4/include/hpdf_types.h      2023-09-18 21:47:01.000000000 
+0200
@@ -583,6 +583,16 @@
 
 
/*----------------------------------------------------------------------------*/
 
+typedef enum _HPDF_PageBoundary {
+    HPDF_PAGE_MEDIABOX = 0,
+    HPDF_PAGE_CROPBOX,
+    HPDF_PAGE_BLEEDBOX,
+    HPDF_PAGE_TRIMBOX,
+    HPDF_PAGE_ARTBOX
+} HPDF_PageBoundary;
+
+/*----------------------------------------------------------------------------*/
+
 typedef enum _HPDF_ShadingType {
   HPDF_SHADING_FREE_FORM_TRIANGLE_MESH = 4 /* TODO the rest */
 } HPDF_ShadingType;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/include/hpdf_version.h 
new/libharu-2.4.4/include/hpdf_version.h
--- old/libharu-2.4.3/include/hpdf_version.h    2022-10-14 12:04:02.000000000 
+0200
+++ new/libharu-2.4.4/include/hpdf_version.h    2023-09-18 21:47:01.000000000 
+0200
@@ -1,6 +1,6 @@
 #define HPDF_MAJOR_VERSION 2
 #define HPDF_MINOR_VERSION 4
-#define HPDF_BUGFIX_VERSION 3
+#define HPDF_BUGFIX_VERSION 4
 #define HPDF_EXTRA_VERSION ""
 
 #define hpdf_vquote(x) #x
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/src/CMakeLists.txt 
new/libharu-2.4.4/src/CMakeLists.txt
--- old/libharu-2.4.3/src/CMakeLists.txt        2022-10-14 12:04:02.000000000 
+0200
+++ new/libharu-2.4.4/src/CMakeLists.txt        2023-09-18 21:47:01.000000000 
+0200
@@ -7,72 +7,77 @@
 # libhpdf source files
 # =======================================================================
 set(
-  LIBHPDF_SRCS
-       hpdf_annotation.c
-       hpdf_array.c
-       hpdf_binary.c
-       hpdf_boolean.c
-       hpdf_catalog.c
-       hpdf_destination.c
-       hpdf_dict.c
-       hpdf_direct.c
-       hpdf_doc_png.c
-       hpdf_doc.c
-       hpdf_encoder_cns.c
-       hpdf_encoder_cnt.c
-       hpdf_encoder_jp.c
-       hpdf_encoder_kr.c
-       hpdf_encoder.c
-       hpdf_encrypt.c
-       hpdf_encryptdict.c
-       hpdf_error.c
-       hpdf_ext_gstate.c
-       hpdf_font_cid.c
-       hpdf_font_tt.c
-       hpdf_font_type1.c
-       hpdf_font.c
-       hpdf_fontdef_base14.c
-       hpdf_fontdef_cid.c
-       hpdf_fontdef_cns.c
-       hpdf_fontdef_cnt.c
-       hpdf_fontdef_jp.c
-       hpdf_fontdef_kr.c
-       hpdf_fontdef_tt.c
-       hpdf_fontdef_type1.c
-       hpdf_fontdef.c
-       hpdf_gstate.c
-       hpdf_image_ccitt.c
-       hpdf_image_png.c
-       hpdf_image.c
-       hpdf_info.c
-       hpdf_list.c
-       hpdf_mmgr.c
-       hpdf_name.c
-       hpdf_namedict.c
-       hpdf_null.c
-       hpdf_number.c
-       hpdf_objects.c
-       hpdf_outline.c
-       hpdf_page_label.c
-       hpdf_page_operator.c
-       hpdf_pages.c
-       hpdf_real.c
-       hpdf_shading.c
-       hpdf_streams.c
-       hpdf_string.c
-       hpdf_u3d.c
-       hpdf_utils.c
-       hpdf_xref.c
-       hpdf_pdfa.c
-       hpdf_3dmeasure.c
-       hpdf_exdata.c
-       hpdf_encoder_utf.c
+    LIBHPDF_SRCS
+    hpdf_annotation.c
+    hpdf_array.c
+    hpdf_binary.c
+    hpdf_boolean.c
+    hpdf_catalog.c
+    hpdf_destination.c
+    hpdf_dict.c
+    hpdf_direct.c
+    hpdf_doc_png.c
+    hpdf_doc.c
+    hpdf_encoder_cns.c
+    hpdf_encoder_cnt.c
+    hpdf_encoder_jp.c
+    hpdf_encoder_kr.c
+    hpdf_encoder_utf.c
+    hpdf_encoder.c
+    hpdf_encrypt.c
+    hpdf_encryptdict.c
+    hpdf_error.c
+    hpdf_ext_gstate.c
+    hpdf_font_cid.c
+    hpdf_font_tt.c
+    hpdf_font_type1.c
+    hpdf_font.c
+    hpdf_fontdef_base14.c
+    hpdf_fontdef_cid.c
+    hpdf_fontdef_cns.c
+    hpdf_fontdef_cnt.c
+    hpdf_fontdef_jp.c
+    hpdf_fontdef_kr.c
+    hpdf_fontdef_tt.c
+    hpdf_fontdef_type1.c
+    hpdf_fontdef.c
+    hpdf_gstate.c
+    hpdf_image_ccitt.c
+    hpdf_image_png.c
+    hpdf_image.c
+    hpdf_info.c
+    hpdf_list.c
+    hpdf_mmgr.c
+    hpdf_name.c
+    hpdf_namedict.c
+    hpdf_null.c
+    hpdf_number.c
+    hpdf_objects.c
+    hpdf_outline.c
+    hpdf_page_label.c
+    hpdf_page_operator.c
+    hpdf_pages.c
+    hpdf_real.c
+    hpdf_shading.c
+    hpdf_streams.c
+    hpdf_string.c
+    hpdf_u3d.c
+    hpdf_utils.c
+    hpdf_xref.c
+    hpdf_pdfa.c
+    hpdf_3dmeasure.c
+    hpdf_exdata.c
+    hpdf_encoder_utf.c
 )
 
 # =======================================================================
 # create hpdf library
 # =======================================================================
 add_library(hpdf ${LIBHPDF_SRCS})
+set_target_properties(hpdf PROPERTIES
+    SOVERSION ${HPDF_MAJOR_VERSION}.${HPDF_MINOR_VERSION}
+    VERSION ${HPDF_MAJOR_VERSION}.${HPDF_MINOR_VERSION}.${HPDF_BUGFIX_VERSION}
+)
 if (PNG_FOUND)
     include_directories (${PNG_INCLUDE_DIRS})
     target_link_libraries (hpdf ${PNG_LIBRARIES})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/src/hpdf_3dmeasure.c 
new/libharu-2.4.4/src/hpdf_3dmeasure.c
--- old/libharu-2.4.3/src/hpdf_3dmeasure.c      2022-10-14 12:04:02.000000000 
+0200
+++ new/libharu-2.4.4/src/hpdf_3dmeasure.c      2023-09-18 21:47:01.000000000 
+0200
@@ -125,7 +125,7 @@
 
        s = HPDF_String_New (measure->mmgr, name, 0);
        if (!s)
-               return HPDF_Error_GetCode ( s->error);
+               return HPDF_Error_GetCode ( measure->error);
 
        ret = HPDF_Dict_Add(measure, "TRL", s);
 
@@ -164,7 +164,7 @@
 
        s = HPDF_String_New (measure->mmgr, text, encoder);
        if (!s)
-               return HPDF_Error_GetCode ( s->error);
+               return HPDF_Error_GetCode ( measure->error);
 
        ret = HPDF_Dict_Add(measure, "UT", s);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/src/hpdf_dict.c 
new/libharu-2.4.4/src/hpdf_dict.c
--- old/libharu-2.4.3/src/hpdf_dict.c   2022-10-14 12:04:02.000000000 +0200
+++ new/libharu-2.4.4/src/hpdf_dict.c   2023-09-18 21:47:01.000000000 +0200
@@ -347,8 +347,10 @@
     if (header->obj_id & HPDF_OTYPE_INDIRECT) {
         HPDF_Proxy proxy = HPDF_Proxy_New (dict->mmgr, obj);
 
-        if (!proxy)
+        if (!proxy) {
+            HPDF_Obj_Free(dict->mmgr, obj);
             return HPDF_Error_GetCode (dict->error);
+        }
 
         element->value = proxy;
         proxy->header.obj_id |= HPDF_OTYPE_DIRECT;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/src/hpdf_fontdef_jp.c 
new/libharu-2.4.4/src/hpdf_fontdef_jp.c
--- old/libharu-2.4.3/src/hpdf_fontdef_jp.c     2022-10-14 12:04:02.000000000 
+0200
+++ new/libharu-2.4.4/src/hpdf_fontdef_jp.c     2023-09-18 21:47:01.000000000 
+0200
@@ -1685,7 +1685,7 @@
                 HPDF_FONT_SERIF;
     fontdef->italic_angle = 0;
     fontdef->stemv = 78;
-    if ((ret = HPDF_CIDFontDef_AddWidth (fontdef, MS_Gothic_W_ARRAY)) !=
+    if ((ret = HPDF_CIDFontDef_AddWidth (fontdef, MS_Mincho_W_ARRAY)) !=
                 HPDF_OK) {
         return ret;
     }
@@ -1746,7 +1746,7 @@
     fontdef->flags = HPDF_FONT_SYMBOLIC + HPDF_FONT_SERIF;
     fontdef->italic_angle = 0;
     fontdef->stemv = 78;
-    if ((ret = HPDF_CIDFontDef_AddWidth (fontdef, MS_PGothic_W_ARRAY)) !=
+    if ((ret = HPDF_CIDFontDef_AddWidth (fontdef, MS_PMincho_W_ARRAY)) !=
                 HPDF_OK) {
         return ret;
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/src/hpdf_fontdef_kr.c 
new/libharu-2.4.4/src/hpdf_fontdef_kr.c
--- old/libharu-2.4.3/src/hpdf_fontdef_kr.c     2022-10-14 12:04:02.000000000 
+0200
+++ new/libharu-2.4.4/src/hpdf_fontdef_kr.c     2023-09-18 21:47:01.000000000 
+0200
@@ -1353,7 +1353,7 @@
                 HPDF_FONT_SERIF;
     fontdef->italic_angle = 0;
     fontdef->stemv = 78;
-    if ((ret = HPDF_CIDFontDef_AddWidth (fontdef, DotumChe_W_ARRAY)) !=
+    if ((ret = HPDF_CIDFontDef_AddWidth (fontdef, BatangChe_W_ARRAY)) !=
                 HPDF_OK) {
         return ret;
     }
@@ -1414,7 +1414,7 @@
     fontdef->flags = HPDF_FONT_SYMBOLIC + HPDF_FONT_SERIF;
     fontdef->italic_angle = 0;
     fontdef->stemv = 78;
-    if ((ret = HPDF_CIDFontDef_AddWidth (fontdef, Dotum_W_ARRAY)) !=
+    if ((ret = HPDF_CIDFontDef_AddWidth (fontdef, Batang_W_ARRAY)) !=
                 HPDF_OK) {
         return ret;
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/src/hpdf_fontdef_tt.c 
new/libharu-2.4.4/src/hpdf_fontdef_tt.c
--- old/libharu-2.4.3/src/hpdf_fontdef_tt.c     2022-10-14 12:04:02.000000000 
+0200
+++ new/libharu-2.4.4/src/hpdf_fontdef_tt.c     2023-09-18 21:47:01.000000000 
+0200
@@ -1241,7 +1241,7 @@
     } else {
         HPDF_INT16 num_of_contours;
         HPDF_INT16 flags;
-        HPDF_INT16 glyph_index;
+        HPDF_UINT16 glyph_index;
         const HPDF_UINT16 ARG_1_AND_2_ARE_WORDS = 1;
         const HPDF_UINT16 WE_HAVE_A_SCALE  = 8;
         const HPDF_UINT16 MORE_COMPONENTS = 32;
@@ -1264,7 +1264,7 @@
             if ((ret = GetINT16 (attr->stream, &flags)) != HPDF_OK)
                 return ret;
 
-            if ((ret = GetINT16 (attr->stream, &glyph_index)) != HPDF_OK)
+            if ((ret = GetUINT16 (attr->stream, &glyph_index)) != HPDF_OK)
                 return ret;
 
             if (flags & ARG_1_AND_2_ARE_WORDS) {
@@ -1291,7 +1291,7 @@
                     return ret;
             }
 
-            if (glyph_index > 0 && glyph_index < attr->num_glyphs &&
+            if (glyph_index < attr->num_glyphs &&
                     !attr->glyph_tbl.flgs[glyph_index]) {
                 HPDF_INT32 next_glyph;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/src/hpdf_fontdef_type1.c 
new/libharu-2.4.4/src/hpdf_fontdef_type1.c
--- old/libharu-2.4.3/src/hpdf_fontdef_type1.c  2022-10-14 12:04:02.000000000 
+0200
+++ new/libharu-2.4.4/src/hpdf_fontdef_type1.c  2023-09-18 21:47:01.000000000 
+0200
@@ -181,30 +181,30 @@
         } else
 
         if (HPDF_StrCmp (keyword, "CharacterSet") == 0) {
-            HPDF_UINT len = HPDF_StrLen (s, HPDF_LIMIT_MAX_STRING_LEN);
+            HPDF_UINT len1 = HPDF_StrLen (s, HPDF_LIMIT_MAX_STRING_LEN);
 
-            if (len > 0) {
-                attr->char_set = HPDF_GetMem (fontdef->mmgr, len + 1);
+            if (len1 > 0) {
+                attr->char_set = HPDF_GetMem (fontdef->mmgr, len1 + 1);
                 if (!attr->char_set)
                     return HPDF_Error_GetCode (fontdef->error);
 
-                HPDF_StrCpy (attr->char_set, s, attr->char_set + len);
+                HPDF_StrCpy (attr->char_set, s, attr->char_set + len1);
             }
         } else
         if (HPDF_StrCmp (keyword, "FontBBox") == 0) {
-            char buf[HPDF_INT_LEN + 1];
+            char buf1[HPDF_INT_LEN + 1];
 
-            s = GetKeyword (s, buf, HPDF_INT_LEN + 1);
-            fontdef->font_bbox.left = (HPDF_REAL)HPDF_AToI (buf);
+            s = GetKeyword (s, buf1, HPDF_INT_LEN + 1);
+            fontdef->font_bbox.left = (HPDF_REAL)HPDF_AToI (buf1);
 
-            s = GetKeyword (s, buf, HPDF_INT_LEN + 1);
-            fontdef->font_bbox.bottom = (HPDF_REAL)HPDF_AToI (buf);
+            s = GetKeyword (s, buf1, HPDF_INT_LEN + 1);
+            fontdef->font_bbox.bottom = (HPDF_REAL)HPDF_AToI (buf1);
 
-            s = GetKeyword (s, buf, HPDF_INT_LEN + 1);
-            fontdef->font_bbox.right = (HPDF_REAL)HPDF_AToI (buf);
+            s = GetKeyword (s, buf1, HPDF_INT_LEN + 1);
+            fontdef->font_bbox.right = (HPDF_REAL)HPDF_AToI (buf1);
 
-            GetKeyword (s, buf, HPDF_INT_LEN + 1);
-            fontdef->font_bbox.top = (HPDF_REAL)HPDF_AToI (buf);
+            GetKeyword (s, buf1, HPDF_INT_LEN + 1);
+            fontdef->font_bbox.top = (HPDF_REAL)HPDF_AToI (buf1);
         } else
         if (HPDF_StrCmp (keyword, "EncodingScheme") == 0) {
             HPDF_StrCpy (attr->encoding_scheme, s,
@@ -242,7 +242,7 @@
     /* load CharMetrics */
     for (i = 0; i < attr->widths_count; i++, cdata++) {
         const char *s;
-        char buf2[HPDF_LIMIT_MAX_NAME_LEN + 1];
+        char buf2[HPDF_LIMIT_MAX_NAME_LEN + 1] = { 0 };
 
         len = HPDF_TMP_BUF_SIZ;
         if ((ret = HPDF_Stream_ReadLn (stream, buf, &len)) != HPDF_OK)
@@ -259,8 +259,6 @@
             s += 2;
 
             s = GetKeyword (s, buf2, HPDF_LIMIT_MAX_NAME_LEN + 1);
-              HPDF_AToI (buf2);
-
             cdata->char_cd = (HPDF_INT16)HPDF_AToI (buf2);
 
         } else
@@ -343,7 +341,7 @@
                         len + 11);
 
                 if (s2)
-                    attr->length2 = attr->font_data->size + - 520 -
+                    attr->length2 = attr->font_data->size - 520 -
                         attr->length1 + (s2 - buf);
                 /*  length1 indicate the size of binary-data.
                  *  in most fonts, it is all right at 520 bytes . but it need
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/src/hpdf_page_operator.c 
new/libharu-2.4.4/src/hpdf_page_operator.c
--- old/libharu-2.4.3/src/hpdf_page_operator.c  2022-10-14 12:04:02.000000000 
+0200
+++ new/libharu-2.4.4/src/hpdf_page_operator.c  2023-09-18 21:47:01.000000000 
+0200
@@ -441,13 +441,17 @@
         return HPDF_CheckError (page->error);
 
     tm = attr->gstate->trans_matrix;
-
+    /*
+    | ta tb 0 |   | a b |   | ta*a+tb*c   ta*b+tb*d   |
+    | tc td 0 | x | c d | = | tc*a+td*c   tc*b+td*d   |
+    | tx ty 1 |   | x y |   | tx*a+ty*c+x tx*b+ty*d+y |
+    */
     attr->gstate->trans_matrix.a = tm.a * a + tm.b * c;
     attr->gstate->trans_matrix.b = tm.a * b + tm.b * d;
     attr->gstate->trans_matrix.c = tm.c * a + tm.d * c;
     attr->gstate->trans_matrix.d = tm.c * b + tm.d * d;
-    attr->gstate->trans_matrix.x = tm.x + x * tm.a + y * tm.c;
-    attr->gstate->trans_matrix.y = tm.y + x * tm.b + y * tm.d;
+    attr->gstate->trans_matrix.x = tm.x * a + tm.y * c + x;
+    attr->gstate->trans_matrix.y = tm.x * b + tm.y * d + y;
 
     return ret;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/src/hpdf_pages.c 
new/libharu-2.4.4/src/hpdf_pages.c
--- old/libharu-2.4.3/src/hpdf_pages.c  2022-10-14 12:04:02.000000000 +0200
+++ new/libharu-2.4.4/src/hpdf_pages.c  2023-09-18 21:47:01.000000000 +0200
@@ -2362,3 +2362,42 @@
     attr = (HPDF_PageAttr)page->attr;
     attr->contents->filter = filter;
 }
+
+
+
+HPDF_EXPORT(HPDF_STATUS)
+HPDF_Page_SetBoundary  (HPDF_Page           page,
+                        HPDF_PageBoundary   boundary,
+                        HPDF_REAL           left,
+                        HPDF_REAL           bottom,
+                        HPDF_REAL           right,
+                        HPDF_REAL           top)
+{
+
+    char *key;
+
+    switch(boundary){
+        case HPDF_PAGE_MEDIABOX:
+            key = "MediaBox";
+            break;
+        case HPDF_PAGE_CROPBOX:
+            key = "CropBox";
+            break;
+        case HPDF_PAGE_BLEEDBOX:
+            key = "BleedBox";
+            break;
+        case HPDF_PAGE_TRIMBOX:
+            key = "TrimBox";
+            break;
+        case HPDF_PAGE_ARTBOX:
+            key = "ArtBox";
+            break;
+        default:
+            return HPDF_RaiseError(page->error, HPDF_PAGE_INVALID_BOUNDARY, 0);
+            break;
+    }
+
+    return HPDF_Dict_Add (page, key, HPDF_Box_Array_New (page->mmgr,
+                HPDF_ToBox ((HPDF_INT16)left, (HPDF_INT16)bottom, 
(HPDF_INT16)right, (HPDF_INT16)top)));
+
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/src/hpdf_pdfa.c 
new/libharu-2.4.4/src/hpdf_pdfa.c
--- old/libharu-2.4.3/src/hpdf_pdfa.c   2022-10-14 12:04:02.000000000 +0200
+++ new/libharu-2.4.4/src/hpdf_pdfa.c   2023-09-18 21:47:01.000000000 +0200
@@ -181,7 +181,7 @@
         pdf->pdf_version = HPDF_VER_14;
 
         HPDF_Dict_AddName(xmp,"Type","Metadata");
-        HPDF_Dict_AddName(xmp,"SubType","XML");
+        HPDF_Dict_AddName(xmp,"Subtype","XML");
 
         ret = HPDF_OK;
         ret += HPDF_Stream_WriteStr(xmp->stream, HEADER);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/src/hpdf_utils.c 
new/libharu-2.4.4/src/hpdf_utils.c
--- old/libharu-2.4.3/src/hpdf_utils.c  2022-10-14 12:04:02.000000000 +0200
+++ new/libharu-2.4.4/src/hpdf_utils.c  2023-09-18 21:47:01.000000000 +0200
@@ -183,16 +183,14 @@
             HPDF_REAL   val,
             char       *eptr)
 {
-    HPDF_INT32 int_val;
-    HPDF_INT32 fpart_val;
+    HPDF_REAL int_val;
+    HPDF_REAL fpart_val;
+    HPDF_REAL dig;
     char buf[HPDF_REAL_LEN + 1];
     char* sptr = s;
     char* t;
-    HPDF_UINT32 i;
-    HPDF_UINT32 prec;
     HPDF_INT32 logVal;
-    HPDF_REAL roundInc;
-    HPDF_INT64 fShift;
+    HPDF_UINT32 prec;
 
     if (val > HPDF_LIMIT_MAX_REAL)
         val = HPDF_LIMIT_MAX_REAL;
@@ -200,15 +198,15 @@
     if (val < HPDF_LIMIT_MIN_REAL)
         val = HPDF_LIMIT_MIN_REAL;
 
-    t = buf + HPDF_REAL_LEN;
-    *t-- = 0;
+    t = buf;
+    *t++ = 0;
 
     if (val < 0) {
         *s++ = '-';
         val = -val;
     }
 
-    /* Compute the decimal precision to write at least 5 significant figures */
+    /* compute the decimal precision to write at least 5 significant figures */
     logVal = (HPDF_INT32)(val > 1e-20 ? log10(val) : 0.);
     if (logVal >= 0) {
         prec = 5;
@@ -217,38 +215,31 @@
         prec = -logVal + 5;
     }
 
-    roundInc = 0.5 * (1. / pow((HPDF_REAL)10, (HPDF_REAL)prec));
-    fShift = (HPDF_INT64)pow((HPDF_REAL)10, (HPDF_REAL)prec);
-
-    /* separate an integer part and a decimal part. */
-    int_val = (HPDF_INT64)(val + roundInc);
-    fpart_val = (HPDF_INT64)((HPDF_REAL)(val - int_val + roundInc) * fShift);
-
-    /* process decimal part */
-    for (i = 0; i < prec; i++) {
-        *t = (char)((char)(fpart_val % 10) + '0');
-        fpart_val /= 10;
-        t--;
-    }
+    /* separate an integer part and a fractional part. */
+    fpart_val = modff(val, &int_val);
 
     /* process integer part */
-    *t-- = '.';
-    *t = '0';
-    if (int_val == 0)
-        t--;
-
-    while (int_val > 0) {
-        *t = (char)((char)(int_val % 10) + '0');
-        int_val /= 10;
-        t--;
-    }
+    do {
+        dig = modff(int_val/10.0, &int_val);
+        *t++ = (char)(dig*10.0 + 0.5) + '0';
+    } while (int_val > 0);
 
-    t++;
+    /* copy to destination buffer */
+    t--;
     while (s <= eptr && *t != 0)
-        *s++ = *t++;
-    s--;
+        *s++ = *t--;
+
+   /* process fractional part */
+   *s++ = '.';
+   if(fpart_val != 0.0) {
+       for (HPDF_UINT32 i = 0; i < prec; i++) {
+          fpart_val = modff(fpart_val*10.0, &int_val);
+          *s++ = (char)(int_val + 0.5) + '0';
+       }
+   }
 
-    /* delete an excessive decimal portion. */
+   /* delete an excessive decimal portion. */
+   s--;
     while (s > sptr) {
         if (*s == '0')
             *s = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libharu-2.4.3/src/hpdf_xref.c 
new/libharu-2.4.4/src/hpdf_xref.c
--- old/libharu-2.4.3/src/hpdf_xref.c   2022-10-14 12:04:02.000000000 +0200
+++ new/libharu-2.4.4/src/hpdf_xref.c   2023-09-18 21:47:01.000000000 +0200
@@ -317,9 +317,14 @@
 WriteTrailer  (HPDF_Xref     xref,
                HPDF_Stream   stream)
 {
-    HPDF_UINT max_obj_id = xref->entries->count + xref->start_offset;
+    HPDF_UINT max_obj_id;
     HPDF_STATUS ret;
 
+    if (!xref)
+        return HPDF_INVALID_OBJECT;
+
+    max_obj_id = xref->entries->count + xref->start_offset;
+
     HPDF_PTRACE ((" WriteTrailer\n"));
 
     if ((ret = HPDF_Dict_AddNumber (xref->trailer, "Size", max_obj_id))

Reply via email to