Преглед на файлове

fixed 15 files out of 2730:

- removed 49 CR characters
 - removed 2 trailing whitespaces
 - replaced 1622 tabs with spaces
legacy
Lolbot lolbot преди 11 години
родител
ревизия
b078ba08ea
променени са 4 файла, в които са добавени 163 реда и са изтрити 163 реда
  1. +29
    -29
      src/gpu/vertexbuffer.cpp
  2. +59
    -59
      src/lol/base/string.h
  3. +32
    -32
      src/lol/gpu/vertexbuffer.h
  4. +43
    -43
      test/unit/string.cpp

+ 29
- 29
src/gpu/vertexbuffer.cpp Целия файл

@@ -600,44 +600,44 @@ void VertexDeclaration::AddStream(VertexStreamBase const &s)

int VertexDeclaration::GetStreamCount() const
{
return m_count ? m_streams[m_count - 1].index + 1 : 0;
return m_count ? m_streams[m_count - 1].index + 1 : 0;
}

VertexStreamBase VertexDeclaration::GetStream(int index) const
{
VertexStreamBase stream;
int n = 0;
int count = 0;
VertexStreamBase stream;
int n = 0;
int count = 0;

for (int i = 0; i < m_count; ++i)
{
if (m_streams[i].index != index)
continue;
for (int i = 0; i < m_count; ++i)
{
if (m_streams[i].index != index)
continue;

switch (m_streams[i].stream_type)
{
switch (m_streams[i].stream_type)
{
#define LOL_TYPE(T) \
case VertexStreamBase::Type##T: stream.AddStream<T>(n++, m_streams[i].usage); break;
LOL_TYPE(void)
LOL_TYPE(half) LOL_TYPE(f16vec2) LOL_TYPE(f16vec3) LOL_TYPE(f16vec4)
LOL_TYPE(float) LOL_TYPE(vec2) LOL_TYPE(vec3) LOL_TYPE(vec4)
LOL_TYPE(double) LOL_TYPE(dvec2) LOL_TYPE(dvec3) LOL_TYPE(dvec4)
LOL_TYPE(int8_t) LOL_TYPE(i8vec2) LOL_TYPE(i8vec3) LOL_TYPE(i8vec4)
LOL_TYPE(uint8_t) LOL_TYPE(u8vec2) LOL_TYPE(u8vec3) LOL_TYPE(u8vec4)
LOL_TYPE(int16_t) LOL_TYPE(i16vec2) LOL_TYPE(i16vec3) LOL_TYPE(i16vec4)
LOL_TYPE(uint16_t) LOL_TYPE(u16vec2) LOL_TYPE(u16vec3) LOL_TYPE(u16vec4)
LOL_TYPE(int32_t) LOL_TYPE(ivec2) LOL_TYPE(ivec3) LOL_TYPE(ivec4)
LOL_TYPE(uint32_t) LOL_TYPE(uvec2) LOL_TYPE(uvec3) LOL_TYPE(uvec4)
case VertexStreamBase::Type##T: stream.AddStream<T>(n++, m_streams[i].usage); break;
LOL_TYPE(void)
LOL_TYPE(half) LOL_TYPE(f16vec2) LOL_TYPE(f16vec3) LOL_TYPE(f16vec4)
LOL_TYPE(float) LOL_TYPE(vec2) LOL_TYPE(vec3) LOL_TYPE(vec4)
LOL_TYPE(double) LOL_TYPE(dvec2) LOL_TYPE(dvec3) LOL_TYPE(dvec4)
LOL_TYPE(int8_t) LOL_TYPE(i8vec2) LOL_TYPE(i8vec3) LOL_TYPE(i8vec4)
LOL_TYPE(uint8_t) LOL_TYPE(u8vec2) LOL_TYPE(u8vec3) LOL_TYPE(u8vec4)
LOL_TYPE(int16_t) LOL_TYPE(i16vec2) LOL_TYPE(i16vec3) LOL_TYPE(i16vec4)
LOL_TYPE(uint16_t) LOL_TYPE(u16vec2) LOL_TYPE(u16vec3) LOL_TYPE(u16vec4)
LOL_TYPE(int32_t) LOL_TYPE(ivec2) LOL_TYPE(ivec3) LOL_TYPE(ivec4)
LOL_TYPE(uint32_t) LOL_TYPE(uvec2) LOL_TYPE(uvec3) LOL_TYPE(uvec4)
#undef LOL_TYPE
}
++count;
}
}
++count;
}

while (count < 12)
stream.AddStream<void>(count++, VertexStreamBase::Typevoid);
while (count < 12)
stream.AddStream<void>(count++, VertexStreamBase::Typevoid);

return stream;
return stream;
}

