mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
+ fix: bug while reading String to Vector
This commit is contained in:
parent
1b7d055218
commit
520ea555bb
@ -2861,6 +2861,7 @@ int ReadStrgsFromCSV(LPCWSTR wchCSVStrg, prefix_t sMatrix[], int const iCount, i
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (wchTmpBuff[i] == L',') { wchTmpBuff[i] = L'\0'; }
|
||||
}
|
||||
wchTmpBuff[len + 1] = L'\0'; // double zero at the end
|
||||
// fill default
|
||||
for (int i = 0; i < iCount; ++i) { StringCchCopyW(sMatrix[i], (size_t)iLen, sDefault); }
|
||||
// insert values
|
||||
@ -2881,7 +2882,7 @@ int ReadStrgsFromCSV(LPCWSTR wchCSVStrg, prefix_t sMatrix[], int const iCount, i
|
||||
// ReadVectorFromString()
|
||||
//
|
||||
//
|
||||
int ReadVectorFromString(LPCWSTR wchStrg, int* iVector, int iCount, int iMin, int iMax, int iDefault)
|
||||
int ReadVectorFromString(LPCWSTR wchStrg, int iVector[], int iCount, int iMin, int iMax, int iDefault)
|
||||
{
|
||||
static WCHAR wchTmpBuff[SMALL_BUFFER];
|
||||
|
||||
@ -2898,6 +2899,8 @@ int ReadVectorFromString(LPCWSTR wchStrg, int* iVector, int iCount, int iMin, in
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (wchTmpBuff[i] == L' ') { wchTmpBuff[i] = L'\0'; }
|
||||
}
|
||||
wchTmpBuff[len + 1] = L'\0'; // double zero at the end
|
||||
|
||||
// fill default
|
||||
for (int i = 0; i < iCount; ++i) { iVector[i] = iDefault; }
|
||||
// insert values
|
||||
|
||||
@ -388,7 +388,7 @@ __forceinline int GetHexDigit(char ch) {
|
||||
void UrlUnescapeEx(LPWSTR, LPWSTR, DWORD*);
|
||||
|
||||
int ReadStrgsFromCSV(LPCWSTR wchCSVStrg, prefix_t sMatrix[], int const iCount, int const iLen, LPCWSTR sDefault);
|
||||
int ReadVectorFromString(LPCWSTR wchStrg, int* iVector, int iCount, int iMin, int iMax, int iDefault);
|
||||
int ReadVectorFromString(LPCWSTR wchStrg, int iVector[], int iCount, int iMin, int iMax, int iDefault);
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -143,12 +143,12 @@ static WCHAR g_tchStatusbarPrefixes[MIDSZ_BUFFER] = { L'\0' };
|
||||
static prefix_t g_mxStatusBarPrefix[STATUS_SECTOR_COUNT];
|
||||
|
||||
static WCHAR g_tchStatusbarSections[SMALL_BUFFER] = { L'\0' };
|
||||
static int g_iStatusbarSections[STATUS_SECTOR_COUNT];
|
||||
static bool g_iStatusbarVisible[STATUS_SECTOR_COUNT];
|
||||
static int g_vSBSOrder[STATUS_SECTOR_COUNT];
|
||||
static int g_iStatusbarSections[STATUS_SECTOR_COUNT] = SBS_INIT_MINUS;
|
||||
static bool g_iStatusbarVisible[STATUS_SECTOR_COUNT] = SBS_INIT_ZERO;
|
||||
static int g_vSBSOrder[STATUS_SECTOR_COUNT] = SBS_INIT_MINUS;
|
||||
|
||||
static WCHAR g_tchStatusbarWidthSpec[SMALL_BUFFER] = { L'\0' };
|
||||
static int g_iStatusbarWidthSpec[STATUS_SECTOR_COUNT];
|
||||
static int g_iStatusbarWidthSpec[STATUS_SECTOR_COUNT] = SBS_INIT_ZERO;
|
||||
|
||||
|
||||
static WCHAR g_tchToolbarBitmap[MAX_PATH] = { L'\0' };
|
||||
@ -7776,7 +7776,7 @@ void UpdateStatusbar()
|
||||
|
||||
_CalculateStatusbarSections(g_vStatusbarSectionWidth, tchStatusBar);
|
||||
|
||||
int aStatusbarSections[STATUS_SECTOR_COUNT];
|
||||
int aStatusbarSections[STATUS_SECTOR_COUNT] = SBS_INIT_ZERO;
|
||||
int cnt = 0;
|
||||
int totalWidth = 0;
|
||||
for (int i = 0; i < STATUS_SECTOR_COUNT; ++i) {
|
||||
|
||||
@ -91,6 +91,7 @@ typedef enum {
|
||||
|
||||
#define SBS_INIT_ZERO { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
#define SBS_INIT_MINUS { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
|
||||
#define SBS_INIT_ORDER { 0, 1, 2, 3, 4, 5, 6, 7. 8. 9, 10, 11 }
|
||||
|
||||
#define STATUSBAR_EXTION_PREFIXES L"Ln ,Col ,Sel ,Sb ,SLn ,Occ ,,,,,,,"
|
||||
#define STATUSBAR_DEFAULT_IDS L"0 1 2 4 5 6 7 8 9 10 11"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user