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

RESOLVED FIXED in mozilla15

Status

()

Core
Graphics: Layers
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

(Blocks: 1 bug)

Trunk
mozilla15
x86_64
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

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.
Created attachment 619617 [details] [diff] [review]
fix v1
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #619617 - Flags: review?(chrislord.net)

Comment 2

5 years ago
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.

Comment 4

5 years ago
(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
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.