From: <arn...@us...> - 2008-01-23 19:46:29
|
Revision: 974 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=974&view=rev Author: arnetheduck Date: 2008-01-23 11:46:22 -0800 (Wed, 23 Jan 2008) Log Message: ----------- gettext patch Modified Paths: -------------- dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/BZUtils.cpp dcplusplus/trunk/dcpp/BitInputStream.h dcplusplus/trunk/dcpp/BufferedSocket.cpp dcplusplus/trunk/dcpp/Client.cpp dcplusplus/trunk/dcpp/ClientManager.cpp dcplusplus/trunk/dcpp/ConnectionManager.cpp dcplusplus/trunk/dcpp/CryptoManager.cpp dcplusplus/trunk/dcpp/DCPlusPlus.cpp dcplusplus/trunk/dcpp/DirectoryListing.cpp dcplusplus/trunk/dcpp/DownloadManager.cpp dcplusplus/trunk/dcpp/FavoriteManager.cpp dcplusplus/trunk/dcpp/HashManager.cpp dcplusplus/trunk/dcpp/MerkleCheckOutputStream.h dcplusplus/trunk/dcpp/NmdcHub.cpp dcplusplus/trunk/dcpp/QueueManager.cpp dcplusplus/trunk/dcpp/SearchManager.cpp dcplusplus/trunk/dcpp/ShareManager.cpp dcplusplus/trunk/dcpp/Socket.cpp dcplusplus/trunk/dcpp/Thread.cpp dcplusplus/trunk/dcpp/Transfer.cpp dcplusplus/trunk/dcpp/UploadManager.cpp dcplusplus/trunk/dcpp/UserConnection.cpp dcplusplus/trunk/dcpp/ZUtils.cpp Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -29,7 +29,6 @@ #include "Util.h" #include "UserCommand.h" #include "CryptoManager.h" -#include "ResourceManager.h" #include "LogManager.h" namespace dcpp { @@ -552,7 +551,7 @@ uint16_t port = secure ? ConnectionManager::getInstance()->getSecurePort() : ConnectionManager::getInstance()->getPort(); if(port == 0) { // Oops? - LogManager::getInstance()->message(STRING(NOT_LISTENING)); + LogManager::getInstance()->message(_("Not listening for connections - please restart DC++")); return; } send(AdcCommand(AdcCommand::CMD_CTM, user.getIdentity().getSID(), AdcCommand::TYPE_DIRECT).addParam(*proto).addParam(Util::toString(port)).addParam(token)); Modified: dcplusplus/trunk/dcpp/BZUtils.cpp =================================================================== --- dcplusplus/trunk/dcpp/BZUtils.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/BZUtils.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "BZUtils.h" #include "Exception.h" -#include "ResourceManager.h" namespace dcpp { @@ -29,7 +28,7 @@ memset(&zs, 0, sizeof(zs)); if(BZ2_bzCompressInit(&zs, 9, 0, 30) != BZ_OK) { - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); } } @@ -50,7 +49,7 @@ if(insize == 0) { int err = ::BZ2_bzCompress(&zs, BZ_FINISH); if(err != BZ_FINISH_OK && err != BZ_STREAM_END) - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); outsize = outsize - zs.avail_out; insize = insize - zs.avail_in; @@ -58,7 +57,7 @@ } else { int err = ::BZ2_bzCompress(&zs, BZ_RUN); if(err != BZ_RUN_OK) - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); outsize = outsize - zs.avail_out; insize = insize - zs.avail_in; @@ -70,7 +69,7 @@ memset(&zs, 0, sizeof(zs)); if(BZ2_bzDecompressInit(&zs, 0, 0) != BZ_OK) - throw Exception(STRING(DECOMPRESSION_ERROR)); + throw Exception(_("Error during decompression")); } @@ -92,10 +91,10 @@ // No more input data, and inflate didn't think it has reached the end... if(insize == 0 && zs.avail_out != 0 && err != BZ_STREAM_END) - throw Exception(STRING(DECOMPRESSION_ERROR)); + throw Exception(_("Error during decompression")); if(err != BZ_OK && err != BZ_STREAM_END) - throw Exception(STRING(DECOMPRESSION_ERROR)); + throw Exception(_("Error during decompression")); outsize = outsize - zs.avail_out; insize = insize - zs.avail_in; Modified: dcplusplus/trunk/dcpp/BitInputStream.h =================================================================== --- dcplusplus/trunk/dcpp/BitInputStream.h 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/BitInputStream.h 2008-01-23 19:46:22 UTC (rev 974) @@ -20,7 +20,6 @@ #define BIT_INPUT_STREAM_H #include "Exception.h" -#include "ResourceManager.h" namespace dcpp { @@ -38,7 +37,7 @@ bool get() throw(BitStreamException) { if(bitPos > endPos) { - throw BitStreamException(STRING(SEEK_BEYOND_END)); + throw BitStreamException(_("Request to seek beyond the end of data")); } bool ret = (((uint8_t)is[bitPos>>3]) >> (bitPos&0x07)) & 0x01; bitPos++; Modified: dcplusplus/trunk/dcpp/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/dcpp/BufferedSocket.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/BufferedSocket.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "BufferedSocket.h" -#include "ResourceManager.h" #include "TimerManager.h" #include "SettingsManager.h" @@ -152,7 +151,7 @@ return; if((startTime + 30000) < GET_TICK()) { - throw SocketException(STRING(CONNECTION_TIMEOUT)); + throw SocketException(_("Connection timeout")); } } @@ -169,7 +168,7 @@ return; } else if(left == 0) { // This socket has been closed... - throw SocketException(STRING(CONNECTION_CLOSED)); + throw SocketException(("Connection closed")); } size_t used; string::size_type pos = 0; @@ -261,7 +260,7 @@ } if(mode == MODE_LINE && line.size() > static_cast<size_t>(SETTING(MAX_COMMAND_LENGTH))) { - throw SocketException(STRING(COMMAND_TOO_LONG)); + throw SocketException(_("Maximum command length exceeded")); } } @@ -407,7 +406,7 @@ } if(failed && p.first != SHUTDOWN) { dcdebug("BufferedSocket: New command when already failed: %d\n", p.first); - fail(STRING(DISCONNECTED)); + fail(_("Disconnected")); delete p.second; continue; } @@ -425,7 +424,7 @@ } case DISCONNECT: if(isConnected()) - fail(STRING(DISCONNECTED)); + fail(_("Disconnected")); break; case SHUTDOWN: return false; Modified: dcplusplus/trunk/dcpp/Client.cpp =================================================================== --- dcplusplus/trunk/dcpp/Client.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/Client.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -25,7 +25,6 @@ #include "FavoriteManager.h" #include "TimerManager.h" -#include "ResourceManager.h" #include "ClientManager.h" namespace dcpp { Modified: dcplusplus/trunk/dcpp/ClientManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ClientManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/ClientManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -27,7 +27,6 @@ #include "FavoriteManager.h" #include "SimpleXML.h" #include "UserCommand.h" -#include "ResourceManager.h" #include "LogManager.h" #include "AdcHub.h" @@ -113,7 +112,7 @@ if(i != onlineUsers.end()) { return i->second->getIdentity().getConnection(); } - return STRING(OFFLINE); + return _("Offline"); } int64_t ClientManager::getAvailable() const { Modified: dcplusplus/trunk/dcpp/ConnectionManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ConnectionManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/ConnectionManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "ConnectionManager.h" -#include "ResourceManager.h" #include "DownloadManager.h" #include "UploadManager.h" #include "CryptoManager.h" @@ -179,13 +178,13 @@ attemptDone = true; } else { cqi->setState(ConnectionQueueItem::NO_DOWNLOAD_SLOTS); - fire(ConnectionManagerListener::Failed(), cqi, STRING(ALL_DOWNLOAD_SLOTS_TAKEN)); + fire(ConnectionManagerListener::Failed(), cqi, _("All download slots taken")); } } else if(cqi->getState() == ConnectionQueueItem::NO_DOWNLOAD_SLOTS && startDown) { cqi->setState(ConnectionQueueItem::WAITING); } } else if(((cqi->getLastAttempt() + 50*1000) < aTick) && (cqi->getState() == ConnectionQueueItem::CONNECTING)) { - fire(ConnectionManagerListener::Failed(), cqi, STRING(CONNECTION_TIMEOUT)); + fire(ConnectionManagerListener::Failed(), cqi, _("Connection timeout")); cqi->setState(ConnectionQueueItem::WAITING); } } @@ -237,7 +236,7 @@ } } } catch(const Exception& e) { - LogManager::getInstance()->message(STRING(LISTENER_FAILED) + e.getError()); + LogManager::getInstance()->message(str(F_("Listening socket failed (you need to restart DC++): %1%") % e.getError())); } return 0; } @@ -383,7 +382,7 @@ void ConnectionManager::on(UserConnectionListener::Connected, UserConnection* aSource) throw() { if(aSource->isSecure() && !aSource->isTrusted() && !BOOLSETTING(ALLOW_UNTRUSTED_CLIENTS)) { putConnection(aSource); - LogManager::getInstance()->message(STRING(CERTIFICATE_NOT_TRUSTED)); + LogManager::getInstance()->message(_("Certificate not trusted, unable to connect")); return; } Modified: dcplusplus/trunk/dcpp/CryptoManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/CryptoManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/CryptoManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -23,7 +23,6 @@ #include "BitInputStream.h" #include "BitOutputStream.h" -#include "ResourceManager.h" #include "LogManager.h" #include "ClientManager.h" @@ -211,7 +210,7 @@ const string& key = SETTING(TLS_PRIVATE_KEY_FILE); if(cert.empty() || key.empty()) { - LogManager::getInstance()->message(STRING(NO_CERTIFICATE_FILE_SET)); + LogManager::getInstance()->message(_("TLS disabled, no certificate file set")); return; } @@ -219,45 +218,45 @@ // Try to generate them... try { generateCertificate(); - LogManager::getInstance()->message(STRING(CERTIFICATE_GENERATED)); + LogManager::getInstance()->message(_("Generated new TLS certificate")); } catch(const CryptoException& e) { - LogManager::getInstance()->message(STRING(CERTIFICATE_GENERATION_FAILED) + e.getError()); + LogManager::getInstance()->message(str(F_("TLS disabled, failed to generate certificate: %1%") % e.getError())); } } if(SSL_CTX_use_certificate_file(serverContext, SETTING(TLS_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_CERTIFICATE)); + LogManager::getInstance()->message(_("Failed to load certificate file")); return; } if(SSL_CTX_use_certificate_file(clientContext, SETTING(TLS_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_CERTIFICATE)); + LogManager::getInstance()->message(_("Failed to load certificate file")); return; } if(SSL_CTX_use_certificate_file(serverVerContext, SETTING(TLS_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_CERTIFICATE)); + LogManager::getInstance()->message(_("Failed to load certificate file")); return; } if(SSL_CTX_use_certificate_file(clientVerContext, SETTING(TLS_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_CERTIFICATE)); + LogManager::getInstance()->message(_("Failed to load certificate file")); return; } if(SSL_CTX_use_PrivateKey_file(serverContext, SETTING(TLS_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_PRIVATE_KEY)); + LogManager::getInstance()->message(_("Failed to load private key")); return; } if(SSL_CTX_use_PrivateKey_file(clientContext, SETTING(TLS_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_PRIVATE_KEY)); + LogManager::getInstance()->message(_("Failed to load private key")); return; } if(SSL_CTX_use_PrivateKey_file(serverVerContext, SETTING(TLS_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_PRIVATE_KEY)); + LogManager::getInstance()->message(_("Failed to load private key")); return; } if(SSL_CTX_use_PrivateKey_file(clientVerContext, SETTING(TLS_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_PRIVATE_KEY)); + LogManager::getInstance()->message(_("Failed to load private key")); return; } @@ -342,7 +341,7 @@ bz_stream bs = { 0 }; if(BZ2_bzDecompressInit(&bs, 0, 0) != BZ_OK) - throw(CryptoException(STRING(DECOMPRESSION_ERROR))); + throw(CryptoException(_("Error during decompression"))); // We assume that the files aren't compressed more than 2:1...if they are it'll work anyway, // but we'll have to do multiple passes... @@ -361,7 +360,7 @@ while((err = BZ2_bzDecompress(&bs)) == BZ_OK) { if (bs.avail_in == 0 && bs.avail_out > 0) { // error: BZ_UNEXPECTED_EOF BZ2_bzDecompressEnd(&bs); - throw CryptoException(STRING(DECOMPRESSION_ERROR)); + throw CryptoException(_("Error during decompression")); } os.append(buf, bufsize-bs.avail_out); bs.avail_out = bufsize; @@ -375,7 +374,7 @@ if(err < 0) { // This was a real error - throw CryptoException(STRING(DECOMPRESSION_ERROR)); + throw CryptoException(_("Error during decompression")); } } Modified: dcplusplus/trunk/dcpp/DCPlusPlus.cpp =================================================================== --- dcplusplus/trunk/dcpp/DCPlusPlus.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/DCPlusPlus.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -97,13 +97,13 @@ CryptoManager::getInstance()->loadCertificates(); if(f != NULL) - (*f)(p, STRING(HASH_DATABASE)); + (*f)(p, _("Hash database")); HashManager::getInstance()->startup(); if(f != NULL) - (*f)(p, STRING(SHARED_FILES)); + (*f)(p, _("Shared Files")); ShareManager::getInstance()->refresh(true, false, true); if(f != NULL) - (*f)(p, STRING(DOWNLOAD_QUEUE)); + (*f)(p, _("Download Queue")); QueueManager::getInstance()->loadQueue(); } Modified: dcplusplus/trunk/dcpp/DirectoryListing.cpp =================================================================== --- dcplusplus/trunk/dcpp/DirectoryListing.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/DirectoryListing.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -30,7 +30,6 @@ #include "FilteredFile.h" #include "BZUtils.h" #include "CryptoManager.h" -#include "ResourceManager.h" #ifdef ff #undef ff @@ -100,7 +99,7 @@ } else if(Util::stricmp(ext, ".xml") == 0) { int64_t sz = dcpp::File::getSize(name); if(sz == -1 || sz >= static_cast<int64_t>(txt.max_size())) - throw FileException(STRING(FILE_NOT_AVAILABLE)); + throw FileException(_("File not available")); txt.resize((size_t) sz); size_t n = txt.length(); Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "DownloadManager.h" -#include "ResourceManager.h" #include "QueueManager.h" #include "Download.h" #include "LogManager.h" @@ -141,9 +140,9 @@ // Try to just rename it to the correct name at least string newTarget = Util::getFilePath(next.first) + Util::getFileName(next.second); File::renameFile(next.first, newTarget); - LogManager::getInstance()->message(next.first + STRING(RENAMED_TO) + newTarget); + LogManager::getInstance()->message(str(F_("%1% renamed to %2%") % next.first % newTarget)); } catch(const FileException& e) { - LogManager::getInstance()->message(STRING(UNABLE_TO_RENAME) + next.first + ": " + e.getError()); + LogManager::getInstance()->message(str(F_("Unable to rename %1%: %2%") % next.first % e.getError())); } } } @@ -262,12 +261,12 @@ if(bytes != -1) { d->setSize(bytes); } else { - failDownload(aSource, STRING(INVALID_SIZE)); + failDownload(aSource, _("Invalid size")); return false; } } else if(d->getSize() != bytes || d->getStartPos() != start) { // This is not what we requested... - failDownload(aSource, STRING(INVALID_SIZE)); + failDownload(aSource, _("Invalid size")); return false; } @@ -282,7 +281,7 @@ try { QueueManager::getInstance()->setFile(d); } catch(const FileException& e) { - failDownload(aSource, STRING(COULD_NOT_OPEN_TARGET_FILE) + e.getError()); + failDownload(aSource, str(F_("Could not open target file: %1%") % e.getError())); return false; } catch(const Exception& e) { failDownload(aSource, e.getError()); @@ -321,7 +320,7 @@ d->addPos(d->getFile()->write(aData, aLen), aLen); if(d->getPos() > d->getSize()) { - throw Exception(STRING(TOO_MUCH_DATA)); + throw Exception(_("More data was sent than was expected")); } else if(d->getPos() == d->getSize()) { handleEndData(aSource); aSource->setLineMode(0); @@ -351,7 +350,7 @@ if(!(d->getTTH() == d->getTigerTree().getRoot())) { // This tree is for a different file, remove from queue... removeDownload(d); - fire(DownloadManagerListener::Failed(), d, STRING(INVALID_TREE)); + fire(DownloadManagerListener::Failed(), d, _("Full tree does not match TTH root")); QueueManager::getInstance()->removeSource(d->getPath(), aSource->getUser(), QueueItem::Source::FLAG_BAD_TREE, false); @@ -417,9 +416,9 @@ if(!crcMatch) { File::deleteFile(d->getDownloadTarget()); dcdebug("DownloadManager: CRC32 mismatch for %s\n", d->getPath().c_str()); - LogManager::getInstance()->message(STRING(SFV_INCONSISTENCY) + " (" + STRING(FILE) + ": " + d->getPath() + ")"); + LogManager::getInstance()->message(str(F_("CRC32 inconsistency (SFV-Check) (File: %1%)") % d->getPath())); removeDownload(d); - fire(DownloadManagerListener::Failed(), d, STRING(SFV_INCONSISTENCY)); + fire(DownloadManagerListener::Failed(), d, _("CRC32 inconsistency (SFV-Check)")); QueueManager::getInstance()->removeSource(d->getPath(), aSource->getUser(), QueueItem::Source::FLAG_CRC_WARN, false); QueueManager::getInstance()->putDownload(d, false); @@ -460,7 +459,7 @@ return; } - failDownload(aSource, STRING(NO_SLOTS_AVAILABLE)); + failDownload(aSource, _("No slots available")); } void DownloadManager::on(UserConnectionListener::Error, UserConnection* aSource, const string& aError) throw() { @@ -545,7 +544,7 @@ dcdebug("File Not Available: %s\n", d->getPath().c_str()); removeDownload(d); - fire(DownloadManagerListener::Failed(), d, d->getTargetFileName() + ": " + STRING(FILE_NOT_AVAILABLE)); + fire(DownloadManagerListener::Failed(), d, str(F_("%1%: File not available") % d->getTargetFileName())); QueueManager::getInstance()->removeSource(d->getPath(), aSource->getUser(), d->getType() == Transfer::TYPE_TREE ? QueueItem::Source::FLAG_NO_TREE : QueueItem::Source::FLAG_FILE_NOT_AVAILABLE, false); Modified: dcplusplus/trunk/dcpp/FavoriteManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/FavoriteManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/FavoriteManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -22,7 +22,6 @@ #include "FavoriteManager.h" #include "ClientManager.h" -#include "ResourceManager.h" #include "CryptoManager.h" #include "HttpConnection.h" @@ -436,11 +435,11 @@ static const char kickstr[] = "$To: %[userNI] From: %[myNI] $<%[myNI]> You are being kicked because: %[line:Reason]|<%[myNI]> %[myNI] is kicking %[userNI] because: %[line:Reason]|$Kick %[userNI]|"; addUserCommand(UserCommand::TYPE_RAW_ONCE, UserCommand::CONTEXT_CHAT | UserCommand::CONTEXT_SEARCH, UserCommand::FLAG_NOSAVE, - STRING(KICK_USER), kickstr, "op"); + _("Kick user(s)"), kickstr, "op"); static const char redirstr[] = "$OpForceMove $Who:%[userNI]$Where:%[line:Target Server]$Msg:%[line:Message]|"; addUserCommand(UserCommand::TYPE_RAW_ONCE, UserCommand::CONTEXT_CHAT | UserCommand::CONTEXT_SEARCH, UserCommand::FLAG_NOSAVE, - STRING(REDIRECT_USER), redirstr, "op"); + _("Redirect user(s)"), redirstr, "op"); try { SimpleXML xml; Modified: dcplusplus/trunk/dcpp/HashManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/HashManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/HashManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -20,7 +20,6 @@ #include "DCPlusPlus.h" #include "HashManager.h" -#include "ResourceManager.h" #include "SimpleXML.h" #include "LogManager.h" #include "File.h" @@ -71,7 +70,7 @@ Lock l(cs); store.addFile(aFileName, aTimeStamp, tth, true); } catch(const Exception& e) { - LogManager::getInstance()->message(STRING(HASHING_FAILED) + e.getError()); + LogManager::getInstance()->message(str(F_("Hashing failed: %1%") % e.getError())); return; } @@ -85,9 +84,9 @@ fn.insert(0, "..."); } if(speed > 0) { - LogManager::getInstance()->message(STRING(HASHING_FINISHED) + fn + " (" + Util::formatBytes(speed) + "/s)"); + LogManager::getInstance()->message(str(F_("Finished hashing: %1% (%2%/s)") % fn % Util::formatBytes(speed))); } else { - LogManager::getInstance()->message(STRING(HASHING_FINISHED) + fn); + LogManager::getInstance()->message(str(F_("Finished hashing: %1%") % fn)); } } @@ -116,7 +115,7 @@ treeIndex.insert(make_pair(tt.getRoot(), TreeInfo(tt.getFileSize(), index, tt.getBlockSize()))); dirty = true; } catch(const FileException& e) { - LogManager::getInstance()->message(STRING(ERROR_SAVING_HASH) + e.getError()); + LogManager::getInstance()->message(str(F_("Error saving hash data: %1%") % e.getError())); } } } @@ -129,7 +128,7 @@ int64_t pos = 0; size_t n = sizeof(pos); if(f.read(&pos, n) != sizeof(pos)) - throw HashException(STRING(HASH_READ_FAILED)); + throw HashException(_("Unable to read hash data file")); // Check if we should grow the file, we grow by a meg at a time... int64_t datsz = f.getSize(); @@ -275,7 +274,7 @@ dirty = true; save(); } catch(const Exception& e) { - LogManager::getInstance()->message(STRING(HASHING_FAILED) + e.getError()); + LogManager::getInstance()->message(str(F_("Hashing failed: %1%") % e.getError())); } } @@ -331,7 +330,7 @@ dirty = false; } catch(const FileException& e) { - LogManager::getInstance()->message(STRING(ERROR_SAVING_HASH) + e.getError()); + LogManager::getInstance()->message(str(F_("Error saving hash data: %1%") % e.getError())); } } } @@ -454,7 +453,7 @@ dat.write(&start, sizeof(start)); } catch(const FileException& e) { - LogManager::getInstance()->message(STRING(ERROR_CREATING_HASH_DATA_FILE) + e.getError()); + LogManager::getInstance()->message(str(F_("Error creating hash data file: %1%") % e.getError())); } } @@ -675,7 +674,7 @@ if(rebuild) { HashManager::getInstance()->doRebuild(); rebuild = false; - LogManager::getInstance()->message(STRING(HASH_REBUILT)); + LogManager::getInstance()->message(_("Hash database rebuilt")); continue; } { @@ -765,12 +764,12 @@ speed = size * _LL(1000) / (end - start); } if(xcrc32 && xcrc32->getValue() != sfv.getCRC()) { - LogManager::getInstance()->message(fname + STRING(NO_CRC32_MATCH)); + LogManager::getInstance()->message(str(F_("%1% not shared; calculated CRC32 does not match the one found in SFV file.") % fname)); } else { HashManager::getInstance()->hashDone(fname, timestamp, *tth, speed); } } catch(const FileException& e) { - LogManager::getInstance()->message(STRING(ERROR_HASHING) + fname + ": " + e.getError()); + LogManager::getInstance()->message(str(F_("Error hashing %1%: %2%") % fname % e.getError())); } } { Modified: dcplusplus/trunk/dcpp/MerkleCheckOutputStream.h =================================================================== --- dcplusplus/trunk/dcpp/MerkleCheckOutputStream.h 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/MerkleCheckOutputStream.h 2008-01-23 19:46:22 UTC (rev 974) @@ -50,7 +50,7 @@ cur.finalize(); if(cur.getLeaves().size() == real.getLeaves().size()) { if (cur.getRoot() != real.getRoot()) - throw FileException(STRING(TTH_INCONSISTENCY)); + throw FileException(_("TTH inconsistency")); } else { checkTrees(); } @@ -110,7 +110,7 @@ if(cur.getLeaves().size() > real.getLeaves().size() || !(cur.getLeaves()[verified] == real.getLeaves()[verified])) { - throw FileException(STRING(TTH_INCONSISTENCY)); + throw FileException(_("TTH inconsistency")); } verified++; } Modified: dcplusplus/trunk/dcpp/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "NmdcHub.h" -#include "ResourceManager.h" #include "ClientManager.h" #include "SearchManager.h" #include "ShareManager.h" @@ -271,7 +270,7 @@ if(seeker.compare(0, 4, "Hub:") == 0) fire(ClientListener::SearchFlood(), this, seeker.substr(4)); else - fire(ClientListener::SearchFlood(), this, seeker + STRING(NICK_UNKNOWN)); + fire(ClientListener::SearchFlood(), this, str(F_("%1% (Nick unknown)") % seeker)); flooders.push_back(make_pair(seeker, tick)); return; Modified: dcplusplus/trunk/dcpp/QueueManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/QueueManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -381,7 +381,7 @@ void QueueManager::addPfs(const UserPtr& aUser, const string& aDir) throw(QueueException) { if(aUser == ClientManager::getInstance()->getMe()) { - throw QueueException(STRING(NO_DOWNLOADS_FROM_SELF)); + throw QueueException(_("You're trying to download from yourself!")); } if(!aUser->isOnline()) @@ -405,13 +405,13 @@ // Check that we're not downloading from ourselves... if(aUser == ClientManager::getInstance()->getMe()) { - throw QueueException(STRING(NO_DOWNLOADS_FROM_SELF)); + throw QueueException(_("You're trying to download from yourself!")); } // Check if we're not downloading something already in our share if(BOOLSETTING(DONT_DL_ALREADY_SHARED)){ if (ShareManager::getInstance()->isTTHShared(root)){ - throw QueueException(STRING(TTH_ALREADY_SHARED)); + throw QueueException(_("A file with the same hash already exists in your share")); } } @@ -434,7 +434,7 @@ QueueItem::List ql; fileQueue.find(ql, root); if(!ql.empty()) { - throw QueueException(STRING(FILE_IS_ALREADY_QUEUED)); + throw QueueException(_("This file is already queued")); } } @@ -444,10 +444,10 @@ fire(QueueManagerListener::Added(), q); } else { if(q->getSize() != aSize) { - throw QueueException(STRING(FILE_WITH_DIFFERENT_SIZE)); + throw QueueException(_("A file with a different size already exists in the queue")); } if(!(root == q->getTTH())) { - throw QueueException(STRING(FILE_WITH_DIFFERENT_TTH)); + throw QueueException(_("A file with different tth root already exists in the queue")); } q->setFlag(aFlags); @@ -479,20 +479,20 @@ string QueueManager::checkTarget(const string& aTarget, int64_t aSize, int& flags) throw(QueueException, FileException) { #ifdef _WIN32 if(aTarget.length() > MAX_PATH) { - throw QueueException(STRING(TARGET_FILENAME_TOO_LONG)); + throw QueueException(_("Target filename too long")); } // Check that target starts with a drive or is an UNC path if( (aTarget[1] != ':' || aTarget[2] != '\\') && (aTarget[0] != '\\' && aTarget[1] != '\\') ) { - throw QueueException(STRING(INVALID_TARGET_FILE)); + throw QueueException(_("Invalid target file (missing directory, check default download directory setting)")); } #else if(aTarget.length() > PATH_MAX) { - throw QueueException(STRING(TARGET_FILENAME_TOO_LONG)); + throw QueueException(_("Target filename too long")); } // Check that target contains at least one directory...we don't want headless files... if(aTarget[0] != '/') { - throw QueueException(STRING(INVALID_TARGET_FILE)); + throw QueueException(_("Invalid target file (missing directory, check default download directory setting)")); } #endif @@ -501,7 +501,7 @@ // Check that the file doesn't already exist... int64_t sz = File::getSize(target); if( (aSize != -1) && (aSize <= sz) ) { - throw FileException(STRING(LARGER_TARGET_FILE_EXISTS)); + throw FileException(_("A file of equal or larger size already exists at the target location")); } if(sz > 0) flags |= QueueItem::FLAG_EXISTS; @@ -514,11 +514,11 @@ bool wantConnection = (qi->getPriority() != QueueItem::PAUSED) && !userQueue.getRunning(aUser); if(qi->isSource(aUser)) { - throw QueueException(STRING(DUPLICATE_SOURCE) + ": " + Util::getFileName(qi->getTarget())); + throw QueueException(str(F_("Duplicate source: %1%") % Util::getFileName(qi->getTarget()))); } if(qi->isBadSourceExcept(aUser, addBad)) { - throw QueueException(STRING(DUPLICATE_SOURCE) + ": " + Util::getFileName(qi->getTarget())); + throw QueueException(str(F_("Duplicate source: %1%") % Util::getFileName(qi->getTarget()))); } qi->addSource(aUser); @@ -767,7 +767,7 @@ QueueItem* qi = fileQueue.find(d->getPath()); if(!qi) { - throw QueueException(STRING(TARGET_REMOVED)); + throw QueueException(_("Target removed")); } string target = d->getDownloadTarget(); @@ -955,7 +955,7 @@ try { dirList.loadFile(name); } catch(const Exception&) { - LogManager::getInstance()->message(STRING(UNABLE_TO_OPEN_FILELIST) + name); + LogManager::getInstance()->message(str(F_("Unable to open filelist: %1%") % name)); return; } Modified: dcplusplus/trunk/dcpp/SearchManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/SearchManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/SearchManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -24,7 +24,6 @@ #include "ClientManager.h" #include "ShareManager.h" -#include "ResourceManager.h" namespace dcpp { @@ -265,7 +264,7 @@ if(hubName.compare(0, 4, "TTH:") == 0) { tth = hubName.substr(4); StringList names = ClientManager::getInstance()->getHubNames(user->getCID()); - hubName = names.empty() ? STRING(OFFLINE) : Util::toString(names); + hubName = names.empty() ? _("Offline") : Util::toString(names); } if(tth.empty() && type == SearchResult::TYPE_FILE) { @@ -327,9 +326,9 @@ if(!file.empty() && freeSlots != -1 && size != -1) { StringList names = ClientManager::getInstance()->getHubNames(from->getCID()); - string hubName = names.empty() ? STRING(OFFLINE) : Util::toString(names); + string hubName = names.empty() ? _("Offline") : Util::toString(names); StringList hubs = ClientManager::getInstance()->getHubs(from->getCID()); - string hub = hubs.empty() ? STRING(OFFLINE) : Util::toString(hubs); + string hub = hubs.empty() ? _("Offline") : Util::toString(hubs); SearchResult::Types type = (file[file.length() - 1] == '\\' ? SearchResult::TYPE_DIRECTORY : SearchResult::TYPE_FILE); if(type == SearchResult::TYPE_FILE && tth.empty()) Modified: dcplusplus/trunk/dcpp/ShareManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ShareManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/ShareManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -20,7 +20,6 @@ #include "DCPlusPlus.h" #include "ShareManager.h" -#include "ResourceManager.h" #include "CryptoManager.h" #include "ClientManager.h" @@ -401,11 +400,11 @@ void ShareManager::addDirectory(const string& realPath, const string& virtualName) throw(ShareException) { if(realPath.empty() || virtualName.empty()) { - throw ShareException(STRING(NO_DIRECTORY_SPECIFIED)); + throw ShareException(_("No directory specified")); } if(Util::stricmp(SETTING(TEMP_DOWNLOAD_DIRECTORY), realPath) == 0) { - throw ShareException(STRING(DONT_SHARE_TEMP_DIRECTORY)); + throw ShareException(_("The temporary download directory cannot be shared")); } string vName = validateVirtual(virtualName); @@ -416,15 +415,15 @@ for(Directory::MapIter i = directories.begin(); i != directories.end(); ++i) { if(Util::strnicmp(realPath, i->first, i->first.length()) == 0) { // Trying to share an already shared directory - throw ShareException(STRING(DIRECTORY_ALREADY_SHARED)); + throw ShareException(_("Directory already shared")); } else if(Util::strnicmp(realPath, i->first, realPath.length()) == 0) { // Trying to share a parent directory - throw ShareException(STRING(REMOVE_ALL_SUBDIRECTORIES)); + throw ShareException(_("Remove all subdirectories before adding this one")); } } if(hasVirtual(vName)) { - throw ShareException(STRING(VIRTUAL_NAME_EXISTS)); + throw ShareException(_("Virtual directory name already exists")); } } @@ -466,7 +465,7 @@ Lock l(cs); //Find the virtual name if (hasVirtual(vName)) { - throw ShareException(STRING(VIRTUAL_NAME_EXISTS)); + throw ShareException(_("Virtual directory name already exists")); } Directory::MapIter j = directories.find(realPath); @@ -743,7 +742,8 @@ dir.size+=f.getSize(); } else { if(!SETTING(LIST_DUPES)) { - LogManager::getInstance()->message(STRING(DUPLICATE_FILE_NOT_SHARED) + dir.getFullName() + f.getName() + " (" + STRING(SIZE) + ": " + Util::toString(f.getSize()) + " " + STRING(B) + ") " + STRING(DUPLICATE_MATCH) + j->second->getParent()->getFullName() + j->second->getName() ); + LogManager::getInstance()->message(str(F_("Duplicate file will not be shared: %1%%2% (Size: %3% B) Dupe matched against: %4%%5%") + % dir.getFullName() % f.getName() % Util::toString(f.getSize()) % j->second->getParent()->getFullName() % j->second->getName())); dir.files.erase(i); return; } @@ -757,7 +757,7 @@ void ShareManager::refresh(bool dirs /* = false */, bool aUpdate /* = true */, bool block /* = false */) throw() { if(Thread::safeExchange(refreshing, 1) == 1) { - LogManager::getInstance()->message(STRING(FILE_LIST_REFRRESH_IN_PROGRESS)); + LogManager::getInstance()->message(_("File list refresh in progress, please wait for it to finish before trying to refresh again")); return; } @@ -777,7 +777,7 @@ setThreadPriority(Thread::LOW); } } catch(const ThreadException& e) { - LogManager::getInstance()->message(STRING(FILE_LIST_REFRESH_FAILED) + e.getError()); + LogManager::getInstance()->message(str(F_("File list refresh failed: %1%") % e.getError())); } } @@ -799,7 +799,7 @@ { if(refreshDirs) { - LogManager::getInstance()->message(STRING(FILE_LIST_REFRESH_INITIATED)); + LogManager::getInstance()->message(_("File list refresh initiated")); lastFullUpdate = GET_TICK(); @@ -821,7 +821,7 @@ } refreshDirs = false; - LogManager::getInstance()->message(STRING(FILE_LIST_REFRESH_FINISHED)); + LogManager::getInstance()->message(_("File list refresh finished")); } } Modified: dcplusplus/trunk/dcpp/Socket.cpp =================================================================== --- dcplusplus/trunk/dcpp/Socket.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/Socket.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -22,7 +22,6 @@ #include "Socket.h" #include "SettingsManager.h" -#include "ResourceManager.h" #include "TimerManager.h" namespace dcpp { @@ -53,9 +52,7 @@ string msg = Util::translateError(aError); if(msg.empty()) { - char tmp[64]; - snprintf(tmp, sizeof(tmp), CSTRING(UNKNOWN_ERROR), aError); - msg = tmp; + msg = str(F_("Unknown error: 0x%1%") % aError); } return msg; } @@ -155,7 +152,7 @@ } uint64_t now = GET_TICK(); if(start + timeout < now) - throw SocketException(STRING(CONNECTION_TIMEOUT)); + throw SocketException(_("Connection timeout")); return start + timeout - now; } } @@ -163,7 +160,7 @@ void Socket::socksConnect(const string& aAddr, uint16_t aPort, uint32_t timeout) throw(SocketException) { if(SETTING(SOCKS_SERVER).empty() || SETTING(SOCKS_PORT) == 0) { - throw SocketException(STRING(SOCKS_FAILED)); + throw SocketException(_("The socks server failed establish a connection")); } bool oldblock = getBlocking(); @@ -174,7 +171,7 @@ connect(SETTING(SOCKS_SERVER), static_cast<uint16_t>(SETTING(SOCKS_PORT))); if(wait(timeLeft(start, timeout), WAIT_CONNECT) != WAIT_CONNECT) { - throw SocketException(STRING(SOCKS_FAILED)); + throw SocketException(_("The socks server failed establish a connection")); } socksAuth(timeLeft(start, timeout)); @@ -207,11 +204,11 @@ // We assume we'll get a ipv4 address back...therefore, 10 bytes... /// @todo add support for ipv6 if(readAll(&connStr[0], 10, timeLeft(start, timeout)) != 10) { - throw SocketException(STRING(SOCKS_FAILED)); + throw SocketException(_("The socks server failed establish a connection")); } if(connStr[0] != 5 || connStr[1] != 0) { - throw SocketException(STRING(SOCKS_FAILED)); + throw SocketException(_("The socks server failed establish a connection")); } in_addr sock_addr; @@ -238,11 +235,11 @@ writeAll(&connStr[0], 3, timeLeft(start, timeout)); if(readAll(&connStr[0], 2, timeLeft(start, timeout)) != 2) { - throw SocketException(STRING(SOCKS_FAILED)); + throw SocketException(_("The socks server failed establish a connection")); } if(connStr[1] != 0) { - throw SocketException(STRING(SOCKS_NEEDS_AUTH)); + throw SocketException(_("The socks server requires authentication")); } } else { // We try the username and password auth type (no, we don't support gssapi) @@ -253,10 +250,10 @@ writeAll(&connStr[0], 3, timeLeft(start, timeout)); if(readAll(&connStr[0], 2, timeLeft(start, timeout)) != 2) { - throw SocketException(STRING(SOCKS_FAILED)); + throw SocketException(_("The socks server failed establish a connection")); } if(connStr[1] != 2) { - throw SocketException(STRING(SOCKS_AUTH_UNSUPPORTED)); + throw SocketException(_("The socks server doesn't support login / password authentication")); } connStr.clear(); @@ -270,11 +267,11 @@ writeAll(&connStr[0], connStr.size(), timeLeft(start, timeout)); if(readAll(&connStr[0], 2, timeLeft(start, timeout)) != 2) { - throw SocketException(STRING(SOCKS_AUTH_FAILED)); + throw SocketException(_("Socks server authentication failed (bad login / password?)")); } if(connStr[1] != 0) { - throw SocketException(STRING(SOCKS_AUTH_FAILED)); + throw SocketException(_("Socks server authentication failed (bad login / password?)")); } } } @@ -409,7 +406,7 @@ int sent; if(SETTING(OUTGOING_CONNECTIONS) == SettingsManager::OUTGOING_SOCKS5 && proxy) { if(udpServer.empty() || udpPort == 0) { - throw SocketException(STRING(SOCKS_SETUP_ERROR)); + throw SocketException(_("Failed to set up the socks server for UDP relay (check socks address and port)")); } serv_addr.sin_port = htons(udpPort); Modified: dcplusplus/trunk/dcpp/Thread.cpp =================================================================== --- dcplusplus/trunk/dcpp/Thread.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/Thread.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,8 +21,6 @@ #include "Thread.h" -#include "ResourceManager.h" - namespace dcpp { #ifndef _WIN32 @@ -33,7 +31,7 @@ void Thread::start() throw(ThreadException) { join(); if( (threadHandle = CreateThread(NULL, 0, &starter, this, 0, &threadId)) == NULL) { - throw ThreadException(STRING(UNABLE_TO_CREATE_THREAD)); + throw ThreadException(_("Unable to create thread")); } } @@ -41,7 +39,7 @@ void Thread::start() throw(ThreadException) { join(); if(pthread_create(&threadHandle, NULL, &starter, this) != 0) { - throw ThreadException(STRING(UNABLE_TO_CREATE_THREAD)); + throw ThreadException(_("Unable to create thread")); } } #endif Modified: dcplusplus/trunk/dcpp/Transfer.cpp =================================================================== --- dcplusplus/trunk/dcpp/Transfer.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/Transfer.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -22,7 +22,6 @@ #include "Transfer.h" #include "UserConnection.h" -#include "ResourceManager.h" #include "ClientManager.h" namespace dcpp { @@ -61,11 +60,11 @@ params["userI4"] = aSource.getRemoteIp(); StringList hubNames = ClientManager::getInstance()->getHubNames(aSource.getUser()->getCID()); if(hubNames.empty()) - hubNames.push_back(STRING(OFFLINE)); + hubNames.push_back(_("Offline")); params["hub"] = Util::toString(hubNames); StringList hubs = ClientManager::getInstance()->getHubs(aSource.getUser()->getCID()); if(hubs.empty()) - hubs.push_back(STRING(OFFLINE)); + hubs.push_back(_("Offline")); params["hubURL"] = Util::toString(hubs); params["fileSI"] = Util::toString(getSize()); params["fileSIshort"] = Util::formatBytes(getSize()); Modified: dcplusplus/trunk/dcpp/UploadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/UploadManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/UploadManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -27,7 +27,6 @@ #include "ClientManager.h" #include "FilteredFile.h" #include "ZUtils.h" -#include "ResourceManager.h" #include "HashManager.h" #include "AdcCommand.h" #include "FavoriteManager.h" @@ -147,7 +146,7 @@ aSource.fileNotAvail(e.getError()); return false; } catch(const Exception& e) { - LogManager::getInstance()->message(STRING(UNABLE_TO_SEND_FILE) + sourceFile + ": " + e.getError()); + LogManager::getInstance()->message(str(F_("Unable to send file %1%: %2%") % sourceFile % e.getError())); aSource.fileNotAvail(); return false; } @@ -448,7 +447,7 @@ } for(UserList::iterator i = disconnects.begin(); i != disconnects.end(); ++i) { - LogManager::getInstance()->message(STRING(DISCONNECTED_USER) + Util::toString(ClientManager::getInstance()->getNicks((*i)->getCID()))); + LogManager::getInstance()->message(str(F_("Disconnected user leaving the hub: %1%") % Util::toString(ClientManager::getInstance()->getNicks((*i)->getCID())))); ConnectionManager::getInstance()->disconnect(*i, false); } } Modified: dcplusplus/trunk/dcpp/UserConnection.cpp =================================================================== --- dcplusplus/trunk/dcpp/UserConnection.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/UserConnection.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "UserConnection.h" #include "ClientManager.h" -#include "ResourceManager.h" #include "StringTokenizer.h" #include "AdcCommand.h" Modified: dcplusplus/trunk/dcpp/ZUtils.cpp =================================================================== --- dcplusplus/trunk/dcpp/ZUtils.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/ZUtils.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "ZUtils.h" #include "Exception.h" -#include "ResourceManager.h" namespace dcpp { @@ -31,7 +30,7 @@ memset(&zs, 0, sizeof(zs)); if(deflateInit(&zs, 3) != Z_OK) { - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); } } @@ -52,7 +51,7 @@ zs.avail_in = 0; zs.avail_out = outsize; if(deflateParams(&zs, 0, Z_DEFAULT_STRATEGY) != Z_OK) { - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); } zs.avail_in = insize; compressing = false; @@ -74,7 +73,7 @@ if(insize == 0) { int err = ::deflate(&zs, Z_FINISH); if(err != Z_OK && err != Z_STREAM_END) - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); outsize = outsize - zs.avail_out; insize = insize - zs.avail_in; @@ -84,7 +83,7 @@ } else { int err = ::deflate(&zs, Z_NO_FLUSH); if(err != Z_OK) - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); outsize = outsize - zs.avail_out; insize = insize - zs.avail_in; @@ -98,7 +97,7 @@ memset(&zs, 0, sizeof(zs)); if(inflateInit(&zs) != Z_OK) - throw Exception(STRING(DECOMPRESSION_ERROR)); + throw Exception(_("Error during decompression")); } UnZFilter::~UnZFilter() { @@ -121,7 +120,7 @@ // with a dummy byte if at end of stream - since we don't do this it's not a real // error if(!(err == Z_OK || err == Z_STREAM_END || (err == Z_BUF_ERROR && in == NULL))) - throw Exception(STRING(DECOMPRESSION_ERROR)); + throw Exception(_("Error during decompression")); outsize = outsize - zs.avail_out; insize = insize - zs.avail_in; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |