mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-24 04:20:56 -04:00
Use printf instead of cout.
`std::cout` stream is not thread safe at all. Printing from different threads can lead to corrupted stream (and no output working). Using `printf` may still lead to interleaved output but nothing will broke.
This commit is contained in:
parent
0364951f75
commit
4534b51f5e
@ -320,7 +320,7 @@ static struct MHD_Response* handle_suggest(
|
|||||||
= MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "term");
|
= MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "term");
|
||||||
std::string term = cTerm == NULL ? "" : cTerm;
|
std::string term = cTerm == NULL ? "" : cTerm;
|
||||||
if (isVerbose.load()) {
|
if (isVerbose.load()) {
|
||||||
std::cout << "Searching suggestions for: \"" << term << "\"" << endl;
|
printf("Searching suggestions for: \"%s\"\n", term.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_lock(&searchLock);
|
pthread_mutex_lock(&searchLock);
|
||||||
@ -496,7 +496,7 @@ static struct MHD_Response* handle_content(
|
|||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
if (isVerbose.load())
|
if (isVerbose.load())
|
||||||
cout << "Failed to find " << urlStr << endl;
|
printf("Failed to find %s\n", urlStr.c_str());
|
||||||
|
|
||||||
content
|
content
|
||||||
= "<!DOCTYPE html>\n<html><head><meta "
|
= "<!DOCTYPE html>\n<html><head><meta "
|
||||||
@ -520,8 +520,8 @@ static struct MHD_Response* handle_content(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isVerbose.load()) {
|
if (isVerbose.load()) {
|
||||||
cout << "Found " << urlStr << endl;
|
printf("Found %s\n", urlStr.c_str());
|
||||||
cout << "mimeType: " << mimeType << endl;
|
printf("mimeType: %s\n", mimeType.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
zim::Blob raw_content = article.getData();
|
zim::Blob raw_content = article.getData();
|
||||||
@ -610,7 +610,7 @@ static int accessHandlerCallback(void* cls,
|
|||||||
|
|
||||||
/* Debug */
|
/* Debug */
|
||||||
if (isVerbose.load()) {
|
if (isVerbose.load()) {
|
||||||
std::cout << "Requesting " << url << std::endl;
|
printf("Requesting %s\n", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the response can be compressed */
|
/* Check if the response can be compressed */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user