uppsrc: Fixed some clang warnings

git-svn-id: svn://ultimatepp.org/upp/trunk@5808 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-02-15 18:22:42 +00:00
parent aa2ce5e0ae
commit d8cd08c64f
18 changed files with 49 additions and 56 deletions

View file

@ -541,11 +541,14 @@ String GetDownloadFolder()
String GetPathXdg(String xdgConfigHome, String xdgConfigDirs)
{
String ret = "";
if (FileExists(ret = AppendFileName(xdgConfigHome, "user-dirs.dirs"))) ;
else if (FileExists(ret = AppendFileName(xdgConfigDirs, "user-dirs.defaults"))) ;
else if (FileExists(ret = AppendFileName(xdgConfigDirs, "user-dirs.dirs"))) ;
return ret;
String ret;
if(FileExists(ret = AppendFileName(xdgConfigHome, "user-dirs.dirs")))
return ret;
if(FileExists(ret = AppendFileName(xdgConfigDirs, "user-dirs.defaults")))
return ret;
if(FileExists(ret = AppendFileName(xdgConfigDirs, "user-dirs.dirs")))
return ret;
return Null;
}
String GetPathDataXdg(String fileConfig, const char *folder)

View file

@ -70,7 +70,7 @@ public:
void SetLastError() { SetError(errno); }
#endif
int GetError() const { return errorcode; }
void ClearError() { style &= ~STRM_ERROR; errorcode = 0; }
void ClearError() { style = style & ~STRM_ERROR; errorcode = 0; }
int64 GetPos() const { return dword(ptr - buffer) + pos; }
bool IsEof() const { return ptr >= rdlim && _IsEof(); }

View file

@ -349,7 +349,7 @@ public:
class Logc {
dword data;
static int LSGN(dword d) { return int16(d & 0x7fff | ((d & 0x4000) << 1)); }
static int LSGN(dword d) { return int16((d & 0x7fff) | ((d & 0x4000) << 1)); }
public:
bool operator==(Logc q) const { return data == q.data; }

View file

@ -254,7 +254,7 @@ dword ParseKeyDesc(CParser& p)
}
if(p.IsNumber()) {
uint32 q = p.ReadNumber(16);
if(q >= 0 && q <= 9)
if(q <= 9)
return f | (K_0 + q);
return f | q;
}

View file

@ -313,6 +313,8 @@ private:
int AsNdx(const String& id) { return id_ndx.FindAdd(id); }
using Ctrl::IsModified;
public: // temporary (TRC 06/07/28) // will be removed!
Ctrl& SetCtrl(int i, int j, Ctrl *newctrl) { return SetCtrl(i, j, newctrl, true, true); }

View file

