fix warnings on Mac in src/views

Fix these class of warnings:
- unused functions
- unused locals
- sign mismatch
- missing function prototypes
- missing newline at end of file
- 64 to 32 bit truncation

The changes prefer to link in dead code in the debug build
with 'if (false)' than to comment it out, but trivial cases
are commented out or sometimes deleted if it appears to be
a copy/paste error.
Review URL: https://codereview.appspot.com/6300045

git-svn-id: http://skia.googlecode.com/svn/trunk@4176 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
caryclark@google.com 2012-06-06 12:04:00 +00:00
parent 42639cddc3
commit 679ab317cd
5 changed files with 19 additions and 26 deletions

View File

@ -150,7 +150,7 @@ void SkStaticTextView::onDraw(SkCanvas* canvas)
void SkStaticTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
#if 0
if (false) { // avoid bit rot, suppress warning
this->INHERITED::onInflate(dom, node);
int index;
@ -177,8 +177,12 @@ void SkStaticTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
if ((node = dom.getFirstChild(node, "paint")) != NULL &&
(node = dom.getFirstChild(node, "screenplay")) != NULL)
{
// FIXME: Including inflate_paint causes Windows build to fail -- it complains
// that SKListView::SkListView is undefined.
#if 0
inflate_paint(dom, node, &fPaint);
}
#endif
}
}
}

View File

@ -12,16 +12,6 @@
#include "SkStream.h"
#include "SkSystemEventTypes.h"
#ifdef SK_DEBUG
static void assert_no_attr(const SkDOM& dom, const SkDOM::Node* node, const char attr[])
{
const char* value = dom.findAttr(node, attr);
if (value)
SkDebugf("unknown attribute %s=\"%s\"\n", attr, value);
}
#else
#define assert_no_attr(dom, node, attr)
#endif
/*
I have moved this to SkWidgetViews.h
enum SkinEnum {

View File

@ -24,7 +24,7 @@
}
- (id)initWithFrame:(NSRect)frameRect {
if (self = [super initWithFrame:frameRect]) {
if ((self = [super initWithFrame:frameRect])) {
self = [self initWithDefaults];
[self setUpWindow];
}
@ -40,7 +40,7 @@
- (void)setUpWindow {
if (NULL != fWind) {
fWind->setVisibleP(true);
fWind->resize(self.frame.size.width, self.frame.size.height,
fWind->resize((int) self.frame.size.width, (int) self.frame.size.height,
SkBitmap::kARGB_8888_Config);
}
}
@ -55,7 +55,7 @@
- (void)resizeSkView:(NSSize)newSize {
if (NULL != fWind && (fWind->width() != newSize.width || fWind->height() != newSize.height)) {
fWind->resize(newSize.width, newSize.height);
fWind->resize((int) newSize.width, (int) newSize.height);
glClear(GL_STENCIL_BUFFER_BIT);
[fGLContext update];
}
@ -185,16 +185,15 @@ static SkKey raw2key(UInt32 raw)
SkKey key = raw2key([event keyCode]);
if (kNONE_SkKey != key)
fWind->handleKeyUp(key);
else{
unichar c = [[event characters] characterAtIndex:0];
}
// else
// unichar c = [[event characters] characterAtIndex:0];
}
- (void)mouseDown:(NSEvent *)event {
NSPoint p = [event locationInWindow];
if ([self mouse:p inRect:[self bounds]] && NULL != fWind) {
NSPoint loc = [self convertPoint:p fromView:nil];
fWind->handleClick(loc.x, loc.y, SkView::Click::kDown_State, self);
fWind->handleClick((int) loc.x, (int) loc.y, SkView::Click::kDown_State, self);
}
}
@ -202,7 +201,7 @@ static SkKey raw2key(UInt32 raw)
NSPoint p = [event locationInWindow];
if ([self mouse:p inRect:[self bounds]] && NULL != fWind) {
NSPoint loc = [self convertPoint:p fromView:nil];
fWind->handleClick(loc.x, loc.y, SkView::Click::kMoved_State, self);
fWind->handleClick((int) loc.x, (int) loc.y, SkView::Click::kMoved_State, self);
}
}
@ -210,7 +209,7 @@ static SkKey raw2key(UInt32 raw)
NSPoint p = [event locationInWindow];
if ([self mouse:p inRect:[self bounds]] && NULL != fWind) {
NSPoint loc = [self convertPoint:p fromView:nil];
fWind->handleClick(loc.x, loc.y, SkView::Click::kMoved_State, self);
fWind->handleClick((int) loc.x, (int) loc.y, SkView::Click::kMoved_State, self);
}
}
@ -218,7 +217,7 @@ static SkKey raw2key(UInt32 raw)
NSPoint p = [event locationInWindow];
if ([self mouse:p inRect:[self bounds]] && NULL != fWind) {
NSPoint loc = [self convertPoint:p fromView:nil];
fWind->handleClick(loc.x, loc.y, SkView::Click::kUp_State, self);
fWind->handleClick((int) loc.x, (int) loc.y, SkView::Click::kUp_State, self);
}
}
@ -292,7 +291,7 @@ CGLContextObj createGLContext(int msaaSampleCount) {
[fGLContext makeCurrentContext];
glViewport(0, 0, self.bounds.size.width, self.bounds.size.width);
glViewport(0, 0, (int) self.bounds.size.width, (int) self.bounds.size.width);
glClearColor(0, 0, 0, 0);
glClearStencil(0);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

View File

@ -50,7 +50,7 @@
- (void)registerMenus:(const SkTDArray<SkOSMenu*>*)menus {
fMenus = menus;
for (NSUInteger i = 0; i < fMenus->count(); ++i) {
for (int i = 0; i < fMenus->count(); ++i) {
[self loadMenu:(*fMenus)[i]];
}
}
@ -289,4 +289,4 @@
[cell setButtonType:NSSwitchButton];
return cell;
}
@end
@end

View File

@ -12,7 +12,7 @@
@implementation SkSampleNSView
- (id)initWithDefaults {
if (self = [super initWithDefaults]) {
if ((self = [super initWithDefaults])) {
fWind = new SampleWindow(self, *_NSGetArgc(), *_NSGetArgv(), NULL);
}
return self;