Drop syslog output from Locale Kit add-ons, too
This commit is contained in:
@@ -14,8 +14,6 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <syslog.h>
|
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
@@ -125,9 +123,6 @@ PlainTextCatalog::PlainTextCatalog(const char *signature, const char *language,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fInitCheck = status;
|
fInitCheck = status;
|
||||||
log_team(LOG_DEBUG,
|
|
||||||
"trying to load default-catalog(sig=%s, lang=%s) results in %s",
|
|
||||||
signature, language, strerror(fInitCheck));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -161,10 +156,8 @@ PlainTextCatalog::ReadFromFile(const char *path)
|
|||||||
path = fPath.String();
|
path = fPath.String();
|
||||||
|
|
||||||
catalogFile.open(path, std::fstream::in);
|
catalogFile.open(path, std::fstream::in);
|
||||||
if (!catalogFile.is_open()) {
|
if (!catalogFile.is_open())
|
||||||
log_team(LOG_DEBUG, "couldn't open catalog at %s", path);
|
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
}
|
|
||||||
|
|
||||||
// Now read all the data from the file
|
// Now read all the data from the file
|
||||||
|
|
||||||
@@ -177,50 +170,35 @@ PlainTextCatalog::ReadFromFile(const char *path)
|
|||||||
ss >> arcver;
|
ss >> arcver;
|
||||||
if (ss.fail()) {
|
if (ss.fail()) {
|
||||||
// can't convert to int
|
// can't convert to int
|
||||||
log_team(LOG_DEBUG,
|
|
||||||
"Unable to extract archive version ( string: %s ) from %s",
|
|
||||||
currentItem.c_str(), path);
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arcver != kCatArchiveVersion) {
|
if (arcver != kCatArchiveVersion) {
|
||||||
// wrong version
|
// wrong version
|
||||||
log_team(LOG_DEBUG,
|
|
||||||
"Wrong archive version ! Got %d instead of %d from %s", arcver,
|
|
||||||
kCatArchiveVersion, path);
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
log_team(LOG_DEBUG, "Unable to read from catalog %s", path);
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
|
||||||
|
|
||||||
if (std::getline(catalogFile, currentItem, '\t').good()) {
|
if (std::getline(catalogFile, currentItem, '\t').good()) {
|
||||||
// Get the language
|
// Get the language
|
||||||
fLanguageName = currentItem.c_str() ;
|
fLanguageName = currentItem.c_str() ;
|
||||||
} else {
|
} else
|
||||||
log_team(LOG_DEBUG, "Unable to get language from %s", path);
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
|
||||||
|
|
||||||
if (std::getline(catalogFile, currentItem, '\t').good()) {
|
if (std::getline(catalogFile, currentItem, '\t').good()) {
|
||||||
// Get the signature
|
// Get the signature
|
||||||
fSignature = currentItem.c_str() ;
|
fSignature = currentItem.c_str() ;
|
||||||
} else {
|
} else
|
||||||
log_team(LOG_DEBUG, "Unable to get signature from %s", path);
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
|
||||||
|
|
||||||
if (std::getline(catalogFile, currentItem).good()) {
|
if (std::getline(catalogFile, currentItem).good()) {
|
||||||
// Get the fingerprint
|
// Get the fingerprint
|
||||||
std::istringstream ss(currentItem);
|
std::istringstream ss(currentItem);
|
||||||
uint32 foundFingerprint;
|
uint32 foundFingerprint;
|
||||||
ss >> foundFingerprint;
|
ss >> foundFingerprint;
|
||||||
if (ss.fail()) {
|
if (ss.fail())
|
||||||
log_team(LOG_DEBUG, "Unable to get fingerprint (%s) from %s",
|
|
||||||
currentItem.c_str(), path);
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
|
||||||
|
|
||||||
if (fFingerprint == 0)
|
if (fFingerprint == 0)
|
||||||
fFingerprint = foundFingerprint;
|
fFingerprint = foundFingerprint;
|
||||||
@@ -228,14 +206,11 @@ PlainTextCatalog::ReadFromFile(const char *path)
|
|||||||
if (fFingerprint != foundFingerprint) {
|
if (fFingerprint != foundFingerprint) {
|
||||||
return B_MISMATCHED_VALUES;
|
return B_MISMATCHED_VALUES;
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
log_team(LOG_DEBUG, "Unable to get fingerprint from %s", path);
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
|
||||||
|
|
||||||
// We managed to open the file, so we remember it's the one we are using
|
// We managed to open the file, so we remember it's the one we are using
|
||||||
fPath = path;
|
fPath = path;
|
||||||
log_team(LOG_DEBUG, "found plaintext catalog at %s", path);
|
|
||||||
|
|
||||||
std::string originalString;
|
std::string originalString;
|
||||||
std::string context;
|
std::string context;
|
||||||
@@ -245,24 +220,14 @@ PlainTextCatalog::ReadFromFile(const char *path)
|
|||||||
while (std::getline(catalogFile, originalString,'\t').good()) {
|
while (std::getline(catalogFile, originalString,'\t').good()) {
|
||||||
// Each line is : "original string \t context \t comment \t translation"
|
// Each line is : "original string \t context \t comment \t translation"
|
||||||
|
|
||||||
if (!std::getline(catalogFile, context,'\t').good()) {
|
if (!std::getline(catalogFile, context,'\t').good())
|
||||||
log_team(LOG_DEBUG, "Unable to get context for string %s from %s",
|
|
||||||
originalString.c_str(), path);
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
|
||||||
|
|
||||||
if (!std::getline(catalogFile, comment,'\t').good()) {
|
if (!std::getline(catalogFile, comment,'\t').good())
|
||||||
log_team(LOG_DEBUG, "Unable to get comment for string %s from %s",
|
|
||||||
originalString.c_str(), path);
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
|
||||||
|
|
||||||
if (!std::getline(catalogFile, translated).good()) {
|
if (!std::getline(catalogFile, translated).good())
|
||||||
log_team(LOG_DEBUG,
|
|
||||||
"Unable to get translated text for string %s from %s",
|
|
||||||
originalString.c_str(), path);
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
|
||||||
|
|
||||||
// We could do that :
|
// We could do that :
|
||||||
// SetString(key, translated.c_str());
|
// SetString(key, translated.c_str());
|
||||||
@@ -270,22 +235,13 @@ PlainTextCatalog::ReadFromFile(const char *path)
|
|||||||
// happen, you know. (and CatKey::== will fail)
|
// happen, you know. (and CatKey::== will fail)
|
||||||
SetString(originalString.c_str(), translated.c_str(), context.c_str(),
|
SetString(originalString.c_str(), translated.c_str(), context.c_str(),
|
||||||
comment.c_str());
|
comment.c_str());
|
||||||
log_team(LOG_DEBUG, "Added string %s from file %s",
|
|
||||||
originalString.c_str(), path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catalogFile.close();
|
catalogFile.close();
|
||||||
|
|
||||||
uint32 checkFP = ComputeFingerprint();
|
uint32 checkFP = ComputeFingerprint();
|
||||||
if (fFingerprint != checkFP) {
|
if (fFingerprint != checkFP)
|
||||||
log_team(LOG_DEBUG, "plaintext-catalog(sig=%s, lang=%s) "
|
|
||||||
"has wrong fingerprint after load (%lu instead of %lu). "
|
|
||||||
"The catalog data may be corrupted, so this catalog is "
|
|
||||||
"skipped.\n",
|
|
||||||
fSignature.String(), fLanguageName.String(), checkFP,
|
|
||||||
fFingerprint);
|
|
||||||
return B_BAD_DATA;
|
return B_BAD_DATA;
|
||||||
}
|
|
||||||
|
|
||||||
// some information living in member variables needs to be copied
|
// some information living in member variables needs to be copied
|
||||||
// to attributes. Although these attributes should have been written
|
// to attributes. Although these attributes should have been written
|
||||||
|
|||||||
Reference in New Issue
Block a user