Skip to content

Instantly share code, notes, and snippets.

@Tatakinov
Created February 22, 2024 11:39
Show Gist options
  • Save Tatakinov/701bf6ec0487da3e127981c50921b835 to your computer and use it in GitHub Desktop.
Save Tatakinov/701bf6ec0487da3e127981c50921b835 to your computer and use it in GitHub Desktop.
diff --git a/build/src/kis/kis_string.cpp b/build/src/kis/kis_string.cpp
index 52d8bee..377dbd4 100644
--- a/build/src/kis/kis_string.cpp
+++ b/build/src/kis/kis_string.cpp
@@ -209,7 +209,7 @@ string KIS_gsub::Function(const vector<string>& args){
int tmp=(args.size()>4)?
normalizeIndex(atoi(args[4].c_str()), target.length()):0;
if(tmp<0) return (args[1]);
- unsigned int pos=tmp;
+ wstring::size_type pos=tmp;
if(!target.length()) return args[1];
if((!pattern.length())&&(!subst.length())) return args[1];
// int stride=max(subst.length(), 1);
@@ -245,12 +245,12 @@ string KIS_tr::Function(const vector<string>& args){
wstring search=ctow(args[2]);
wstring replace=ctow(args[3]);
- unsigned int pos=0;
- unsigned int replen=replace.length();
+ wstring::size_type pos=0;
+ wstring::size_type replen=replace.length();
while (pos<target.length()){
pos=target.find_first_of(search, pos);
if (pos==string::npos) return wtoc(target);
- unsigned int index=search.find(target[pos]);
+ wstring::size_type index=search.find(target[pos]);
if (index<replen) {
target[pos]=replace[index];
pos++;
diff --git a/build/src/libkawari/kawari_code.cpp b/build/src/libkawari/kawari_code.cpp
index 34f032a..5c4ecf9 100644
--- a/build/src/libkawari/kawari_code.cpp
+++ b/build/src/libkawari/kawari_code.cpp
@@ -116,8 +116,8 @@ string TKVMCodeString::DisCompile(void) const{
unsigned int pos=0;
while(pos<len) {
- unsigned int pos2=ws.find_first_of(illchs, pos);
- if (pos2==string::npos) {
+ wstring::size_type pos2=ws.find_first_of(illchs, pos);
+ if (pos2==wstring::npos) {
retstr+=ws.substr(pos);
break;
}else{
diff --git a/build/src/shiori/kawari_shiori.cpp b/build/src/shiori/kawari_shiori.cpp
index c8e12d9..a47dc4e 100644
--- a/build/src/shiori/kawari_shiori.cpp
+++ b/build/src/shiori/kawari_shiori.cpp
@@ -73,6 +73,7 @@
//#include <iostream>
#include <fstream>
#include <cstdlib>
+#include <cstring>
#include <ctime>
#include <cctype>
using namespace std;
diff --git a/build/src/shiori/shiori.cpp b/build/src/shiori/shiori.cpp
index 7d38cc5..7e83a04 100644
--- a/build/src/shiori/shiori.cpp
+++ b/build/src/shiori/shiori.cpp
@@ -24,6 +24,7 @@
#include "include/shiori.h"
//---------------------------------------------------------------------------
#include <string>
+#include <cstring>
using namespace std;
//---------------------------------------------------------------------------
namespace {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment