Warning fixes (from Andrea Pessino)

This commit is contained in:
ocornut 2014-09-24 18:57:52 +01:00
parent fec4232c79
commit 8eafb373f7
1 changed files with 6 additions and 6 deletions

12
imgui.h
View File

@ -109,8 +109,8 @@ public:
inline void push_back(const value_type& v) { if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); Data[Size++] = v; } inline void push_back(const value_type& v) { if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); Data[Size++] = v; }
inline void pop_back() { IM_ASSERT(Size > 0); Size--; } inline void pop_back() { IM_ASSERT(Size > 0); Size--; }
inline iterator erase(const_iterator it) { IM_ASSERT(it >= begin() && it < end()); const int off = it - begin(); memmove(Data + off, Data + off + 1, (Size - off - 1) * sizeof(value_type)); Size--; return Data + off; } inline iterator erase(const_iterator it) { IM_ASSERT(it >= begin() && it < end()); const ptrdiff_t off = it - begin(); memmove(Data + off, Data + off + 1, (Size - off - 1) * sizeof(value_type)); Size--; return Data + off; }
inline void insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= begin() && it <= end()); const int off = it - begin(); if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); if (off < (int)Size) memmove(Data + off + 1, Data + off, (Size - off) * sizeof(value_type)); Data[off] = v; Size++; } inline void insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= begin() && it <= end()); const ptrdiff_t off = it - begin(); if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); if (off < (int)Size) memmove(Data + off + 1, Data + off, (Size - off) * sizeof(value_type)); Data[off] = v; Size++; }
}; };
#endif // #ifndef ImVector #endif // #ifndef ImVector
@ -475,9 +475,9 @@ private:
// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" // Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
struct ImGuiTextFilter struct ImGuiTextFilter
{ {
struct TextRange struct TextRange
{ {
const char* b; const char* b;
const char* e; const char* e;
TextRange() { b = e = NULL; } TextRange() { b = e = NULL; }
@ -486,7 +486,7 @@ struct ImGuiTextFilter
const char* end() const { return e; } const char* end() const { return e; }
bool empty() const { return b == e; } bool empty() const { return b == e; }
char front() const { return *b; } char front() const { return *b; }
static bool isblank(char c) { return c == ' ' || c == '\t'; } static bool isblank(char c) { return c == ' ' || c == '\t'; }
void trim_blanks() { while (b < e && isblank(*b)) b++; while (e > b && isblank(*(e-1))) e--; } void trim_blanks() { while (b < e && isblank(*b)) b++; while (e > b && isblank(*(e-1))) e--; }
void split(char separator, ImVector<TextRange>& out); void split(char separator, ImVector<TextRange>& out);
}; };