[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pdf-devel] Error report, few patches and part of testcases for pdf_
From: |
Aleksander Morgado |
Subject: |
Re: [pdf-devel] Error report, few patches and part of testcases for pdf_time module. |
Date: |
Thu, 16 Apr 2009 18:41:03 +0200 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090318) |
Hi Łukasz,
Good to know that errors started to show up in the time module!
Jose, I would push those changes to the repo, and once done start fixing
time module, not before.
Cheers,
-Aleksander
Łukasz Spintzyk wrote:
> Errors gnuPDF
>
> 1. pdf_time_init() -->pdf_time_context_init()
> pdf_dealloc(time_struct) cause an error.
> From man localtime
> "The return value points to a statically allocated struct which
> might be overwritten by subsequent calls to any of the date and time
> functions."
> so line
> pdf_dealloc(time_struct);
> is not necessary.
> Patch fixing this error(by deleting this line) -->pdf_time_init.patch
>
> 2. pdf_i64_div
> Division 1 by 86400 cause floating point exception
> I have added another testcase to base/types/pdf-i64-div.c
> which is in patch file pdf_i64_div_newTest.patch
> This is that testcase
> /*
> * Test: pdf_i64_div_005
> * Description:
> * Checks if the division 1/86400 gives 0.
> * Success conditions:
> * The call should not produce an error
> */
> START_TEST(pdf_i64_div_005)
> {
> pdf_status_t p_status = PDF_OK;
> pdf_i64_t div1,div2,dest;
> div1 = pdf_i64_new(0,1);
> div2 = pdf_i64_new(0,24*3600);
>
>
>
> #ifndef PDF_USE_BUILTIN_64BIT_SUPPORT
> pdf_i64_div(&dest,div1,div2, &p_status);
> fail_if(p_status != PDF_OK);
> fail_if(dest.low != 0);
> fail_if(dest.high != 0);
> #else
> pdf_i64_div(&dest,div1,div2, &p_status);
> fail_if(dest != 0);
> #endif
>
> }
> END_TEST
> patch name with that testcase is pdf_i64_div_newTest.patch
>
>
> 3. Functions :
> pdf_status_t pdf_time_add_span()
> pdf_status_t pdf_time_sub_span()
> pdf_status_t pdf_time_diff()
> and other functions in file src/base/pdf-time.c doesn't propagete
> status variable, but always return PDF_OK.
> Some of them don't check if pointer argument is null.
>
> 4. Patch which adds 22 of 38 files with testcases of pdf_time module to
> Makefile.am and runtests.c .
> Patch name is pdf_time_22of32_tests.patch
> To this mail are also appended archive time.tar.gz with that
> testcases, which schould be put in
> trunk/torture/unit/base/time/
>
> 5. pdf_time_add_cal_span
> Both test from base/time/pdf_time_add_cal_span fails because of this
> same error.
> In test case 002 there is:
> /* test objects */
> pdf_time_t time27, time28,time29, time30;
> struct pdf_time_cal_span_s calspan;
> /* initializing
> ....
> */
> calspan.sign = PDF_FALSE;
> calspan.years=0;
> calspan.months=1;
> calspan.hours=0;
> calspan.minutes=0;
> calspan.seconds=0;
>
> calspan.days=27;
> pdf_time_add_cal_span(time27, &calspan);
> calspan.days=28;
> pdf_time_add_cal_span(time28, &calspan);
> calspan.days=29;
> pdf_time_add_cal_span(time29, &calspan);
> calspan.days=30;
> pdf_time_add_cal_span(time30, &calspan);
>
> fail_if(pdf_time_cmp(time27, time28) == 0);
> fail_if(pdf_time_cmp(time28, time29) == 0);
> fail_if(pdf_time_cmp(time29, time30) == 0);
>
> All of pdf_time_t objects have the same time, where only time27
> schould be valid and point to 1970-02-28 00:00:00. time28 schould point
> to 1970-03-01 00:00:00 and so on.
>
> 6. pdf_time_from_string
> 6 of 13 test fails. This are mainly easy to fix bugs. I had put some
> comments in tests that fails.
>
>
> Thats is all rest of test schould be added in 2-3 weeks. However fixing
> bug in pdf_time_add_cal_span would be handful since it can broke other
> tests.
> BTW if you agree with bugs from point 3 and 6 i can write a patch for
> that functions too.
>
> thanks
> Luke
>