From bad30e1b1aecd2995b0c076d8648a17ec622f806 Mon Sep 17 00:00:00 2001 From: Liang Chang Date: Fri, 18 Feb 2022 10:29:29 +0800 Subject: [PATCH] dtinfo: fix a highlighting issue. --- .../dtinfo/dtinfo/src/Basic/NodeViewInfo.C | 16 ++++++++-------- .../dtinfo/src/OnlineRender/CanvasRenderer.C | 8 ++++---- .../src/UAS/DtSR/DtSR_SearchResultsEntry.C | 6 +++--- cde/programs/dtinfo/dtinfo/src/config.h | 2 ++ 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/cde/programs/dtinfo/dtinfo/src/Basic/NodeViewInfo.C b/cde/programs/dtinfo/dtinfo/src/Basic/NodeViewInfo.C index 1cf6b94e6..224b669fa 100644 --- a/cde/programs/dtinfo/dtinfo/src/Basic/NodeViewInfo.C +++ b/cde/programs/dtinfo/dtinfo/src/Basic/NodeViewInfo.C @@ -256,14 +256,14 @@ DtCvStrVccToIndex(_DtCvSegment* seg, unsigned int vcc) if (seg->type & _DtCvWIDE_CHAR) { wchar_t* seg_str = (wchar_t*)seg->handle.string.string; for (; *seg_str && rel_vcc > 0; seg_str++, index++) { - if (!isspace(*seg_str)) + if (!ISSPACE_C(*seg_str)) rel_vcc--; } if (*seg_str == 0 && rel_vcc > 0) index = (unsigned int)-1; else { for (; *seg_str; seg_str++, index++) { - if (!isspace(*seg_str)) + if (!ISSPACE_C(*seg_str)) break; } } @@ -271,7 +271,7 @@ DtCvStrVccToIndex(_DtCvSegment* seg, unsigned int vcc) else { unsigned char* seg_str = (unsigned char*)seg->handle.string.string; while (*seg_str && rel_vcc > 0) { - if (!isspace(*seg_str)) + if (!ISSPACE_C(*seg_str)) rel_vcc--; int mbl = mblen((char *) seg_str, MB_CUR_MAX); @@ -289,7 +289,7 @@ DtCvStrVccToIndex(_DtCvSegment* seg, unsigned int vcc) index = (unsigned int)-1; else { for (; *seg_str; seg_str++, index++) { - if (!isspace(*seg_str)) + if (!ISSPACE_C(*seg_str)) break; } } @@ -310,14 +310,14 @@ DtCvStrVcLenSync(_DtCvSegment* seg) if (seg->type & _DtCvWIDE_CHAR) { wchar_t* seg_str = (wchar_t*)seg->handle.string.string; for (; *seg_str; seg_str++) { - if (!isspace(*seg_str)) + if (!ISSPACE_C(*seg_str)) vclen++; } } else { unsigned char* seg_str = (unsigned char*)seg->handle.string.string; while (*seg_str) { - if (!isspace(*seg_str)) + if (!ISSPACE_C(*seg_str)) vclen++; int mbl = mblen((char *) seg_str, MB_CUR_MAX); @@ -569,7 +569,7 @@ highlight_search_hit(_DtCvSegment* seg, unsigned int vcc, unsigned int vlen) unsigned char *seg_str = (unsigned char*)seg->handle.string.string; for (int i = 0; i < rel_vcc; ++i) { - if (isspace(*seg_str)) { + if (ISSPACE_C(*seg_str)) { ++seg_str; continue; } @@ -581,7 +581,7 @@ highlight_search_hit(_DtCvSegment* seg, unsigned int vcc, unsigned int vlen) } for (int i = 0; i < vlen; ++i) { - if (isspace(*seg_str)) { + if (ISSPACE_C(*seg_str)) { ++seg_str; ++len; continue; diff --git a/cde/programs/dtinfo/dtinfo/src/OnlineRender/CanvasRenderer.C b/cde/programs/dtinfo/dtinfo/src/OnlineRender/CanvasRenderer.C index ff7aa8072..e6f2674fd 100644 --- a/cde/programs/dtinfo/dtinfo/src/OnlineRender/CanvasRenderer.C +++ b/cde/programs/dtinfo/dtinfo/src/OnlineRender/CanvasRenderer.C @@ -1282,7 +1282,7 @@ CanvasRenderer::handle_olias_attributes(ElementFeatures &features, assert( mb_len > 0 ); if (mb_len == 1) { const unsigned char ch = (unsigned char)*p++; - if (isspace(ch)) + if (ISSPACE_C(ch)) continue; } else @@ -1293,7 +1293,7 @@ CanvasRenderer::handle_olias_attributes(ElementFeatures &features, #else while (*p) { - if (!isspace(*p)) + if (!ISSPACE_C(*p)) { vcc++ ; } @@ -1673,7 +1673,7 @@ CanvasRenderer::really_insert_string (_DtCvSegment *container, if (strseg->type & _DtCvWIDE_CHAR) { wchar_t *p; for (p = (wchar_t*)string; *p; p++) { - if (!isspace(*p)) + if (!ISSPACE_C(*p)) scd.vclen()++; } } @@ -1683,7 +1683,7 @@ CanvasRenderer::really_insert_string (_DtCvSegment *container, while (*p) { int mbl = mblen((char *) p, MB_CUR_MAX); - if (!isspace(*p)) + if (!ISSPACE_C(*p)) scd.vclen()++; if (mbl < 0) ++p; diff --git a/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/DtSR_SearchResultsEntry.C b/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/DtSR_SearchResultsEntry.C index 6f7667fb3..ea4b413df 100644 --- a/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/DtSR_SearchResultsEntry.C +++ b/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/DtSR_SearchResultsEntry.C @@ -395,7 +395,7 @@ DtSR_SearchResultsEntry::create_matches() while (off > 0) { int scanned = 0; - if (isspace(*cursor)) { + if (ISSPACE_C(*cursor)) { scanned++; } else if (*cursor == ShiftIn || *cursor == ShiftOut) { @@ -424,11 +424,11 @@ DtSR_SearchResultsEntry::create_matches() int len = atoi(len_str); // remove leading white-spaces - for (; len && isspace(*cursor); cursor++, len--); + for (; len && ISSPACE_C(*cursor); cursor++, len--); // remove trailing white-spaces if (len > 0) { - for (const char *p = cursor + len - 1; isspace(*p); p--, len--); + for (const char *p = cursor + len - 1; ISSPACE_C(*p); p--, len--); } if (len == 0) diff --git a/cde/programs/dtinfo/dtinfo/src/config.h b/cde/programs/dtinfo/dtinfo/src/config.h index 0eb880d58..3d0c9b5f1 100644 --- a/cde/programs/dtinfo/dtinfo/src/config.h +++ b/cde/programs/dtinfo/dtinfo/src/config.h @@ -132,6 +132,8 @@ typedef unsigned char u_char; #define ON_DEBUG(stmt) #endif +#define ISSPACE_C(C) (C == ' ' || C > 0x8 && C < 0x14) + #include #include