//
@@ -678,7 +678,7 @@ VertexBuffer::~VertexBuffer()

size_t VertexBuffer::GetSize()
{
return m_data->m_size;
return m_data->m_size;
}

void *VertexBuffer::Lock(size_t offset, size_t size)


+ 59
- 59
src/lol/base/string.h Целия файл

@@ -117,65 +117,65 @@ public:
return String(&(*this)[start], count);
}

int IndexOf(const char token) const
{
for (int i = 0; i < Count(); ++i)
{
if ((*this)[i] == token)
return i;
}
return -1;
}
int IndexOf(const char* token) const
{
int token_len = strlen(token);
if (Count() < token_len)
return -1;
for (int i = 0; i < Count() - token_len + 1; ++i)
{
int j = 0;
for (; j < token_len; ++j)
{
if ((*this)[i + j] != token[j])
break;
}
if (j == token_len)
return i;
}
return -1;
}
int LastIndexOf(const char token) const
{
for (int i = Count() - 1; i >= 0; --i)
{
if ((*this)[i] == token)
return i;
}
return -1;
}
int LastIndexOf(const char* token) const
{
int token_len = strlen(token);
if (Count() < token_len)
return -1;
for (int i = Count() - token_len; i >= 0; --i)
{
int j = 0;
for (; j < token_len; ++j)
{
if ((*this)[i + j] != token[j])
break;
}
if (j == token_len)
return i;
}
return -1;
}
int IndexOf(const char token) const
{
for (int i = 0; i < Count(); ++i)
{
if ((*this)[i] == token)
return i;
}
return -1;
}
int IndexOf(const char* token) const
{
int token_len = strlen(token);
if (Count() < token_len)
return -1;
for (int i = 0; i < Count() - token_len + 1; ++i)
{
int j = 0;
for (; j < token_len; ++j)
{
if ((*this)[i + j] != token[j])
break;
}
if (j == token_len)
return i;
}
return -1;
}
int LastIndexOf(const char token) const
{
for (int i = Count() - 1; i >= 0; --i)
{
if ((*this)[i] == token)
return i;
}
return -1;
}
int LastIndexOf(const char* token) const
{
int token_len = strlen(token);
if (Count() < token_len)
return -1;
for (int i = Count() - token_len; i >= 0; --i)
{
int j = 0;
for (; j < token_len; ++j)
{
if ((*this)[i + j] != token[j])
break;
}
if (j == token_len)
return i;
}
return -1;
}

inline String operator +(String const &s) const
{


+ 32
- 32
src/lol/gpu/vertexbuffer.h Целия файл

@@ -29,7 +29,7 @@ public:
VertexBuffer(size_t size);
~VertexBuffer();

size_t GetSize();
size_t GetSize();

void *Lock(size_t offset, size_t size);
void Unlock();
@@ -159,35 +159,35 @@ public:
Typeuint32_t, Typeuvec2, Typeuvec3, Typeuvec4,
};

int GetSize() const
{
int size = 0, i = 0;
while (m_streams[i].size)
size += m_streams[i++].size;
return size;
}
int GetStreamCount() const
{
int i = 0;
while (m_streams[i].size) ++i;
return i;
}
VertexUsage GetUsage(int index) const
{
return m_streams[index].usage;
}
uint8_t GetType(int index) const
{
return m_streams[index].stream_type;
}
uint8_t GetSize(int index) const
{
return m_streams[index].size;
}
int GetSize() const
{
int size = 0, i = 0;
while (m_streams[i].size)
size += m_streams[i++].size;
return size;
}
int GetStreamCount() const
{
int i = 0;
while (m_streams[i].size) ++i;
return i;
}
VertexUsage GetUsage(int index) const
{
return m_streams[index].usage;
}
uint8_t GetType(int index) const
{
return m_streams[index].stream_type;
}
uint8_t GetSize(int index) const
{
return m_streams[index].size;
}

protected:

@@ -300,9 +300,9 @@ public:
ShaderAttrib attr11 = ShaderAttrib(),
ShaderAttrib attr12 = ShaderAttrib());

