summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclUtf.c50
-rw-r--r--win/tclWinTime.c4
2 files changed, 13 insertions, 41 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index 3d44b66..45a7f1e 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -159,7 +159,7 @@ static const unsigned char bounds[28] = {
0x80, 0x8F /* \xF4\x90 and higher are invalid prefixes */
};
-INLINE static int
+static int
Invalid(
unsigned char *src) /* Points to lead byte of a UTF-8 byte sequence */
{
@@ -967,43 +967,15 @@ Tcl_UtfNext(
*
* Tcl_UtfPrev --
*
- * The aim of this routine is to provide a way to move backward
- * through a UTF-8 string. The caller is expected to pass non-NULL
- * pointer arguments start and src. start points to the beginning
- * of a string, and src >= start points to a location within (or just
- * past the end) of the string. This routine always returns a
- * pointer within the string (>= start). When (src == start), it
- * returns start. When (src > start), it returns a pointer (< src)
- * and (>= src - TCL_UTF_MAX). Subject to these constraints, the
- * routine returns a pointer to the earliest byte in the string that
- * starts a character when characters are read starting at start and
- * that character might include the byte src[-1]. The routine will
- * examine only those bytes in the range that might be returned.
- * It will not examine the byte *src, and because of that cannot
- * determine for certain in all circumstances whether the character
- * that begins with the returned pointer will or will not include
- * the byte src[-1]. In the scenario, where src points to the end of
- * a buffer being filled, the returned pointer points to either the
- * final complete character in the string or to the earliest byte
- * that might start an incomplete character waiting for more bytes to
- * complete.
- *
- * Because this routine always returns a value < src until the point
- * it is forced to return start, it is useful as a backward iterator
- * through a string that will always make progress and always be
- * prevented from running past the beginning of the string.
- *
- * In a string where all characters are complete and properly formed,
- * and the value of src points to the first byte of a character,
- * repeated Tcl_UtfPrev calls will step to the starting bytes of
- * characters, one character at a time. Within those limitations,
- * Tcl_UtfPrev and Tcl_UtfNext are inverses. If either condition cannot
- * be met, Tcl_UtfPrev and Tcl_UtfNext may not function as inverses and
- * the caller will have to take greater care.
+ * Given a pointer to some current location in a UTF-8 string, move
+ * backwards one character. This works correctly when the pointer is in
+ * the middle of a UTF-8 character.
*
* Results:
- * A pointer to the start of a character in the string as described
- * above.
+ * The return value is a pointer to the previous character in the UTF-8
+ * string. If the current location was already at the beginning of the
+ * string, the return value will also be a pointer to the beginning of
+ * the string.
*
* Side effects:
* None.
@@ -1017,7 +989,7 @@ Tcl_UtfPrev(
const char *start) /* Pointer to the beginning of the string */
{
int trailBytesSeen = 0; /* How many trail bytes have been verified? */
- CONST char *fallback = src - 1;
+ const char *fallback = src - 1;
/* If we cannot find a lead byte that might
* start a prefix of a valid UTF byte sequence,
* we will fallback to a one-byte back step */
@@ -1073,13 +1045,13 @@ Tcl_UtfPrev(
/* Reject */
return fallback;
}
- return (CONST char *)look;
+ return (const char *)look;
}
/* We saw a trail byte. */
trailBytesSeen++;
- if ((CONST char *)look == start) {
+ if ((const char *)look == start) {
/*
* Do not read before the start of the string
*
diff --git a/win/tclWinTime.c b/win/tclWinTime.c
index 277b57f..ef2b9d2 100644
--- a/win/tclWinTime.c
+++ b/win/tclWinTime.c
@@ -1364,7 +1364,7 @@ TclpGmtime(
#if defined(_WIN64) || defined(_USE_64BIT_TIME_T) || (defined(_MSC_VER) && _MSC_VER < 1400)
return gmtime(timePtr);
#else
- return _gmtime32((CONST __time32_t *)timePtr);
+ return _gmtime32((const __time32_t *)timePtr);
#endif
}
@@ -1399,7 +1399,7 @@ TclpLocaltime(
#if defined(_WIN64) || defined(_USE_64BIT_TIME_T) || (defined(_MSC_VER) && _MSC_VER < 1400)
return localtime(timePtr);
#else
- return _localtime32((CONST __time32_t *)timePtr);
+ return _localtime32((const __time32_t *)timePtr);
#endif
}
#endif /* TCL_NO_DEPRECATED */