Sorry, now I missed this mail while working on your previous mail and patch!

Could you please check the current state in SVN?
I think the date handling after your previous patch was ok - do you agree?

Can you send a patch only for the PdfDate clean up please?

Thanks,
 Dominik

On Wed, Jan 6, 2021 at 7:54 PM Federico Kircheis <
federico.kirch...@gmail.com> wrote:

> Hi,
>
> I've created 3 patches with svn diff to apply one after the other, feel
> free to reorg if you think the work can be splitted in some other,
> better way
>
> I've moved some implementation detail to the .cpp file, to avoid leaking
> internal details in the header file (see last patch)
> Then I've splitted the parsing function in multiple parts, as it was
> getting a little bit to complex handling everything at once.
> The third patch improves the parsing, and with that all tests are good.
>
> I've tried using the same coding style already used for PdfDate.
>
> Federico
>
> On 05/01/2021 23.18, Federico Kircheis wrote:
> > Hi Dominik, I rechecked the algorithm, D:20120530235959Z00'00' does not
> > fail anymore, i did not parse correctly Z.
> >
> >
> > D:2012010
> > D:20120
> >
> > are still failing... the solution is a bit more convoluted:
> >
> > Instead of returning a simple, boolean, ParseFixLenNumber should return
> > one of possible 3 states, something like an enum {OK, Missing, Error}.
> >
> >
> > I think something like
> >
> > ----
> > enum EParseFixLenNumberResult {OK, Missing, Error};
> > EParseFixLenNumberResult PdfDate::ParseFixLenNumber(const char *&in,
> > unsigned int length, int min, int max, int &ret_)
> > {
> >      if ( in == NULL || *in == '\0') return Missing;
> >      int ret = 0;
> >      for(unsigned int i=0;i<length;i++)
> >      {
> >          if ( in == NULL || !isdigit(*in)) return Error;
> >          ret = ret*10+ (*in-'0');
> >          in++;
> >      }
> >      if ( ret < min || ret > max ) return Error;
> >      ret_ = ret;
> >      return Ok;
> > }
> > ----
> >
> > should do the work, but first one should decide if those optional fields
> > should really be treated as errors...
> >
> > Federico
>
>
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to