Skip to content
Snippets Groups Projects
  1. Mar 14, 2023
  2. Mar 01, 2023
    • Sven M. Hallberg's avatar
      bring the two loops in act_txtobj into alignment · 222781c8
      Sven M. Hallberg authored
      The function act_txtobj() performs two passes over the sequence of
      text operators. The first pass tracks position and length of the
      string. Then an array is allocated of the indicated length and a
      second pass fills it with the actual characters.
      
      The two passes must be close carbon copies of each other or a mismatch
      between the predetermined length and the actual number of characters
      produced might occur and cause the assertion "txtlen == idx" to fail.
      
      This code structure is obviously bad, a text book example of why code
      duplication should be avoided. Nevertheless, before rewriting it
      entirely, this patch at least corrects an immediate bug.
      
      Fixes #44.
      222781c8
    • Sven M. Hallberg's avatar
      get rid of ts variable in act_txtobj · fbbf2c68
      Sven M. Hallberg authored
      The node member of TextState_T seems to be written only in one place in
      parse_pagenode(), and in such a way that the assertion "ts->node == node"
      must always hold. So we might as well assign node where it said ts->node
      and get rid of ts completely.
      fbbf2c68
    • Sven M. Hallberg's avatar
      access text state consistently through node · 76cb6955
      Sven M. Hallberg authored
      This one line going through another variable seems to spurious.
      Note that ts is always equal to &node->ts.
      76cb6955
    • Sven M. Hallberg's avatar
      df03908f
    • Sven M. Hallberg's avatar
      avoid an assert in parse_fonts · dee6c415
      Sven M. Hallberg authored
      This is an assertion of the type that catches an error (in user-supplied
      data) that should be handled, namely the case where the /Font entry
      of a dictionary is expected to be itself a dictionary but isn't.
      The code already contains a path for the case where the /Font entry
      is missing (return false) and I suppose the same, including the
      TODO item "figure out how to handle", might as well apply instead
      of the assertion.
      
      Fixes #45.
      dee6c415
  3. Feb 28, 2023
  4. Feb 27, 2023
  5. Feb 17, 2023
  6. Jan 13, 2023
  7. Jan 06, 2023
  8. Jan 05, 2023
  9. Dec 21, 2022
  10. Dec 20, 2022
    • Sven M. Hallberg's avatar
      style/comment · e10c9f98
      Sven M. Hallberg authored
      e10c9f98
    • Sven M. Hallberg's avatar
      lzw: simplify grammar by using h_bind to choose code length · 8e6bcd9c
      Sven M. Hallberg authored
      This replaces the validations on code9 etc. with one continuation that
      picks the appropriate parser.
      
      Also relaxes the parser to allow further output codes after the table is
      full. Looking at the spec, it seems to me at this times that the
      requirement for a clear code when the table is full is a requirement on
      producers of PDF files, but not on the file format itself. As far as I
      understand, conforming files can be created by a non-conforming process.
      
      Note: The implementation uses a slight trick to handle the last code
      (4095) correctly. Quoting the comment in act_output():
      
          Rather than going through the effort of ensuring that the last
          code is only updated once, we simply assign one more code as a
          dummy.
      
      So, the table is now 4097 entries in actual size. The last one will
      receive a bogus update every cycle, so that the last real code does not.
      This is less work than actually detecting and avoiding the bogus updates.
      8e6bcd9c
  11. Dec 19, 2022
Loading