Style fixes in librunview, solved a regression, solved some warnings.

This commit is contained in:
barrett 2012-10-18 23:16:36 +00:00
parent fdd6eb021b
commit 9cb0ef099e

View File

@ -103,9 +103,6 @@ struct SoftBreakEnd {
struct FontColor {
int fOffset;
// G++ is stupid. We only need 2 bits
// for fWhich, but the compiler has a bug
// and warns us against fWhich == 2
int fWhich;
int fIndex;
};
@ -114,8 +111,8 @@ struct Line {
char* fText;
time_t fStamp;
urllist* fUrls;
int16* fSpaces;
int16* fEdges;
float* fSpaces;
float* fEdges;
FontColor* fFcs;
SoftBreak* fSofties;
float fTop;
@ -167,7 +164,7 @@ struct Line {
float width);
void AddSoftBreak (SoftBreakEnd , float&,
uint16&, int16&, float&, float&, Theme*);
int&, int16&, float&, float&, Theme*);
int16 CountChars (int pos, int len);
size_t SetStamp (const char*, bool);
@ -1841,7 +1838,7 @@ Line::FigureSpaces (void)
offset += n + 1;
}
fSpaces = new int16 [count];
fSpaces = new float [count];
offset = 0;
while ((n = strcspn (buffer + offset, spacers)) < fLength - offset) {
@ -1938,7 +1935,7 @@ Line::FigureEdges (
float width)
{
delete [] fEdges;
fEdges = new int16 [fLength];
fEdges = new float [fLength];
int cur_fFcs (0), next_fFcs (0), cur_font (0);
@ -2010,19 +2007,19 @@ Line::FigureEdges (
// This is not perfect, because we are including the left edge,
// but BFont::GetEdges doesn't seem to work as we'd like
int16 i;
int size = 0;
int i;
float size = 0;
// if(tr)
size = tr->Size();
int incrementor = (fEdge_count > 0) ? fEdges[fEdge_count - 1] : 0;
float incrementor = (fEdge_count > 0) ? fEdges[fEdge_count - 1] : 0;
for (i = 0; i < ccount; ++i) {
incrementor += eshift[i] * size;
incrementor += (float)eshift[i] * size;
fEdges[fEdge_count+i] = (int16) incrementor;
fEdges[fEdge_count+i] = incrementor;
// this little backfTracking routine is necessary in the case where an fFcs change
// comes immediately after a UTF8-char, since all but the first edge will be 0
@ -2036,10 +2033,10 @@ Line::FigureEdges (
}
for (i = fFcs[cur_fFcs].fOffset; i < fFcs[cur_fFcs].fOffset + seglen;) {
int32 len (UTF8_CHAR_LEN (fText[i]) - 1);
int len (UTF8_CHAR_LEN (fText[i]) - 1);
if (len) {
int16 k;
int k;
for (k = fEdge_count + ccount - 1; k > i; --k)
fEdges[k + len] = fEdges[k];
@ -2064,7 +2061,7 @@ Line::FigureEdges (
void
Line::AddSoftBreak (SoftBreakEnd sbe, float& start, uint16& fText_place,
Line::AddSoftBreak (SoftBreakEnd sbe, float& start, int& fText_place,
int16& font, float& width, float& start_width, Theme* theme)
{
fText_place = sbe.fOffset;
@ -2100,7 +2097,7 @@ Line::AddSoftBreak (SoftBreakEnd sbe, float& start, uint16& fText_place,
tr->GetHeight (&fh);
height = ceil (fh.ascent + fh.descent + fh.leading);
height = (float)ceil (fh.ascent + fh.descent + fh.leading);
if (fSofties[fSoftie_used].fHeight < height)
fSofties[fSoftie_used].fHeight = height;
if (fSofties[fSoftie_used].fAscent < fh.ascent)
@ -2131,11 +2128,11 @@ Line::AddSoftBreak (SoftBreakEnd sbe, float& start, uint16& fText_place,
void
Line::SoftBreaks (Theme* theme, float start_width)
{
float margin (theme->TextMargin());
float width (start_width);
float start (0.0);
uint16 fText_place (0);
int16 space_place (0);
float margin = theme->TextMargin();
float width = start_width;
float start = 0.0;
int fText_place = 0;
int space_place = 0;
int16 font (0);
fSoftie_used = 0;
@ -2147,7 +2144,7 @@ Line::SoftBreaks (Theme* theme, float start_width)
while (fText_place < fLength) {
while (space_place < fSpace_count) {
if (fEdges[fSpaces[space_place]] - start > width)
if (fEdges[(int)fSpaces[space_place]] - start > width)
break;
++space_place;
@ -2183,7 +2180,8 @@ Line::SoftBreaks (Theme* theme, float start_width)
fText_place += UTF8_CHAR_LEN (fText[fText_place]);
}
AddSoftBreak (SoftBreakEnd(fText_place), start, fText_place, font, width, start_width, theme);
AddSoftBreak (SoftBreakEnd(fText_place), start,
fText_place, font, width, start_width, theme);
continue;
}
@ -2200,7 +2198,8 @@ Line::SoftBreaks (Theme* theme, float start_width)
--i;
if (fEdges[ccount1 + ccount2] - fEdges[i] < width - margin) {
AddSoftBreak (SoftBreakEnd(fSpaces[space_place]), start, fText_place, font, width, start_width, theme);
AddSoftBreak (SoftBreakEnd(fSpaces[space_place]), start,
fText_place, font, width, start_width, theme);
continue;
}