[frameworks/kcodecs] src/probers: [KEncodingProber] Improve const-correctness

Stefan Brüns <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 3c59edab9fc51d897c45bb67756debc14b44cac2 by Stefan Brüns.
Committed on 07/08/2026 at 13:11.
Pushed by bruns into branch 'master'.

[KEncodingProber] Improve const-correctness

This also removes need for some C-style casts.

M  +6    -6    src/probers/nsCharSetProber.cpp

https://invent.kde.org/frameworks/kcodecs/-/commit/3c59edab9fc51d897c45bb67756debc14b44cac2

diff --git a/src/probers/nsCharSetProber.cpp b/src/probers/nsCharSetProber.cpp
index 33dbd94..c0c59bd 100644
--- a/src/probers/nsCharSetProber.cpp
+++ b/src/probers/nsCharSetProber.cpp
@@ -16,8 +16,8 @@ namespace kencodingprober
 bool nsCharSetProber::FilterWithoutEnglishLetters(const char *aBuf, unsigned int aLen, char **newBuf, unsigned int &newLen)
 {
     char *newptr;
-    char *prevPtr;
-    char *curPtr;
+    const char *prevPtr;
+    const char *curPtr;
 
     bool meetMSB = false;
     newptr = *newBuf = (char *)malloc(aLen);
@@ -25,7 +25,7 @@ bool nsCharSetProber::FilterWithoutEnglishLetters(const char *aBuf, unsigned int
         return false;
     }
 
-    for (curPtr = prevPtr = (char *)aBuf; curPtr < aBuf + aLen; ++curPtr) {
+    for (curPtr = prevPtr = aBuf; curPtr < aBuf + aLen; ++curPtr) {
         if (*curPtr & 0x80) {
             meetMSB = true;
         } else if (*curPtr < 'A' || (*curPtr > 'Z' && *curPtr < 'a') || *curPtr > 'z') {
@@ -60,8 +60,8 @@ bool nsCharSetProber::FilterWithEnglishLetters(const char *aBuf, unsigned int aL
 {
     // do filtering to reduce load to probers
     char *newptr;
-    char *prevPtr;
-    char *curPtr;
+    const char *prevPtr;
+    const char *curPtr;
     bool isInTag = false;
 
     newptr = *newBuf = (char *)malloc(aLen);
@@ -69,7 +69,7 @@ bool nsCharSetProber::FilterWithEnglishLetters(const char *aBuf, unsigned int aL
         return false;
     }
 
-    for (curPtr = prevPtr = (char *)aBuf; curPtr < aBuf + aLen; ++curPtr) {
+    for (curPtr = prevPtr = aBuf; curPtr < aBuf + aLen; ++curPtr) {
         if (*curPtr == '>') {
             isInTag = false;
         } else if (*curPtr == '<') {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.