10000 src fixes · ChatScript/ChatScript@305a3ae · GitHub
[go: up one dir, main page]

Skip to content

Commit 305a3ae

Browse files
committed
src fixes
1 parent 3034ff1 commit 305a3ae

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

SRC/csocket.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ static void Jmetertestfile(bool api,char* bot, char* sendbuffer, char* response,
469469
// now execute conversation
470470
while (*input)
471471
{
472-
strcpy(sendbuffer + baselen + 1, input);
472+
strcpy(sendbuffer + baselen, input);
473473
sock = new TCPSocket(serverIP, (unsigned short)port);
474474
sock->send(sendbuffer, baselen + 1 + strlen(input));
475475
ReadSocket(sock, response);
@@ -525,14 +525,14 @@ static void Jmetertestfile(bool api,char* bot, char* sendbuffer, char* response,
525525
if (strcmp(actual, expect))
526526
{
527527
++failcnt;
528-
fprintf(out, "@%d %s P/F: %d/%d %s:%s %s:%s Input: %s\r\n", line, bot, passcnt, failcnt, category, specialty, chattype, source, at);
528+
fprintf(out, "@%d %s P/F: %d/%d %s:%s %s:%s Input: %s\r\n", line, bot, passcnt, failcnt, category, specialty, chattype, source, input);
529529
fprintf(out, "want: %s\r\n", expect);
530530
fprintf(out, "gotx: %s| %s\r\n\r\n", actual, response);
531531
}
532532
else
533533
{
534534
++passcnt;
535-
fprintf(out, "@%d %s P/F: %d/%d %s:%s Input: %s Output:%s \r\n\r\n", line, bot, passcnt, failcnt, category, specialty, at, actual);
535+
fprintf(out, "@%d %s P/F: %d/%d %s:%s Input: %s Output:%s \r\n\r\n", line, bot, passcnt, failcnt, category, specialty, input, actual);
536536
}
537537
if (((passcnt + failcnt) % 100) == 0) printf("at %d pass:%d fail:%d\r\n", passcnt + failcnt, passcnt, failcnt);
538538
if (!ptr) break; // end of messages

SRC/mainSystem.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ bool fastload = true;
77
int externalTagger = 0;
88
char defaultbot[100];
99
uint64 chatstarted = 0;
10+
bool client = false;
1011
uint64 preparationtime = 0;
1112
uint64 replytime = 0;
1213
unsigned int timeLog = 2147483647;
@@ -821,6 +822,7 @@ static void ProcessArgument(char* arg)
821822
else if (!strnicmp(arg,(char*)"client=",7)) // client=1.2.3.4:1024 or client=localhost:1024
822823
{
823824
server = false;
825+
client = true;
824826
char buffer[MAX_WORD_SIZE];
825827
strcpy(serverIP,arg+7);
826828

@@ -2123,12 +2125,12 @@ int PerformChat(char* user, char* usee, char* incoming,char* ip,char* output) //
21232125

21242126
mainInputBuffer = SkipWhitespace(incoming);
21252127
mainOutputBuffer = output;
2126-
strcpy(realinput, mainInputBuffer);
21272128
char* oobSkipped = SkipOOB(mainInputBuffer);
21282129
if (server)
21292130
{
21302131
AdjustUTF8(oobSkipped, oobSkipped - 1); // not needed coming locally - handle user stuff
21312132
}
2133+
strcpy(realinput, mainInputBuffer);
21322134
bool eraseUser = false;
21332135

21342136
// accept a user topic file erase command

SRC/mainSystem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ extern bool sentenceOverflow;
8686
extern char treetaggerParams[200];
8787
extern unsigned short int derivationIndex[256];
8888
extern int derivationLength;
89+
extern bool client;
8990
extern char* derivationSentence[MAX_SENTENCE_LENGTH];
9091
extern bool docstats;
9192
extern unsigned int docSentenceCount;

SRC/os.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ void myexit(char* msg, int code)
213213
if (code == 0) fprintf(in, (char*)"CS exited at %s\r\n", GetTimeInfo(&ptm, true));
214214
else fprintf(in, (char*)"CS terminated at %s\r\n", GetTimeInfo(&ptm, true));
215215
FClose(in);
216-
CloseSystem();
216+
if (!client) CloseSystem();
217217
exit((code == 0) ? EXIT_SUCCESS : EXIT_FAILURE);
218218
}
219219

SRC/textUtilities.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,6 +2172,10 @@ bool AdjustUTF8(char* start,char* buffer)
21722172
}
21732173
buffer = x - 1; // valid utf8
21742174
}
2175+
else if (*buffer == 0x92) // windows smart quote not real unicode
2176+
{
2177+
*buffer = '\'';
2178+
}
21752179
else // invalid utf8
21762180
{
21772181
hasbadutf = true;

0 commit comments

Comments
 (0)
0