@ -343,7 +343,7 @@ public:
static void Execute(Callback1<Bar&> proc, Point p) { Execute(GetActiveCtrl(), proc, p); }
static void Execute(Callback1<Bar&> proc) { Execute(proc, GetMousePos()); }
bool IsEmpty() { return item.IsEmpty(); }
bool IsEmpty() const { return item.IsEmpty(); }
void Clear();
static const Style& StyleDefault();
@ -364,6 +364,8 @@ public:
};
class ToolButton : public Ctrl, public Bar::Item {
using Ctrl::Key;
public:
virtual void Paint(Draw& w);
virtual void MouseEnter(Point, dword);

View file

@ -62,6 +62,9 @@ private:
struct FileOrder;
using ColumnList::GetStdSize;
using ColumnList::Paint;
protected:
enum {
TIMEID_STARTEDIT = ColumnList::TIMEID_COUNT,

View file

@ -5,8 +5,7 @@
NAMESPACE_UPP
class MenuItemBase : public Ctrl, public Bar::Item
{
class MenuItemBase : public Ctrl, public Bar::Item {
public:
virtual Bar::Item& Text(const char *text);
virtual Bar::Item& Key(dword key);
@ -23,6 +22,8 @@ public:
virtual dword GetAccessKeys() const;
virtual void AssignAccessKeys(dword used);
using Ctrl::Key;
protected:
enum {
NOTHING, CHECK0, CHECK1, RADIO0, RADIO1
@ -86,6 +87,7 @@ private:
void SendHelpLine();
void ClearHelpLine();
using MenuItemBase::Key;
protected:
virtual int GetVisualState();
@ -151,6 +153,7 @@ public:
private:
int GetState();
using MenuItemBase::Key;
public:
TopSubMenuItem() { NoInitFocus(); }
@ -173,6 +176,7 @@ public:
private:
int GetState();
using MenuItemBase::Key;
public:
TopMenuItem() { NoInitFocus(); }

View file

@ -155,6 +155,8 @@ private:
void SyncInfo();
void SyncAfterSync(Ptr<Ctrl> restorefocus);
using Ctrl::Close;
protected:
virtual void SetOption(int id);
void SyncTree();
@ -298,8 +300,6 @@ public:
Size GetTreeSize() const { return treesize; }
void Dump();
TreeCtrl& NoCursor(bool b = true) { nocursor = b; if(b) KillCursor(); return *this; }
TreeCtrl& NoRoot(bool b = true) { noroot = b; Dirty(); Refresh(); return *this; }
TreeCtrl& LevelCx(int cx) { levelcx = cx; Dirty(); return *this; }

View file

@ -621,6 +621,8 @@ private:
friend class StyleKeysDlg;
friend class StyleManager;
using Ctrl::Accept;
protected:
enum {
TIMEID_ENDSIZETRACKING = Ctrl::TIMEID_COUNT,

View file

@ -494,12 +494,12 @@ void TabBar::DoStacking()
t.stackid = GetStackId(t);
}
// Create stacks
Vector< Vector<Tab> > tstack;
Vector< Array<Tab> > tstack;
for (int i = 0; i < tabs.GetCount(); i++) {
Tab &ti = tabs[i];
if (ti.stack < 0) {
ti.stack = tstack.GetCount();
Vector<Tab> &ttabs = tstack.Add();
Array<Tab> &ttabs = tstack.Add();
ttabs.Add(ti);
for (int j = i + 1; j < tabs.GetCount(); j++) {
Tab &tj = tabs[j];
@ -2136,7 +2136,7 @@ void TabBar::DragAndDrop(Point p, PasteClip& d)
count = ix - tab;
}
// Copy tabs
Vector<Tab> stacktemp;
Array<Tab> stacktemp;
stacktemp.SetCount(count);
//Copy(&stacktemp[0], &tabs[tab], count);
for(int i = 0; i < count; i++)

View file

@ -177,7 +177,7 @@ public:
virtual void Serialize(Stream& s);
Vector<TabItem> items;
Array<TabItem> items;
int itn;
Tab() : id(-1), stack(-1), visible(true), itn(0) { items.SetCount(5); }
@ -197,6 +197,7 @@ public:
TabItem& AddImage(const Image& img, int side = LEFT);
TabItem& AddSpace(int space = 5, int side = LEFT);
virtual ~Tab() {}
};
// Tab sorting structures
@ -216,6 +217,8 @@ protected:
int last;
virtual void Serialize(Stream& s);
String ToString() const { return Format("%s - %d", name, count); }
virtual ~Group() {}
};
struct TabValueSort : public TabSort {
@ -230,10 +233,10 @@ protected:
protected:
TabScrollBar sc;
Vector<Group> groups;
Vector<Tab> tabs;
Vector<int> separators;
int active;
Array<Group> groups;
Array<Tab> tabs;
Array<int> separators;
int active;
int id;
int highlight;
@ -308,6 +311,9 @@ protected:
static int GetStyleHeight();
static Image AlignImage(int align, const Image& img);
static Value AlignValue(int align, const Value& v, const Size& isz);
using Ctrl::GetStdSize;
using Ctrl::Close;
protected:
virtual void Paint(Draw& w);
@ -438,7 +444,7 @@ public:
TabBar& AllowReorder(bool v = true) { allowreorder = v; return *this; }
bool IsGrouping() const { return grouping; }
bool HasGroupSeparators() const { return separators; }
bool HasGroupSeparators() const { return separators.GetCount(); }
bool IsStacking() const { return stacking; }
bool IsShowInactive() const { return inactivedisabled; }

View file

@ -262,7 +262,7 @@ int TextCompareCtrl::MeasureLength(const char *text) const
String TextCompareCtrl::ExpandTabs(const char *text) const
{
String out;
for(char c; c = *text++;)
for(char c; (c = *text++);)
if(c == '\t')
out.Cat(' ', tabsize - out.GetLength() % tabsize);
else

View file

@ -40,7 +40,7 @@ const char *AfterHeading(const char *txt, const char *heading)
{
while(*heading)
if(*txt++ != *heading++)
return false;
return NULL;
return txt;
}

View file

@ -167,35 +167,6 @@ bool Ide::SearchInFile(const String& fn, const String& pattern, bool wholeword,
return true;
}
static bool RawFileMatch(const char *pattern, const char *file, const char *& endptr)
{
for(char c; (c = *pattern++) != 0;)
if(c == '*')
{
do
if(RawFileMatch(pattern, file, endptr))
return true;
while(*file++);
endptr = pattern;
return false;
}
else if(c == '?')
{
if(*file++ == 0)
{
endptr = pattern - 1;
return false;
}
}
else if(ToLower(c) != ToLower(*file++))
{
endptr = pattern - 1;
return false;
}
endptr = file;
return true;
}
int CharFilterFindFileMask(int c)
{
return ToUpper(ToAscii(c));

View file

@ -578,7 +578,7 @@ struct HelpModule : public IdeModule {
d->topic = &ide->doc;
return d;
}
return false;
return NULL;
}
virtual void Serialize(Stream& s) {
s % recent_topic;

View file

@ -76,7 +76,7 @@ struct IconDesModule : public IdeModule {
delete d;
return NULL;
}
return false;
return NULL;
}
virtual void Serialize(Stream& s) {
int version = 0;

View file

@ -100,7 +100,7 @@ public:
String desc;
Color c;
Font f;
void operator()(int fa,const String& description,const struct Color& color,bool italic){
void operator()(int fa,const String& description,const class Color& color,bool italic){
n=fa;
desc=description;
c=color;