This commit is contained in:
Igor Pavlov
2010-11-02 00:00:00 +00:00
committed by Kornel Lesiński
parent 2eb60a0598
commit c65230d858
101 changed files with 4557 additions and 541 deletions
+6 -3
View File
@@ -1,7 +1,7 @@
// Common/DynamicBuffer.h
#ifndef __COMMON_DYNAMICBUFFER_H
#define __COMMON_DYNAMICBUFFER_H
#ifndef __COMMON_DYNAMIC_BUFFER_H
#define __COMMON_DYNAMIC_BUFFER_H
#include "Buffer.h"
@@ -17,7 +17,10 @@ template <class T> class CDynamicBuffer: public CBuffer<T>
else
delta = 4;
delta = MyMax(delta, size);
SetCapacity(this->_capacity + delta);
size_t newCap = this->_capacity + delta;
if (newCap < delta)
newCap = this->_capacity + size;
SetCapacity(newCap);
}
public:
CDynamicBuffer(): CBuffer<T>() {};
+11
View File
@@ -64,3 +64,14 @@ void ConvertInt64ToString(Int64 value, wchar_t *s)
}
ConvertUInt64ToString(value, s);
}
void ConvertUInt32ToHexWithZeros(UInt32 value, char *s)
{
for (int i = 0; i < 8; i++)
{
int t = value & 0xF;
value >>= 4;
s[7 - i] = (char)((t < 10) ? ('0' + t) : ('A' + (t - 10)));
}
s[8] = '\0';
}
+2
View File
@@ -14,4 +14,6 @@ void ConvertInt64ToString(Int64 value, wchar_t *s);
void ConvertUInt32ToString(UInt32 value, char *s);
void ConvertUInt32ToString(UInt32 value, wchar_t *s);
void ConvertUInt32ToHexWithZeros(UInt32 value, char *s);
#endif
-4
View File
@@ -7,10 +7,6 @@
#include "MyVector.h"
#ifdef _WIN32
#include "MyWindows.h"
#endif
template <class T>
inline int MyStringLen(const T *s)
{
+16
View File
@@ -78,6 +78,22 @@ public:
operator[](j) = temp;
}
int FindInSorted(const T& item, int left, int right) const
{
while (left != right)
{
int mid = (left + right) / 2;
const T& midValue = (*this)[mid];
if (item == midValue)
return mid;
if (item < midValue)
right = mid;
else
left = mid + 1;
}
return -1;
}
int FindInSorted(const T& item) const
{
int left = 0, right = Size();
-10
View File
@@ -7,18 +7,8 @@
#include <windows.h>
#define CHAR_PATH_SEPARATOR '\\'
#define WCHAR_PATH_SEPARATOR L'\\'
#define STRING_PATH_SEPARATOR "\\"
#define WSTRING_PATH_SEPARATOR L"\\"
#else
#define CHAR_PATH_SEPARATOR '/'
#define WCHAR_PATH_SEPARATOR L'/'
#define STRING_PATH_SEPARATOR "/"
#define WSTRING_PATH_SEPARATOR L"/"
#include <stddef.h> // for wchar_t
#include <string.h>
+2
View File
@@ -2,6 +2,8 @@
#include "StdAfx.h"
#include "../../C/Types.h"
#include "Wildcard.h"
bool g_CaseSensitive =