9.06 beta

This commit is contained in:
Igor Pavlov
2009-08-17 00:00:00 +00:00
committed by Kornel Lesiński
parent 829409452d
commit c99f3ebdd6
445 changed files with 15246 additions and 8133 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ public:
}
CBuffer(): _capacity(0), _items(0) {};
CBuffer(const CBuffer &buffer): _capacity(0), _items(0) { *this = buffer; }
CBuffer(size_t size): _items(0), _capacity(0) { SetCapacity(size); }
CBuffer(size_t size): _items(0), _capacity(0) { SetCapacity(size); }
virtual ~CBuffer() { delete []_items; }
operator T *() { return _items; };
operator const T *() const { return _items; };
+1 -1
View File
@@ -47,7 +47,7 @@ inline int operator!=(REFGUID g1, REFGUID g2) { return !(g1 == g2); }
#ifdef INITGUID
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
MY_EXTERN_C const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
MY_EXTERN_C const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#else
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
MY_EXTERN_C const GUID name
+9 -2
View File
@@ -1,10 +1,17 @@
// Common/MyInitGuid.h
#ifndef __COMMON_MYINITGUID_H
#define __COMMON_MYINITGUID_H
#ifndef __COMMON_MY_INITGUID_H
#define __COMMON_MY_INITGUID_H
#ifdef _WIN32
#ifdef UNDER_CE
#include <basetyps.h>
#endif
#include <initguid.h>
#ifdef UNDER_CE
DEFINE_GUID(IID_IUnknown,
0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
#endif
#else
#define INITGUID
#include "MyGuidDef.h"
+1 -1
View File
@@ -96,7 +96,7 @@ int MyStringCollate(const wchar_t *s1, const wchar_t *s2)
#endif
}
#ifndef _WIN32_WCE
#ifndef UNDER_CE
int MyStringCollate(const char *s1, const char *s2)
{
return ConvertCompareResult(CompareStringA(
+22 -21
View File
@@ -4,7 +4,6 @@
#define __COMMON_STRING_H
#include <string.h>
// #include <wchar.h>
#include "MyVector.h"
@@ -39,13 +38,15 @@ inline const wchar_t* MyStringGetPrevCharPointer(const wchar_t *, const wchar_t
#ifdef _WIN32
inline char* MyStringGetNextCharPointer(char *p)
{ return CharNextA(p); }
inline const char* MyStringGetNextCharPointer(const char *p)
{ return CharNextA(p); }
{
#ifdef UNDER_CE
return p + 1;
#else
return CharNextA(p);
#endif
}
inline char* MyStringGetPrevCharPointer(char *base, char *p)
{ return CharPrevA(base, p); }
inline const char* MyStringGetPrevCharPointer(const char *base, const char *p)
{ return CharPrevA(base, p); }
@@ -58,8 +59,6 @@ inline wchar_t MyCharUpper(wchar_t c)
wchar_t MyCharUpper(wchar_t c);
#endif
inline char MyCharLower(char c)
{ return (char)(unsigned int)(UINT_PTR)CharLowerA((LPSTR)(UINT_PTR)(unsigned int)(unsigned char)c); }
#ifdef _UNICODE
inline wchar_t MyCharLower(wchar_t c)
{ return (wchar_t)(unsigned int)(UINT_PTR)CharLowerW((LPWSTR)(UINT_PTR)(unsigned int)c); }
@@ -67,6 +66,13 @@ inline wchar_t MyCharLower(wchar_t c)
wchar_t MyCharLower(wchar_t c);
#endif
inline char MyCharLower(char c)
#ifdef UNDER_CE
{ return (char)MyCharLower((wchar_t)c); }
#else
{ return (char)(unsigned int)(UINT_PTR)CharLowerA((LPSTR)(UINT_PTR)(unsigned int)(unsigned char)c); }
#endif
inline char * MyStringUpper(char *s) { return CharUpperA(s); }
#ifdef _UNICODE
inline wchar_t * MyStringUpper(wchar_t *s) { return CharUpperW(s); }
@@ -89,7 +95,7 @@ wchar_t MyCharUpper(wchar_t c);
// Compare
/*
#ifndef _WIN32_WCE
#ifndef UNDER_CE
int MyStringCollate(const char *s1, const char *s2);
int MyStringCollateNoCase(const char *s1, const char *s2);
#endif
@@ -148,12 +154,8 @@ class CStringBase
MoveItems(index + size, index);
}
static T *GetNextCharPointer(T *p)
{ return MyStringGetNextCharPointer(p); }
static const T *GetNextCharPointer(const T *p)
{ return MyStringGetNextCharPointer(p); }
static T *GetPrevCharPointer(T *base, T *p)
{ return MyStringGetPrevCharPointer(base, p); }
static const T *GetPrevCharPointer(const T *base, const T *p)
{ return MyStringGetPrevCharPointer(base, p); }
protected:
@@ -168,10 +170,8 @@ protected:
return;
/*
const int kMaxStringSize = 0x20000000;
#ifndef _WIN32_WCE
if (newCapacity > kMaxStringSize || newCapacity < _length)
throw 1052337;
#endif
*/
T *newBuffer = new T[realCapacity];
if (_capacity > 0)
@@ -234,6 +234,8 @@ public:
operator const T*() const { return _chars;}
T Back() const { return _chars[_length - 1]; }
// The minimum size of the character buffer in characters.
// This value does not include space for a null terminator.
T* GetBuffer(int minBufLength)
@@ -246,10 +248,8 @@ public:
void ReleaseBuffer(int newLength)
{
/*
#ifndef _WIN32_WCE
if (newLength >= _capacity)
throw 282217;
#endif
*/
_chars[newLength] = 0;
_length = newLength;
@@ -316,7 +316,7 @@ public:
CStringBase Mid(int startIndex) const
{ return Mid(startIndex, _length - startIndex); }
CStringBase Mid(int startIndex, int count ) const
CStringBase Mid(int startIndex, int count) const
{
if (startIndex + count > _length)
count = _length - startIndex;
@@ -369,7 +369,7 @@ public:
int Find(T c) const { return Find(c, 0); }
int Find(T c, int startIndex) const
{
T *p = _chars + startIndex;
const T *p = _chars + startIndex;
for (;;)
{
if (*p == c)
@@ -399,7 +399,7 @@ public:
{
if (_length == 0)
return -1;
T *p = _chars + _length - 1;
const T *p = _chars + _length - 1;
for (;;)
{
if (*p == c)
@@ -530,7 +530,7 @@ public:
}
return number;
}
int Delete(int index, int count = 1 )
int Delete(int index, int count = 1)
{
if (index + count > _length)
count = _length - index;
@@ -541,6 +541,7 @@ public:
}
return _length;
}
void DeleteBack() { Delete(_length - 1); }
};
template <class T>
+2 -13
View File
@@ -1,22 +1,11 @@
// MyUnknown.h
#ifndef __MYUNKNOWN_H
#define __MYUNKNOWN_H
#ifndef __MY_UNKNOWN_H
#define __MY_UNKNOWN_H
#ifdef _WIN32
#ifdef _WIN32_WCE
#if (_WIN32_WCE > 300)
#include <basetyps.h>
#else
#define MIDL_INTERFACE(x) struct
#endif
#else
#include <basetyps.h>
#endif
#include <unknwn.h>
#else
#include "MyWindows.h"
#endif
+15 -6
View File
@@ -2,16 +2,25 @@
#include "StdAfx.h"
#include <time.h>
#include <stdlib.h>
#ifndef _WIN32
#include <time.h>
#endif
#include "Random.h"
void CRandom::Init(unsigned int seed)
{ srand(seed); }
void CRandom::Init(unsigned int seed) { srand(seed); }
void CRandom::Init()
{ Init((unsigned int)time(NULL)); }
{
Init((unsigned int)
#ifdef _WIN32
GetTickCount()
#else
time(NULL)
#endif
);
}
int CRandom::Generate() const
{ return rand(); }
int CRandom::Generate() const { return rand(); }
+1 -6
View File
@@ -17,10 +17,8 @@ UString MultiByteToUnicodeString(const AString &srcString, UINT codePage)
int numChars = MultiByteToWideChar(codePage, 0, srcString,
srcString.Length(), resultString.GetBuffer(srcString.Length()),
srcString.Length() + 1);
#ifndef _WIN32_WCE
if (numChars == 0)
throw 282228;
#endif
resultString.ReleaseBuffer(numChars);
}
return resultString;
@@ -38,10 +36,8 @@ AString UnicodeStringToMultiByte(const UString &s, UINT codePage, char defaultCh
dest.GetBuffer(numRequiredBytes), numRequiredBytes + 1,
&defaultChar, &defUsed);
defaultCharWasUsed = (defUsed != FALSE);
#ifndef _WIN32_WCE
if (numChars == 0)
throw 282229;
#endif
dest.ReleaseBuffer(numChars);
}
return dest;
@@ -53,7 +49,7 @@ AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage)
return UnicodeStringToMultiByte(srcString, codePage, '_', defaultCharWasUsed);
}
#ifndef _WIN32_WCE
#ifndef UNDER_CE
AString SystemStringToOemString(const CSysString &srcString)
{
AString result;
@@ -99,4 +95,3 @@ AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage)
}
#endif
+3 -3
View File
@@ -1,7 +1,7 @@
// Common/StringConvert.h
#ifndef __COMMON_STRINGCONVERT_H
#define __COMMON_STRINGCONVERT_H
#ifndef __COMMON_STRING_CONVERT_H
#define __COMMON_STRING_CONVERT_H
#include "MyWindows.h"
#include "MyString.h"
@@ -66,7 +66,7 @@ inline AString GetOemString(const UString &unicodeString)
{ return UnicodeStringToMultiByte(unicodeString, codePage); }
#endif
#ifndef _WIN32_WCE
#ifndef UNDER_CE
AString SystemStringToOemString(const CSysString &srcString);
#endif