mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 16:07:04 -06:00
15.06
This commit is contained in:
committed by
Kornel Lesiński
parent
54490d51d5
commit
cba375916f
@@ -3,18 +3,13 @@
|
||||
#ifndef __COMMON_DEFS_H
|
||||
#define __COMMON_DEFS_H
|
||||
|
||||
template <class T> inline T MyMin(T a, T b)
|
||||
{ return a < b ? a : b; }
|
||||
template <class T> inline T MyMax(T a, T b)
|
||||
{ return a > b ? a : b; }
|
||||
template <class T> inline T MyMin(T a, T b) { return a < b ? a : b; }
|
||||
template <class T> inline T MyMax(T a, T b) { return a > b ? a : b; }
|
||||
|
||||
template <class T> inline int MyCompare(T a, T b)
|
||||
{ return a < b ? -1 : (a == b ? 0 : 1); }
|
||||
{ return a == b ? 0 : (a < b ? -1 : 1); }
|
||||
|
||||
inline int BoolToInt(bool value)
|
||||
{ return (value ? 1: 0); }
|
||||
|
||||
inline bool IntToBool(int value)
|
||||
{ return (value != 0); }
|
||||
inline int BoolToInt(bool v) { return (v ? 1 : 0); }
|
||||
inline bool IntToBool(int v) { return (v != 0); }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -78,8 +78,10 @@ public:
|
||||
if (newSize != 0)
|
||||
{
|
||||
newBuffer = new T[newSize];
|
||||
if (_size != 0)
|
||||
memcpy(newBuffer, _items, MyMin(MyMin(_size, keepSize), newSize) * sizeof(T));
|
||||
if (keepSize > _size)
|
||||
keepSize = _size;
|
||||
if (keepSize != 0)
|
||||
memcpy(newBuffer, _items, MyMin(keepSize, newSize) * sizeof(T));
|
||||
}
|
||||
delete []_items;
|
||||
_items = newBuffer;
|
||||
@@ -109,8 +111,8 @@ template <class T>
|
||||
bool operator!=(const CBuffer<T>& b1, const CBuffer<T>& b2)
|
||||
{
|
||||
size_t size1 = b1.Size();
|
||||
if (size1 == b2.Size())
|
||||
return false;
|
||||
if (size1 != b2.Size())
|
||||
return true;
|
||||
if (size1 == 0)
|
||||
return false;
|
||||
return memcmp(b1, b2, size1 * sizeof(T)) != 0;
|
||||
@@ -118,7 +120,7 @@ bool operator!=(const CBuffer<T>& b1, const CBuffer<T>& b2)
|
||||
|
||||
|
||||
typedef CBuffer<char> CCharBuffer;
|
||||
typedef CBuffer<wchar_t> CWCharBuffer;
|
||||
// typedef CBuffer<wchar_t> CWCharBuffer;
|
||||
typedef CBuffer<unsigned char> CByteBuffer;
|
||||
|
||||
|
||||
@@ -155,11 +157,9 @@ typedef CObjArray<unsigned char> CByteArr;
|
||||
typedef CObjArray<bool> CBoolArr;
|
||||
typedef CObjArray<int> CIntArr;
|
||||
|
||||
// #define CRecArray CObjArray
|
||||
|
||||
template <class T> class CObjArray2
|
||||
{
|
||||
// protected:
|
||||
T *_items;
|
||||
unsigned _size;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <wchar.h>
|
||||
#else
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#include "MyWindows.h"
|
||||
#include "MyTypes.h"
|
||||
#include "MyVector.h"
|
||||
|
||||
|
||||
@@ -3,11 +3,15 @@
|
||||
#ifndef __MY_UNKNOWN_H
|
||||
#define __MY_UNKNOWN_H
|
||||
|
||||
#include "MyWindows.h"
|
||||
|
||||
/*
|
||||
#ifdef _WIN32
|
||||
#include <basetyps.h>
|
||||
#include <unknwn.h>
|
||||
#else
|
||||
#include "MyWindows.h"
|
||||
#endif
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#ifndef __COMMON_MY_VECTOR_H
|
||||
#define __COMMON_MY_VECTOR_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
template <class T>
|
||||
class CRecordVector
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ problem for your code.
|
||||
Also we declare delete(void *p) throw() that creates smaller code.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
class CNewException {};
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <time.h>
|
||||
#else
|
||||
#include "MyWindows.h"
|
||||
#endif
|
||||
|
||||
#include "Random.h"
|
||||
|
||||
Reference in New Issue
Block a user