pCmdUI->Enable (IsSelection ());
}
-size_t str_pos (LPCTSTR whole, LPCTSTR piece);
-
void CCrystalEditView::
OnToolsCharCoding ()
{
HINSTANCE CCrystalTextView::s_hResourceInst = NULL;
-static size_t FindStringHelper(LPCTSTR pszFindWhere, LPCTSTR pszFindWhat, DWORD dwFlags, int &nLen, RxNode *&rxnode, RxMatchRes *rxmatch);
+static ptrdiff_t FindStringHelper(LPCTSTR pszFindWhere, LPCTSTR pszFindWhat, DWORD dwFlags, int &nLen, RxNode *&rxnode, RxMatchRes *rxmatch);
BEGIN_MESSAGE_MAP (CCrystalTextView, CView)
//{{AFX_MSG_MAP(CCrystalTextView)
return hData;
}
-static size_t
+static ptrdiff_t
FindStringHelper (LPCTSTR pszFindWhere, LPCTSTR pszFindWhat, DWORD dwFlags, int &nLen, RxNode *&rxnode, RxMatchRes *rxmatch)
{
if (dwFlags & FIND_REGEXP)
{
- size_t pos;
+ ptrdiff_t pos;
if (rxnode)
RxFree (rxnode);
line.ReleaseBuffer (ptCurrentPos.x + 1);
}
- size_t nFoundPos = -1;
+ ptrdiff_t nFoundPos = -1;
int nMatchLen = what.GetLength();
int nLineLen = line.GetLength();
size_t nPos;
struct _RxNode;
typedef struct {
- size_t Open[NSEXPS]; // -1 = not matched
- size_t Close[NSEXPS];
+ ptrdiff_t Open[NSEXPS]; // -1 = not matched
+ ptrdiff_t Close[NSEXPS];
} RxMatchRes;
RxNode EDITPADC_CLASS *RxCompile(LPCTSTR Regexp, unsigned int RxOpt = RX_CASE);
*s = _T ('\0');
}
-size_t
+ptrdiff_t
str_pos (LPCTSTR whole, LPCTSTR piece)
{
LPCTSTR s = whole;
return skip_spaces (s);
}
-size_t
+ptrdiff_t
get_coding (LPCTSTR name, type_codes *codes, int *coding)
{
size_t pos;
return -2;
}
-size_t
+
+ptrdiff_t
fget_coding (LPCTSTR text, int *coding)
{
- size_t posit = 0;
- size_t i = 0;
+ ptrdiff_t posit = 0;
+ ptrdiff_t i = 0;
LPCTSTR s, s1;
while ((i = str_pos (text, FD_ENCODING_LBRACKET)) >= 0)
int
iconvert (LPTSTR string, int source_coding, int destination_coding, bool alphabet_only)
{
- size_t posit = -2;
+ ptrdiff_t posit = -2;
LPCTSTR source_chars, destination_chars, cod_pos = NULL;
TCHAR ch;
LPTSTR s = string;
m_lastSignificantLeftRight = -1;
m_lastSignificantMiddleRight = -1;
m_lastSignificantConflict = -1;
- int prev = -1;
- const int size = (int) m_diffs.size();
+ ptrdiff_t prev = -1;
+ const ptrdiff_t size = (int) m_diffs.size();
// must be called after diff list is entirely populated
for (int i = 0; i < size; ++i)
*/
struct DiffRangeInfo: public DIFFRANGE
{
- size_t next; /**< link (array index) for doubly-linked chain of non-trivial DIFFRANGEs */
- size_t prev; /**< link (array index) for doubly-linked chain of non-trivial DIFFRANGEs */
+ ptrdiff_t next; /**< link (array index) for doubly-linked chain of non-trivial DIFFRANGEs */
+ ptrdiff_t prev; /**< link (array index) for doubly-linked chain of non-trivial DIFFRANGEs */
DiffRangeInfo() { InitLinks(); }
explicit DiffRangeInfo(const DIFFRANGE & di) : DIFFRANGE(di) { InitLinks(); }
* @param [in] bGuessEncoding Try to guess codepage (not just unicode encoding).
* @return Structure getting the encoding info.
*/
-FileTextEncoding GuessCodepageEncoding(const String& filepath, int guessEncodingType, int mapmaxlen)
+FileTextEncoding GuessCodepageEncoding(const String& filepath, int guessEncodingType, ptrdiff_t mapmaxlen)
{
FileTextEncoding encoding;
CMarkdown::FileImage fi(filepath.c_str(), mapmaxlen);
/** @brief Buffer size used in this file. */
static const int BufSize = 65536;
-FileTextEncoding GuessCodepageEncoding(const String& filepath, int guessEncodingType, int mapmaxlen = BufSize);
+FileTextEncoding GuessCodepageEncoding(const String& filepath, int guessEncodingType, ptrdiff_t mapmaxlen = BufSize);
{
int i=0, begin=0;
+ size_t sLen = str.length();
+ assert(sLen < INT_MAX);
+ int iLen = static_cast<int>(sLen);
+
// dummy;
words.push_back(word(0, -1, 0, 0));
words.push_back(word(begin, e, dlspace, Hash(str, begin, e, 0)));
}
- if (i == str.length())
+ if (i == iLen)
return;
begin = i;
goto inword;
// state when we are inside a word
inword:
bool atspace=false;
- if (i == str.length() || ((atspace = isSafeWhitespace(str[i])) != 0) || isWordBreak(m_breakType, str.c_str(), i))
+ if (i == iLen || ((atspace = isSafeWhitespace(str[i])) != 0) || isWordBreak(m_breakType, str.c_str(), i))
{
if (begin<i)
{
words.push_back(word(begin, e, dlword, Hash(str, begin, e, 0)));
}
- if (i == str.length())
+ if (i == iLen)
{
return;
}