Removed several warnings, code style fixes too.

This commit is contained in:
barrett 2012-10-19 15:23:16 +00:00
parent 9cb0ef099e
commit bd165cf8d6
3 changed files with 37 additions and 58 deletions

View File

@ -40,9 +40,9 @@ Emoconfig::Emoconfig(const char* xmlfile): BMessage()
off_t size; off_t size;
settings->GetSize(&size); settings->GetSize(&size);
if (size) { if (size) {
void* buffer = malloc(size); void* buffer = malloc((size_t)size);
size = settings->Read(buffer, size); size = settings->Read(buffer, (size_t)size);
XML_Parse(fParser, (const char*)buffer, size, true); XML_Parse(fParser, (const char*)buffer, (int)size, true);
free(buffer); free(buffer);
} }
delete settings; delete settings;

View File

@ -80,25 +80,25 @@ struct SoftBreak {
}; };
struct URL { struct URL {
int32 fOffset; int fOffset;
int32 fLength; int fLength;
BString fUrl; BString fUrl;
URL (const char* address, int32 off, int32 len) : URL(const char* address, int off, int len)
:
fOffset (off), fOffset (off),
fLength (len), fLength (len),
fUrl (address) fUrl (address) {}
{ }
}; };
typedef BObjectList<URL> urllist; typedef BObjectList<URL> urllist;
struct SoftBreakEnd { struct SoftBreakEnd {
int fOffset; float fOffset;
SoftBreakEnd (int16 offset) SoftBreakEnd(float offset)
: fOffset (offset) :
{ } fOffset(offset) {}
}; };
struct FontColor { struct FontColor {
@ -138,37 +138,19 @@ struct Line {
~Line (void); ~Line (void);
void Append ( void Append(const char* buffer, int len,
const char* buffer, float width, Theme* fTheme,
int len, int fore, int back, int font);
float width,
Theme* fTheme,
int fore,
int back,
int font);
void FigureSpaces (void); void FigureSpaces (void);
void FigureFontColors ( void FigureFontColors(int pos, int fore, int back, int font);
int pos, void FigureEdges(Theme* fTheme, float width);
int fore, void SoftBreaks(Theme* fTheme, float width);
int back,
int font);
void FigureEdges (
Theme* fTheme,
float width);
void SoftBreaks (
Theme* fTheme,
float width);
void AddSoftBreak(SoftBreakEnd , float&, void AddSoftBreak(SoftBreakEnd , float&,
int&, int16&, float&, float&, Theme*); int&, int16&, float&, float&, Theme*);
int CountChars(int pos, int len);
int16 CountChars (int pos, int len);
size_t SetStamp(const char*, bool); size_t SetStamp(const char*, bool);
void SelectWord(int*, int*); void SelectWord(int*, int*);
}; };
@ -2064,7 +2046,7 @@ void
Line::AddSoftBreak (SoftBreakEnd sbe, float& start, int& fText_place, Line::AddSoftBreak (SoftBreakEnd sbe, float& start, int& fText_place,
int16& font, float& width, float& start_width, Theme* theme) int16& font, float& width, float& start_width, Theme* theme)
{ {
fText_place = sbe.fOffset; fText_place = (int)sbe.fOffset;
if (fSoftie_size < fSoftie_used + 1) { if (fSoftie_size < fSoftie_used + 1) {
SoftBreak* new_softies; SoftBreak* new_softies;
@ -2157,11 +2139,11 @@ Line::SoftBreaks (Theme* theme, float start_width)
|| fSpaces[space_place - 1] < fText_place) { || fSpaces[space_place - 1] < fText_place) {
// everything fits.. how wonderful (but we want at least one softbreak) // everything fits.. how wonderful (but we want at least one softbreak)
if (fEdge_count == 0) { if (fEdge_count == 0) {
AddSoftBreak (SoftBreakEnd(fLength - 1), start, fText_place, font, width, start_width, theme); AddSoftBreak((SoftBreakEnd(fLength - 1)), start, fText_place, font, width, start_width, theme);
break; break;
} }
int16 i (fEdge_count - 1); int i (fEdge_count - 1);
while (fEdges[i] == 0) while (fEdges[i] == 0)
--i; --i;
@ -2187,13 +2169,13 @@ Line::SoftBreaks (Theme* theme, float start_width)
// we encountered more than one space, so we rule out having to // we encountered more than one space, so we rule out having to
// split the word, if the current word will fit within the bounds // split the word, if the current word will fit within the bounds
int16 ccount1, ccount2; int ccount1, ccount2;
--space_place; --space_place;
ccount1 = fSpaces[space_place]; ccount1 = (int)fSpaces[space_place];
ccount2 = fSpaces[space_place+1] - ccount1; ccount2 = (int)fSpaces[space_place+1] - ccount1;
int16 i (ccount1 - 1); int i = ccount1 - 1;
while (fEdges[i] == 0) while (fEdges[i] == 0)
--i; --i;
@ -2216,10 +2198,10 @@ Line::SoftBreaks (Theme* theme, float start_width)
fBottom -= 1; fBottom -= 1;
} }
int16 int
Line::CountChars (int pos, int len) Line::CountChars (int pos, int len)
{ {
int16 ccount (0); int ccount (0);
if (pos >= fLength) if (pos >= fLength)
return ccount; return ccount;
@ -2227,7 +2209,7 @@ Line::CountChars (int pos, int len)
if (pos + len > fLength) if (pos + len > fLength)
len = fLength - pos; len = fLength - pos;
register int16 i = pos; register int i = pos;
while (i < pos + len) { while (i < pos + len) {
i += UTF8_CHAR_LEN(fText[i]); i += UTF8_CHAR_LEN(fText[i]);
++ccount; ++ccount;
@ -2243,7 +2225,7 @@ Line::SetStamp (const char* format, bool was_on)
int32 i (0); int32 i (0);
if (was_on) { if (was_on) {
int16 offset (fFcs[4].fOffset + 1); int offset (fFcs[4].fOffset + 1);
if (fUrls) { if (fUrls) {
for (i = 0; i < fUrls->CountItems(); i++) for (i = 0; i < fUrls->CountItems(); i++)
@ -2329,7 +2311,7 @@ Line::SetStamp (const char* format, bool was_on)
void void
Line::SelectWord (int* start, int* end) Line::SelectWord (int* start, int* end)
{ {
int16 start_tmp (*start), end_tmp (*end); int start_tmp (*start), end_tmp (*end);
while (start_tmp > 0 && fText[start_tmp-1] != ' ') while (start_tmp > 0 && fText[start_tmp-1] != ' ')
start_tmp--; start_tmp--;

View File

@ -182,9 +182,6 @@ public:
void ScrollToBottom(void); void ScrollToBottom(void);
void ScrollToSelection(void); void ScrollToSelection(void);
}; };
#endif #endif