fix multiple warnings (e.g. hidden virtuals, unused static functions)
update freetype version-check for const
git-svn-id: http://skia.googlecode.com/svn/trunk@66 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkColorPriv.h b/include/core/SkColorPriv.h
index 041c038..4d41374 100644
--- a/include/core/SkColorPriv.h
+++ b/include/core/SkColorPriv.h
@@ -402,7 +402,7 @@
#define SkG32To4444(g) ((unsigned)(g) >> 4)
#define SkB32To4444(b) ((unsigned)(b) >> 4)
-static U8CPU SkReplicateNibble(unsigned nib)
+static inline U8CPU SkReplicateNibble(unsigned nib)
{
SkASSERT(nib <= 0xF);
return (nib << 4) | nib;
@@ -618,7 +618,7 @@
Transforms a normal ARGB_8888 into the same byte order as
expanded ARGB_4444, but keeps each component 8bits
*/
-static uint32_t SkExpand_8888(SkPMColor c)
+static inline uint32_t SkExpand_8888(SkPMColor c)
{
return (((c >> SK_R32_SHIFT) & 0xFF) << 24) |
(((c >> SK_G32_SHIFT) & 0xFF) << 8) |
@@ -629,7 +629,7 @@
/* Undo the operation of SkExpand_8888, turning the argument back into
a SkPMColor.
*/
-static SkPMColor SkCompact_8888(uint32_t c)
+static inline SkPMColor SkCompact_8888(uint32_t c)
{
return (((c >> 24) & 0xFF) << SK_R32_SHIFT) |
(((c >> 8) & 0xFF) << SK_G32_SHIFT) |
@@ -641,7 +641,7 @@
but this routine just keeps the high 4bits of each component in the low
4bits of the result (just like a newly expanded PMColor16).
*/
-static uint32_t SkExpand32_4444(SkPMColor c)
+static inline uint32_t SkExpand32_4444(SkPMColor c)
{
return (((c >> (SK_R32_SHIFT + 4)) & 0xF) << 24) |
(((c >> (SK_G32_SHIFT + 4)) & 0xF) << 8) |
diff --git a/include/core/SkMMapStream.h b/include/core/SkMMapStream.h
index 600c621..be063bd 100644
--- a/include/core/SkMMapStream.h
+++ b/include/core/SkMMapStream.h
@@ -24,7 +24,7 @@
SkMMAPStream(const char filename[]);
virtual ~SkMMAPStream();
- virtual void setMemory(const void* data, size_t length);
+ virtual void setMemory(const void* data, size_t length, bool);
private:
int fFildes;
void* fAddr;
diff --git a/src/core/SkBitmapProcState_sample.h b/src/core/SkBitmapProcState_sample.h
index 41a08eb..954afca 100644
--- a/src/core/SkBitmapProcState_sample.h
+++ b/src/core/SkBitmapProcState_sample.h
@@ -13,7 +13,7 @@
#elif (DSTSIZE == 16)
#define BITMAPPROC_MEMSET(ptr, value, n) sk_memset16(ptr, value, n)
#else
- #error "unsupported DSTSIZE
+ #error "unsupported DSTSIZE"
#endif
static void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s,
diff --git a/src/core/SkMMapStream.cpp b/src/core/SkMMapStream.cpp
index 2aee945..017bcaf 100644
--- a/src/core/SkMMapStream.cpp
+++ b/src/core/SkMMapStream.cpp
@@ -45,10 +45,10 @@
this->closeMMap();
}
-void SkMMAPStream::setMemory(const void* data, size_t length)
+void SkMMAPStream::setMemory(const void* data, size_t length, bool copyData)
{
this->closeMMap();
- this->INHERITED::setMemory(data, length);
+ this->INHERITED::setMemory(data, length, copyData);
}
void SkMMAPStream::closeMMap()
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index 1371ecc..02d8135 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -599,7 +599,8 @@
Note: this routine takes care of unpremultiplying the RGB values when we
have alpha in the colortable, since png doesn't support premul colors
*/
-static int pack_palette(SkColorTable* ctable, png_color* SK_RESTRICT palette,
+static inline int pack_palette(SkColorTable* ctable,
+ png_color* SK_RESTRICT palette,
png_byte* SK_RESTRICT trans, bool hasAlpha) {
SkAutoLockColors alc(ctable);
const SkPMColor* SK_RESTRICT colors = alc.colors();
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 5855eec..5adeb13 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -625,7 +625,7 @@
#define ft2sk(x) SkFixedToScalar((x) << 10)
-#if FREETYPE_MAJOR >= 2 && FREETYPE_MINOR >= 3
+#if FREETYPE_MAJOR >= 2 && FREETYPE_MINOR >= 2
#define CONST_PARAM const
#else // older freetype doesn't use const here
#define CONST_PARAM
diff --git a/src/ports/SkFontHost_linux.cpp b/src/ports/SkFontHost_linux.cpp
index c00e226..75d4cba 100644
--- a/src/ports/SkFontHost_linux.cpp
+++ b/src/ports/SkFontHost_linux.cpp
@@ -500,6 +500,7 @@
return SkFontHost::FindTypeface(NULL, NULL, (SkTypeface::Style)style);
#endif
sk_throw();
+ return NULL;
}
///////////////////////////////////////////////////////////////////////////////
@@ -594,7 +595,7 @@
SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[])
{
- return SkFontHost::CreateTypeface(SkNEW_ARGS(SkMMAPStream, (path)));
+ return NULL;
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/utils/SkOSFile.cpp b/src/utils/SkOSFile.cpp
index c8eeeea..68f90ca 100644
--- a/src/utils/SkOSFile.cpp
+++ b/src/utils/SkOSFile.cpp
@@ -4,36 +4,36 @@
static U16* concat_to_16(const char src[], const char suffix[])
{
- size_t i, len = strlen(src);
- size_t len2 = 3 + (suffix ? strlen(suffix) : 0);
- U16* dst = (U16*)sk_malloc_throw((len + len2) * sizeof(U16));
+ size_t i, len = strlen(src);
+ size_t len2 = 3 + (suffix ? strlen(suffix) : 0);
+ U16* dst = (U16*)sk_malloc_throw((len + len2) * sizeof(U16));
- for (i = 0; i < len; i++)
- dst[i] = src[i];
+ for (i = 0; i < len; i++)
+ dst[i] = src[i];
- if (i > 0 && dst[i-1] != '/')
- dst[i++] = '/';
- dst[i++] = '*';
+ if (i > 0 && dst[i-1] != '/')
+ dst[i++] = '/';
+ dst[i++] = '*';
- if (suffix)
- {
- while (*suffix)
- dst[i++] = *suffix++;
- }
- dst[i] = 0;
- SkASSERT(i + 1 <= len + len2);
+ if (suffix)
+ {
+ while (*suffix)
+ dst[i++] = *suffix++;
+ }
+ dst[i] = 0;
+ SkASSERT(i + 1 <= len + len2);
- return dst;
+ return dst;
}
SkUTF16_Str::SkUTF16_Str(const char src[])
{
- size_t len = strlen(src);
+ size_t len = strlen(src);
- fStr = (U16*)sk_malloc_throw((len + 1) * sizeof(U16));
- for (size_t i = 0; i < len; i++)
- fStr[i] = src[i];
- fStr[i] = 0;
+ fStr = (U16*)sk_malloc_throw((len + 1) * sizeof(U16));
+ for (size_t i = 0; i < len; i++)
+ fStr[i] = src[i];
+ fStr[i] = 0;
}
////////////////////////////////////////////////////////////////////////////
@@ -44,84 +44,84 @@
SkOSFile::Iter::Iter(const char path[], const char suffix[]) : fHandle(0), fPath16(nil)
{
- this->reset(path, suffix);
+ this->reset(path, suffix);
}
SkOSFile::Iter::~Iter()
{
- sk_free(fPath16);
- if (fHandle)
- ::FindClose(fHandle);
+ sk_free(fPath16);
+ if (fHandle)
+ ::FindClose(fHandle);
}
void SkOSFile::Iter::reset(const char path[], const char suffix[])
{
- if (fHandle)
- {
- ::FindClose(fHandle);
- fHandle = 0;
- }
- if (path == nil)
- path = "";
+ if (fHandle)
+ {
+ ::FindClose(fHandle);
+ fHandle = 0;
+ }
+ if (path == nil)
+ path = "";
- sk_free(fPath16);
- fPath16 = concat_to_16(path, suffix);
+ sk_free(fPath16);
+ fPath16 = concat_to_16(path, suffix);
}
static bool is_magic_dir(const U16 dir[])
{
- // return true for "." and ".."
- return dir[0] == '.' && (dir[1] == 0 || dir[1] == '.' && dir[2] == 0);
+ // return true for "." and ".."
+ return dir[0] == '.' && (dir[1] == 0 || dir[1] == '.' && dir[2] == 0);
}
static bool get_the_file(HANDLE handle, SkString* name, WIN32_FIND_DATAW* dataPtr, bool getDir)
{
- WIN32_FIND_DATAW data;
+ WIN32_FIND_DATAW data;
- if (dataPtr == nil)
- {
- if (::FindNextFileW(handle, &data))
- dataPtr = &data;
- else
- return false;
- }
+ if (dataPtr == nil)
+ {
+ if (::FindNextFileW(handle, &data))
+ dataPtr = &data;
+ else
+ return false;
+ }
- for (;;)
- {
- if (getDir)
- {
- if ((dataPtr->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && !is_magic_dir(dataPtr->cFileName))
- break;
- }
- else
- {
- if (!(dataPtr->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
- break;
- }
- if (!::FindNextFileW(handle, dataPtr))
- return false;
- }
- // if we get here, we've found a file/dir
- if (name)
- name->setUTF16(dataPtr->cFileName);
- return true;
+ for (;;)
+ {
+ if (getDir)
+ {
+ if ((dataPtr->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && !is_magic_dir(dataPtr->cFileName))
+ break;
+ }
+ else
+ {
+ if (!(dataPtr->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+ break;
+ }
+ if (!::FindNextFileW(handle, dataPtr))
+ return false;
+ }
+ // if we get here, we've found a file/dir
+ if (name)
+ name->setUTF16(dataPtr->cFileName);
+ return true;
}
bool SkOSFile::Iter::next(SkString* name, bool getDir)
{
- WIN32_FIND_DATAW data;
- WIN32_FIND_DATAW* dataPtr = nil;
+ WIN32_FIND_DATAW data;
+ WIN32_FIND_DATAW* dataPtr = nil;
- if (fHandle == 0) // our first time
- {
- if (fPath16 == nil || *fPath16 == 0) // check for no path
- return false;
+ if (fHandle == 0) // our first time
+ {
+ if (fPath16 == nil || *fPath16 == 0) // check for no path
+ return false;
- fHandle = ::FindFirstFileW(fPath16, &data);
- if (fHandle != 0 && fHandle != (HANDLE)~0)
- dataPtr = &data;
- }
- return fHandle != (HANDLE)~0 && get_the_file(fHandle, name, dataPtr, getDir);
+ fHandle = ::FindFirstFileW(fPath16, &data);
+ if (fHandle != 0 && fHandle != (HANDLE)~0)
+ dataPtr = &data;
+ }
+ return fHandle != (HANDLE)~0 && get_the_file(fHandle, name, dataPtr, getDir);
}
#elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX)
@@ -140,83 +140,83 @@
SkOSFile::Iter::Iter(const char path[], const char suffix[]) : fDIR(0)
{
- this->reset(path, suffix);
+ this->reset(path, suffix);
}
SkOSFile::Iter::~Iter()
{
- if (fDIR)
- ::closedir(fDIR);
+ if (fDIR)
+ ::closedir(fDIR);
}
void SkOSFile::Iter::reset(const char path[], const char suffix[])
{
- if (fDIR)
- {
- ::closedir(fDIR);
- fDIR = 0;
- }
+ if (fDIR)
+ {
+ ::closedir(fDIR);
+ fDIR = 0;
+ }
- fPath.set(path);
- if (path)
- {
- fDIR = ::opendir(path);
- fSuffix.set(suffix);
- }
- else
- fSuffix.reset();
+ fPath.set(path);
+ if (path)
+ {
+ fDIR = ::opendir(path);
+ fSuffix.set(suffix);
+ }
+ else
+ fSuffix.reset();
}
// returns true if suffix is empty, or if str ends with suffix
static bool issuffixfor(const SkString& suffix, const char str[])
{
- size_t suffixLen = suffix.size();
- size_t strLen = strlen(str);
-
- return strLen >= suffixLen &&
- suffixLen == 0 ||
- memcmp(suffix.c_str(), str + strLen - suffixLen, suffixLen) == 0;
+ size_t suffixLen = suffix.size();
+ size_t strLen = strlen(str);
+
+ return strLen >= suffixLen &&
+ suffixLen == 0 ||
+ memcmp(suffix.c_str(), str + strLen - suffixLen, suffixLen) == 0;
}
#include <sys/stat.h>
bool SkOSFile::Iter::next(SkString* name, bool getDir)
{
- if (fDIR)
- {
- dirent* entry;
+ if (fDIR)
+ {
+ dirent* entry;
- while ((entry = ::readdir(fDIR)) != NULL)
- {
- struct stat s;
- SkString str(fPath);
+ while ((entry = ::readdir(fDIR)) != NULL)
+ {
+ struct stat s;
+ SkString str(fPath);
- if (!str.endsWith("/") && !str.endsWith("\\"))
- str.append("/");
- str.append(entry->d_name);
+ if (!str.endsWith("/") && !str.endsWith("\\"))
+ str.append("/");
+ str.append(entry->d_name);
- if (0 == stat(str.c_str(), &s))
- {
- if (getDir)
- {
- if (s.st_mode & S_IFDIR)
- break;
- }
- else
- {
- if (!(s.st_mode & S_IFDIR) && issuffixfor(fSuffix, entry->d_name))
- break;
- }
- }
- }
- if (entry) // we broke out with a file
- {
- if (name)
- name->set(entry->d_name);
- return true;
- }
- }
- return false;
+ if (0 == stat(str.c_str(), &s))
+ {
+ if (getDir)
+ {
+ if (s.st_mode & S_IFDIR)
+ break;
+ }
+ else
+ {
+ if (!(s.st_mode & S_IFDIR) && issuffixfor(fSuffix, entry->d_name))
+ break;
+ }
+ }
+ }
+ if (entry) // we broke out with a file
+ {
+ if (name)
+ name->set(entry->d_name);
+ return true;
+ }
+ }
+ return false;
}
#endif