Sanitizing source files in Skia_Periodic_House_Keeping

git-svn-id: http://skia.googlecode.com/svn/trunk@6930 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
skia.committer@gmail.com 2012-12-22 02:02:33 +00:00
parent db0b3e099f
commit b89a03c890
11 changed files with 832 additions and 832 deletions

View File

@ -77,7 +77,7 @@ int intersect(const _Line& a, const _Line& b, double aRange[2], double bRange[2]
double b0 = bPtr[0];
double b1 = bPtr[2];
// OPTIMIZATION: restructure to reject before the divide
// e.g., if ((a0 - b0) * (a0 - a1) < 0 || abs(a0 - b0) > abs(a0 - a1))
// e.g., if ((a0 - b0) * (a0 - a1) < 0 || abs(a0 - b0) > abs(a0 - a1))
// (except efficient)
double at0 = (a0 - b0) / (a0 - a1);
double at1 = (a0 - b1) / (a0 - a1);

View File

@ -1784,7 +1784,7 @@ public:
}
return oIndex;
}
bool betweenTs(int lesser, double testT, int greater) {
if (lesser > greater) {
SkTSwap<int>(lesser, greater);
@ -3015,7 +3015,7 @@ public:
bool isVertical() const {
return fBounds.fLeft == fBounds.fRight;
}
bool isVertical(int start, int end) const {
return (*SegmentVertical[fVerb])(fPts, start, end);
}
@ -3729,7 +3729,7 @@ public:
SkPath::Verb verb() const {
return fVerb;
}
int windingAtTX(double tHit, int tIndex, bool crossOpp) const {
if (approximately_zero(tHit - t(tIndex))) { // if we hit the end of a span, disregard
return SK_MinS32;
@ -3741,7 +3741,7 @@ public:
return updateWinding(tIndex, endIndex);
}
int windingAtT(double tHit, int tIndex, bool crossOpp, bool& zeroDx) const {
int windingAtT(double tHit, int tIndex, bool crossOpp, bool& zeroDx) const {
if (approximately_zero(tHit - t(tIndex))) { // if we hit the end of a span, disregard
return SK_MinS32;
}

View File

@ -1,8 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// Callstacker.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
// stdafx.cpp : source file that includes just the standard includes
// Callstacker.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@ -1,15 +1,15 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here

View File

@ -1,8 +1,8 @@
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>

View File

@ -1,65 +1,65 @@
#include <stdlib.h>
#define CANVAS_PATH "CANVAS_PATH"
class SkFile {
FILE* file;
bool busted;
char* sz;
mutable int i;
public:
SkFile(unsigned long id) {
file = NULL;
busted = false;
sz = new char[100000];
set(id);
i = 100;
}
~SkFile() {
delete sz;
if (file) {
fclose(file);
}
}
void set(unsigned long id) {
if (busted) {
return;
}
if (file == NULL) {
char sz[10000];
sprintf(sz, "%s\\%ul.callstacks.txt", getenv(CANVAS_PATH), id);
file = fopen(sz, "a");
if (file == NULL) {
busted = true;
}
fprintf(file, "\n\n\nNEW SESSION, just coliding ids ... should generate a new file ideally ... \n\n\n");
}
}
void appendLine(const char* sz) const {
if (busted) {
return;
}
fprintf(file, "%s\n", sz);
}
void dump(bool flush = false) const {
if (busted) {
return;
}
LightSymbol::GetCallStack(sz, 100000, " >- ");
appendLine(sz);
i--;
if (i < 0 || flush) {
i = 100;
fflush(file);
}
}
};
#include <stdlib.h>
#define CANVAS_PATH "CANVAS_PATH"
class SkFile {
FILE* file;
bool busted;
char* sz;
mutable int i;
public:
SkFile(unsigned long id) {
file = NULL;
busted = false;
sz = new char[100000];
set(id);
i = 100;
}
~SkFile() {
delete sz;
if (file) {
fclose(file);
}
}
void set(unsigned long id) {
if (busted) {
return;
}
if (file == NULL) {
char sz[10000];
sprintf(sz, "%s\\%ul.callstacks.txt", getenv(CANVAS_PATH), id);
file = fopen(sz, "a");
if (file == NULL) {
busted = true;
}
fprintf(file, "\n\n\nNEW SESSION, just coliding ids ... should generate a new file ideally ... \n\n\n");
}
}
void appendLine(const char* sz) const {
if (busted) {
return;
}
fprintf(file, "%s\n", sz);
}
void dump(bool flush = false) const {
if (busted) {
return;
}
LightSymbol::GetCallStack(sz, 100000, " >- ");
appendLine(sz);
i--;
if (i < 0 || flush) {
i = 100;
fflush(file);
}
}
};

View File

@ -1,50 +1,50 @@
#ifndef __LIGHT_SYMBOLS__
#define __LIGHT_SYMBOLS__
#define LS_TRACE(functionName,fileId,lineNumber) LightSymbol __lstr(functionName,fileId,lineNumber);
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <pthread.h>
#include <Windows.h>
typedef char* SZ;
#define LIGHT_SYMBOLS_FILE "LIGHT_SYMBOLS_FILE"
class LightSymbol {
const char* sym;
int fileId;
int lineNumber;
LightSymbol* parentFrame;
typedef LightSymbol* PLightSymbol;
static PLightSymbol lsFrames[1000];
static HANDLE handleFrames[1000];
static SZ* fileNames;
static bool busted;
public:
LightSymbol(const char* sym, int fileId, int lineNumber);
~LightSymbol();
static bool GetCallStack(char* sz, int len, const char* separator);
private:
static LightSymbol** getThreadFrameContainer();
bool GetCallStackCore(char* sz, int len, const char* separator) const ;
static LightSymbol* GetCurrentFrame() ;
static void SetCurrentFrame(LightSymbol* ls) ;
static const char* trim(char* sz) ;
};
#endif
#ifndef __LIGHT_SYMBOLS__
#define __LIGHT_SYMBOLS__
#define LS_TRACE(functionName,fileId,lineNumber) LightSymbol __lstr(functionName,fileId,lineNumber);
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <pthread.h>
#include <Windows.h>
typedef char* SZ;
#define LIGHT_SYMBOLS_FILE "LIGHT_SYMBOLS_FILE"
class LightSymbol {
const char* sym;
int fileId;
int lineNumber;
LightSymbol* parentFrame;
typedef LightSymbol* PLightSymbol;
static PLightSymbol lsFrames[1000];
static HANDLE handleFrames[1000];
static SZ* fileNames;
static bool busted;
public:
LightSymbol(const char* sym, int fileId, int lineNumber);
~LightSymbol();
static bool GetCallStack(char* sz, int len, const char* separator);
private:
static LightSymbol** getThreadFrameContainer();
bool GetCallStackCore(char* sz, int len, const char* separator) const ;
static LightSymbol* GetCurrentFrame() ;
static void SetCurrentFrame(LightSymbol* ls) ;
static const char* trim(char* sz) ;
};
#endif

View File

@ -49,11 +49,11 @@ public:
uint32_t size() const { return this->bytesWritten(); }
void reset();
// size MUST be multiple of 4
uint32_t* reserve(size_t size) {
SkASSERT(SkAlign4(size) == size);
Block* block = fTail;
if (NULL == block || block->available() < size) {
block = this->doReserve(size);
@ -219,13 +219,13 @@ private:
void* ptr = this->base() + offset;
return (uint32_t*)ptr;
}
void rewind() {
fNext = NULL;
fAllocatedSoFar = 0;
// keep fSizeOfBlock as is
}
static Block* Create(size_t size) {
SkASSERT(SkIsAlign4(size));
Block* block = (Block*)sk_malloc_throw(sizeof(Block) + size);
@ -251,7 +251,7 @@ private:
enum {
MIN_BLOCKSIZE = sizeof(SkWriter32::Block) + sizeof(intptr_t)
};
Block fExternalBlock;
Block* fHead;
Block* fTail;
@ -265,7 +265,7 @@ private:
}
Block* newBlock(size_t bytes);
// only call from reserve()
Block* doReserve(size_t bytes);

View File

@ -43,7 +43,7 @@ void SkWriter32::reset() {
void SkWriter32::reset(void* storage, size_t storageSize) {
this->reset();
storageSize &= ~3; // trunc down to multiple of 4
if (storageSize > 0 && SkIsAlign4((intptr_t)storage)) {
fHead = fTail = fExternalBlock.initFromStorage(storage, storageSize);

View File

@ -194,7 +194,7 @@ static void Tests(skiatest::Reporter* reporter) {
writer.reset(storage, sizeof(storage));
testWritePad(reporter, &writer);
// try overflowing the storage-block
uint32_t smallStorage[8];
writer.reset(smallStorage, sizeof(smallStorage));