Bug 19218 - Poppler should not give compile time warnings
Summary: Poppler should not give compile time warnings
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-21 07:51 UTC by Hib Eris
Modified: 2008-12-26 13:57 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
patch-1-Fix_compile_warning_about_uninitialized_variable (640 bytes, patch)
2008-12-21 07:51 UTC, Hib Eris
Details | Splinter Review
patch-2-Fix_compile_warning_on_format_type (728 bytes, patch)
2008-12-21 07:53 UTC, Hib Eris
Details | Splinter Review
patch-3-Fix_compile_warnings_on_signed-unsigned_comparison (3.39 KB, patch)
2008-12-21 07:53 UTC, Hib Eris
Details | Splinter Review
patch-4-Fix_compile_warning_on_format_not_a_string_literal (570 bytes, patch)
2008-12-21 07:54 UTC, Hib Eris
Details | Splinter Review
patch-5-Fix_compile_warning_on_ambiguous_else (895 bytes, patch)
2008-12-21 07:54 UTC, Hib Eris
Details | Splinter Review
patch-6-Fix_warning_to_suggest_parentheses_inside_shift (729 bytes, patch)
2008-12-21 07:54 UTC, Hib Eris
Details | Splinter Review
patch-7-Fix_compile_warning_to_suggest_parentheses_and-or (1.63 KB, patch)
2008-12-21 07:55 UTC, Hib Eris
Details | Splinter Review
new-patch-3-Fix_compile_warnings_on_signed-unsigned_comparison (2.41 KB, patch)
2008-12-22 09:05 UTC, Hib Eris
Details | Splinter Review

Description Hib Eris 2008-12-21 07:51:59 UTC
Created attachment 21350 [details] [review]
patch-1-Fix_compile_warning_about_uninitialized_variable

Compiling poppler on Ubuntu, I get lots of warnings from the compiler.

I have 7 patches to fix most of these.

After these 7 patches, for me the only remaining warnings are about not using the result of fwrite, which are errors that should be fixed in my opinion.
Comment 1 Hib Eris 2008-12-21 07:53:24 UTC
Created attachment 21351 [details] [review]
patch-2-Fix_compile_warning_on_format_type
Comment 2 Hib Eris 2008-12-21 07:53:53 UTC
Created attachment 21352 [details] [review]
patch-3-Fix_compile_warnings_on_signed-unsigned_comparison
Comment 3 Hib Eris 2008-12-21 07:54:13 UTC
Created attachment 21353 [details] [review]
patch-4-Fix_compile_warning_on_format_not_a_string_literal
Comment 4 Hib Eris 2008-12-21 07:54:35 UTC
Created attachment 21354 [details] [review]
patch-5-Fix_compile_warning_on_ambiguous_else
Comment 5 Hib Eris 2008-12-21 07:54:58 UTC
Created attachment 21355 [details] [review]
patch-6-Fix_warning_to_suggest_parentheses_inside_shift
Comment 6 Hib Eris 2008-12-21 07:55:30 UTC
Created attachment 21356 [details] [review]
patch-7-Fix_compile_warning_to_suggest_parentheses_and-or
Comment 7 Albert Astals Cid 2008-12-21 12:31:09 UTC
patch 1 commited
Comment 8 Albert Astals Cid 2008-12-21 12:32:34 UTC
patch 2 is for the glib people, Carlos?
Comment 9 Albert Astals Cid 2008-12-21 12:34:45 UTC
Patch 4 commited
Comment 10 Albert Astals Cid 2008-12-21 12:35:41 UTC
Patch 5 commited
Comment 11 Albert Astals Cid 2008-12-21 13:00:03 UTC
Patch 6 commited
Comment 12 Albert Astals Cid 2008-12-21 13:09:17 UTC
Patch 7 commited.
Comment 13 Albert Astals Cid 2008-12-21 14:05:09 UTC
Most of your patch 3 is wrong, see how

int nObjects = INT_MAX;
if (nObjects*(int)sizeof(int)/sizeof(int) != nObjects)
    printf("UEEEEEEE\n");

Warns you that you are about to overflow, but

int nObjects = INT_MAX;
if (nObjects*(int)sizeof(int)/(int)sizeof(int) != nObjects)
    printf("UEEEEEEE\n");

does not
Comment 14 Albert Astals Cid 2008-12-21 14:09:35 UTC
All patches commited, except 2 which i'm waiting on input from Carlos and parts of 3 that were wrong.
Comment 15 Carlos Garcia Campos 2008-12-22 00:29:51 UTC
(In reply to comment #14)
> All patches commited, except 2 which i'm waiting on input from Carlos

committed 2. 

> and parts of 3 that were wrong.
> 

Comment 16 Hib Eris 2008-12-22 09:04:41 UTC
(In reply to comment #13)
> Most of your patch 3 is wrong, see how
> 
> int nObjects = INT_MAX;
> if (nObjects*(int)sizeof(int)/sizeof(int) != nObjects)
>     printf("UEEEEEEE\n");
> 
> Warns you that you are about to overflow, but
> 
> int nObjects = INT_MAX;
> if (nObjects*(int)sizeof(int)/(int)sizeof(int) != nObjects)
>     printf("UEEEEEEE\n");
> 
> does not
> 

I see... the code did not really make sense to me, now I understand it a little more. I will provide a new patch, please tell me if it is any better.
Comment 17 Hib Eris 2008-12-22 09:05:32 UTC
Created attachment 21405 [details] [review]
new-patch-3-Fix_compile_warnings_on_signed-unsigned_comparison
Comment 18 Albert Astals Cid 2008-12-26 13:57:05 UTC
I've commited my own code for fix patch number 3 warnings.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.