Jim Park's Unicode NSIS merging - Step 1 : switch to TCHARs where relevant.
Compiler output is identical before & after this step git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/branches/wizou@6036 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
4e48722b63
commit
752d7d239a
209 changed files with 9698 additions and 7658 deletions
|
@ -12,21 +12,52 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/22/2007
|
||||
*/
|
||||
|
||||
#ifndef __GROWBUF_H_
|
||||
#define __GROWBUF_H_
|
||||
|
||||
/**
|
||||
* IGrowBuf is the interface to a buffer that grows as you
|
||||
* add to the buffer.
|
||||
*/
|
||||
class IGrowBuf
|
||||
{
|
||||
public:
|
||||
virtual ~IGrowBuf() {}
|
||||
|
||||
/**
|
||||
* Add data to the buffer.
|
||||
* @param data Pointer to the data to be stored.
|
||||
* @param len Size of the data in bytes.
|
||||
* @return the previous logical size in bytes before the addition.
|
||||
*/
|
||||
virtual int add(const void *data, int len)=0;
|
||||
|
||||
/**
|
||||
* Resizes the buffer to hold the number of bytes specified.
|
||||
* @param newlen the desired logical size of the buffer.
|
||||
*/
|
||||
virtual void resize(int newlen)=0;
|
||||
|
||||
/**
|
||||
* Get the length of the logical buffer in bytes.
|
||||
* @return the length in bytes
|
||||
*/
|
||||
virtual int getlen() const=0;
|
||||
|
||||
/**
|
||||
* Get the buffer itself.
|
||||
* @return Void pointer to the buffer.
|
||||
*/
|
||||
virtual void *get() const=0;
|
||||
};
|
||||
|
||||
/**
|
||||
* GrowBuf implements IGrowBuf and grows in 32K chunks.
|
||||
*/
|
||||
class GrowBuf : public IGrowBuf
|
||||
{
|
||||
private: // don't copy instances
|
||||
|
@ -37,22 +68,55 @@ class GrowBuf : public IGrowBuf
|
|||
GrowBuf();
|
||||
virtual ~GrowBuf();
|
||||
|
||||
/**
|
||||
* Set whether to zero out buffer
|
||||
* @param zero A boolean value.
|
||||
*/
|
||||
void set_zeroing(int zero);
|
||||
|
||||
/**
|
||||
* Add data to the buffer.
|
||||
* @param data Pointer to the data to be stored.
|
||||
* @param len Size of the data in bytes.
|
||||
* @return the previous logical size in bytes before the addition.
|
||||
*/
|
||||
int add(const void *data, int len);
|
||||
|
||||
/**
|
||||
* Resizes the buffer to hold the number of bytes specified.
|
||||
* @param newlen the desired logical size of the buffer.
|
||||
*/
|
||||
void resize(int newlen);
|
||||
|
||||
/**
|
||||
* Get the length of the logical buffer in bytes.
|
||||
* Setting the newlen to 0 will cause the buffer to be at most
|
||||
* 2*m_bs bytes long. (It will free the buffer if > 2*m_bs.)
|
||||
*
|
||||
* @return the length in bytes
|
||||
*/
|
||||
int getlen() const;
|
||||
|
||||
/**
|
||||
* Get the buffer itself.
|
||||
* @return Void pointer to the buffer.
|
||||
*/
|
||||
void *get() const;
|
||||
|
||||
private:
|
||||
void *m_s;
|
||||
int m_alloc;
|
||||
int m_used;
|
||||
int m_zero;
|
||||
void *m_s; /* the storage buffer */
|
||||
int m_alloc; /* allocated bytes */
|
||||
int m_used; /* how many bytes of the buffer is used? */
|
||||
int m_zero; /* should storage be zeroed out? */
|
||||
|
||||
protected:
|
||||
int m_bs;
|
||||
int m_bs; // byte-size to grow by
|
||||
};
|
||||
|
||||
/**
|
||||
* TinyGrowBuf is a derived class that grows the buffer
|
||||
* in tiny increments.
|
||||
*/
|
||||
class TinyGrowBuf : public GrowBuf {
|
||||
public:
|
||||
TinyGrowBuf() : GrowBuf() { m_bs=1024; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue