Fixed side-effect of double space fix, where F characters were not being encoded correctly
This commit is contained in:
parent
fc43c7fbb4
commit
3c8c80a5d7
11
jsc.cpp
11
jsc.cpp
@ -74,7 +74,7 @@ QList<CodewordPair> JSC::compress(QString text){
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto t = JSC::map[index];
|
auto t = JSC::map[index];
|
||||||
w = QString(w.mid(t.size));
|
w = QString(w).mid(t.size);
|
||||||
|
|
||||||
bool isLast = w.isEmpty();
|
bool isLast = w.isEmpty();
|
||||||
bool shouldAppendSpace = isLast && !isSpaceCharacter;
|
bool shouldAppendSpace = isLast && !isSpaceCharacter;
|
||||||
@ -130,7 +130,9 @@ QString JSC::decompress(Codeword const& bitvec){
|
|||||||
|
|
||||||
j = j*s + bytes[start + k] + base[k];
|
j = j*s + bytes[start + k] + base[k];
|
||||||
|
|
||||||
out.append(QString(JSC::map[j].str));
|
auto word = QString(JSC::map[j].str);
|
||||||
|
|
||||||
|
out.append(word);
|
||||||
if(!separators.isEmpty() && separators.first() == start + k){
|
if(!separators.isEmpty() && separators.first() == start + k){
|
||||||
out.append(" ");
|
out.append(" ");
|
||||||
separators.removeFirst();
|
separators.removeFirst();
|
||||||
@ -179,11 +181,6 @@ quint32 JSC::lookup(char const* b, bool *ok){
|
|||||||
|
|
||||||
// now that we have the first index in the list, let's just iterate through the list, comparing words along the way
|
// now that we have the first index in the list, let's just iterate through the list, comparing words along the way
|
||||||
for(quint32 i = index; i < index + count; i++){
|
for(quint32 i = index; i < index + count; i++){
|
||||||
// if we're no longer a prefix match, end.
|
|
||||||
if(b[0] != JSC::list[i].str[0]){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
quint32 len = JSC::list[i].size;
|
quint32 len = JSC::list[i].size;
|
||||||
if(strncmp(b, JSC::list[i].str, len) == 0){
|
if(strncmp(b, JSC::list[i].str, len) == 0){
|
||||||
if(ok) *ok = true;
|
if(ok) *ok = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user