fix warnings on Mac in ssamplecode
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/6301044
git-svn-id: http://skia.googlecode.com/svn/trunk@4183 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index fd19e89..5d3296d 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -406,7 +406,7 @@
// registers GMs as Samples
// This can't be performed during static initialization because it could be
// run before GMRegistry has been fully built.
-void SkGMRegistyToSampleRegistry() {
+static void SkGMRegistyToSampleRegistry() {
static bool gOnce;
static AutoUnrefArray fRegisters;
@@ -599,6 +599,8 @@
// some GMs rely on having a skiagm::GetGr function defined
namespace skiagm {
+ // FIXME: this should be moved into a header
+ GrContext* GetGr();
GrContext* GetGr() { return SampleCode::GetGr(); }
}
@@ -1173,6 +1175,7 @@
#include "SkColorPriv.h"
+#if 0 // UNUSED
static void reverseRedAndBlue(const SkBitmap& bm) {
SkASSERT(bm.config() == SkBitmap::kARGB_8888_Config);
uint8_t* p = (uint8_t*)bm.getPixels();
@@ -1188,6 +1191,7 @@
p += 4;
}
}
+#endif
void SampleWindow::saveToPdf()
{
@@ -1631,6 +1635,7 @@
return this->INHERITED::onQuery(query);
}
+#if 0 // UNUSED
static void cleanup_for_filename(SkString* name) {
char* str = name->writable_str();
for (size_t i = 0; i < name->size(); i++) {
@@ -1642,6 +1647,7 @@
}
}
}
+#endif
bool SampleWindow::onHandleChar(SkUnichar uni) {
{
@@ -2329,11 +2335,17 @@
}
}
+// FIXME: this should be in a header
+SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv);
SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) {
-// test();
+ if (false) { // avoid bit rot, suppress warning
+ test();
+ }
return new SampleWindow(hwnd, argc, argv, NULL);
}
+// FIXME: this should be in a header
+void get_preferred_size(int* x, int* y, int* width, int* height);
void get_preferred_size(int* x, int* y, int* width, int* height) {
*x = 10;
*y = 50;
@@ -2341,6 +2353,8 @@
*height = 480;
}
+// FIXME: this should be in a header
+void application_init();
void application_init() {
// setenv("ANDROID_ROOT", "../../../data", 0);
#ifdef SK_BUILD_FOR_MAC
@@ -2350,6 +2364,8 @@
SkEvent::Init();
}
+// FIXME: this should be in a header
+void application_term();
void application_term() {
SkEvent::Term();
SkGraphics::Term();