int GetStreamCount() const;
int GetStreamCount() const;

VertexStreamBase GetStream(int index) const;
VertexStreamBase GetStream(int index) const;

private:
void Initialize();


+ 43
- 43
test/unit/string.cpp Целия файл

@@ -149,51 +149,51 @@ LOLUNIT_FIXTURE(StringTest)
LOLUNIT_ASSERT(s4 == s5);
}

LOLUNIT_TEST(IndexOf)
{
LOLUNIT_TEST(IndexOf)
{
String s1 = "Hello World";
int i1 = s1.IndexOf('H');
int i2 = s1.IndexOf('W');
int i3 = s1.IndexOf('d');
int i4 = s1.IndexOf("Hello");
int i5 = s1.IndexOf("World");
int i6 = s1.IndexOf("lo");
int i7 = s1.IndexOf("Hello World");
int i8 = s1.IndexOf("Sup' dude");
LOLUNIT_ASSERT(i1 == 0);
LOLUNIT_ASSERT(i2 == 6);
LOLUNIT_ASSERT(i3 == 10);
LOLUNIT_ASSERT(i4 == i1);
LOLUNIT_ASSERT(i5 == i2);
LOLUNIT_ASSERT(i6 == 3);
LOLUNIT_ASSERT(i7 == 0);
LOLUNIT_ASSERT(i8 == -1);
}
LOLUNIT_TEST(LastIndexOf)
{
int i1 = s1.IndexOf('H');
int i2 = s1.IndexOf('W');
int i3 = s1.IndexOf('d');
int i4 = s1.IndexOf("Hello");
int i5 = s1.IndexOf("World");
int i6 = s1.IndexOf("lo");
int i7 = s1.IndexOf("Hello World");
int i8 = s1.IndexOf("Sup' dude");
LOLUNIT_ASSERT(i1 == 0);
LOLUNIT_ASSERT(i2 == 6);
LOLUNIT_ASSERT(i3 == 10);
LOLUNIT_ASSERT(i4 == i1);
LOLUNIT_ASSERT(i5 == i2);
LOLUNIT_ASSERT(i6 == 3);
LOLUNIT_ASSERT(i7 == 0);
LOLUNIT_ASSERT(i8 == -1);
}
LOLUNIT_TEST(LastIndexOf)
{
String s1 = "Hello World";
int i1 = s1.LastIndexOf('H');
int i2 = s1.LastIndexOf('W');
int i3 = s1.LastIndexOf('d');
int i4 = s1.LastIndexOf("Hello");
int i5 = s1.LastIndexOf("World");
int i6 = s1.LastIndexOf("lo");
int i7 = s1.LastIndexOf("Hello World");
int i8 = s1.LastIndexOf("Sup' dude");
int i9 = s1.LastIndexOf('l');
LOLUNIT_ASSERT(i1 == 0);
LOLUNIT_ASSERT(i2 == 6);
LOLUNIT_ASSERT(i3 == 10);
LOLUNIT_ASSERT(i4 == i1);
LOLUNIT_ASSERT(i5 == i2);
LOLUNIT_ASSERT(i6 == 3);
LOLUNIT_ASSERT(i7 == 0);
LOLUNIT_ASSERT(i8 == -1);
LOLUNIT_ASSERT(i9 == 9);
}};
int i1 = s1.LastIndexOf('H');
int i2 = s1.LastIndexOf('W');
int i3 = s1.LastIndexOf('d');
int i4 = s1.LastIndexOf("Hello");
int i5 = s1.LastIndexOf("World");
int i6 = s1.LastIndexOf("lo");
int i7 = s1.LastIndexOf("Hello World");
int i8 = s1.LastIndexOf("Sup' dude");
int i9 = s1.LastIndexOf('l');
LOLUNIT_ASSERT(i1 == 0);
LOLUNIT_ASSERT(i2 == 6);
LOLUNIT_ASSERT(i3 == 10);
LOLUNIT_ASSERT(i4 == i1);
LOLUNIT_ASSERT(i5 == i2);
LOLUNIT_ASSERT(i6 == 3);
LOLUNIT_ASSERT(i7 == 0);
LOLUNIT_ASSERT(i8 == -1);
LOLUNIT_ASSERT(i9 == 9);
}};

} /* namespace lol */


Зареждане…
Отказ
Запис