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