Closed Bug 750356 Opened 12 years ago Closed 12 years ago

ReusableTileStoreOGL.cpp:16:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Categories

(Core :: Graphics: Layers, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla15

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Build warnings:

../../../mozilla/gfx/layers/opengl/ReusableTileStoreOGL.cpp: In destructor ‘mozilla::layers::ReusableTileStoreOGL::~ReusableTileStoreOGL()’:
../../../mozilla/gfx/layers/opengl/ReusableTileStoreOGL.cpp:16:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
../../../mozilla/gfx/layers/opengl/ReusableTileStoreOGL.cpp: In member function ‘void mozilla::layers::ReusableTileStoreOGL::HarvestTiles(mozilla::layers::TiledLayerBufferOGL*, const nsIntSize&, const nsIntRegion&, const nsIntRegion&, const gfxSize&, const gfxSize&)’:
../../../mozilla/gfx/layers/opengl/ReusableTileStoreOGL.cpp:39:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]


This is from loops like
> for (int i = 0; i < mTiles.Length();)
where mTiles.Length() is unsigned.
Attached patch fix v1Splinter Review
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #619617 - Flags: review?(chrislord.net)
Comment on attachment 619617 [details] [diff] [review]
fix v1

Review of attachment 619617 [details] [diff] [review]:
-----------------------------------------------------------------

Looks fine, and my apologies for letting this in - Instead of using PRUInt32, it might be nice to use size_t, as that's what's used elsewhere in the file/gfx (and what nsTArray returns, I think?)
Attachment #619617 - Flags: review?(chrislord.net) → review+
(In reply to Chris Lord [:cwiiis] from comment #2)
> Looks fine, and my apologies for letting this in - Instead of using
> PRUInt32, it might be nice to use size_t, as that's what's used elsewhere in
> the file/gfx (and what nsTArray returns, I think?)

Nope, nsTArray uses PRUint32. Internally it calls it ::size_type / ::index_type:
  http://mxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTArray.h#219

So we should technically be using...
 nsTArray< nsAutoPtr<ReusableTiledTextureOGL> >::size_type 
or
 nsTArray< nsAutoPtr<ReusableTiledTextureOGL> >::index_type

...but that's super-long, so I just used what it was typedef'd to.

But if you prefer size_t, I can switch it.
(In reply to Daniel Holbert [:dholbert] from comment #3)
> (In reply to Chris Lord [:cwiiis] from comment #2)
> > Looks fine, and my apologies for letting this in - Instead of using
> > PRUInt32, it might be nice to use size_t, as that's what's used elsewhere in
> > the file/gfx (and what nsTArray returns, I think?)
> 
> Nope, nsTArray uses PRUint32. Internally it calls it ::size_type /
> ::index_type:
>   http://mxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTArray.h#219
> 
> So we should technically be using...
>  nsTArray< nsAutoPtr<ReusableTiledTextureOGL> >::size_type 
> or
>  nsTArray< nsAutoPtr<ReusableTiledTextureOGL> >::index_type
> 
> ...but that's super-long, so I just used what it was typedef'd to.
> 
> But if you prefer size_t, I can switch it.

Nope, PRUint32 is good with me, I was under a false impression - if there are any cases of size_t elsewhere in the file, feel free to change those too.
Cool -- I added one s/size_t/PRUint32/ tweak, for consistency, and pushed:
 https://hg.mozilla.org/integration/mozilla-inbound/rev/69b13912439f

Thanks!
Target Milestone: --- → mozilla15
https://hg.mozilla.org/mozilla-central/rev/69b13912439f
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: