Skip to content

Commit

Permalink
1.x: update gettext, replace autosprintf with boost::format
Browse files Browse the repository at this point in the history
git-svn-id: http://encfs.googlecode.com/svn/branches/1.x@129 db9cf616-1c43-0410-9cb8-a902689de0d6
  • Loading branch information
vgough committed Nov 13, 2013
1 parent 07b35f2 commit 3373886
Show file tree
Hide file tree
Showing 14 changed files with 1,285 additions and 1,176 deletions.
1,956 changes: 1,085 additions & 871 deletions ABOUT-NLS

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2013-11-12 gettextize <[email protected]>

* m4/gettext.m4: Upgrade to gettext-0.18.3.
* m4/iconv.m4: Upgrade to gettext-0.18.3.
* m4/lib-ld.m4: Upgrade to gettext-0.18.3.
* m4/lib-link.m4: Upgrade to gettext-0.18.3.
* m4/lib-prefix.m4: Upgrade to gettext-0.18.3.
* m4/nls.m4: Upgrade to gettext-0.18.3.
* m4/po.m4: Upgrade to gettext-0.18.3.
* m4/progtest.m4: Upgrade to gettext-0.18.3.
* configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.18.3.

Sun Nov 12 2013 Valient Gough <[email protected]>
* fix compiler warnings on OSX 10.9
* allow building with NLS disabled (configure --disable-nls)
Expand Down
4 changes: 1 addition & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ dnl make /usr/local the default for the installation
AC_PREFIX_DEFAULT(/usr/local)

AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.17])
dnl AC_LIB_LINKFLAGS([asprintf]) # use internal copy
LIBINTL=-lgettextlib
AM_GNU_GETTEXT_VERSION([0.18.3])

dnl create only shared libtool-libraries
dnl These can be overridden by command line arguments
Expand Down
113 changes: 58 additions & 55 deletions encfs/FileUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "config.h"

#include "readpassphrase.h"
#include "autosprintf.h"

#include "FileUtils.h"
#include "ConfigReader.h"
Expand Down Expand Up @@ -63,6 +62,7 @@

#include <boost/version.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/format.hpp>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/xml_oarchive.hpp>
#include <boost/serialization/split_free.hpp>
Expand All @@ -75,9 +75,9 @@
using namespace rel;
using namespace rlog;
using namespace std;
using namespace gnu;
namespace fs = boost::filesystem;
namespace serial = boost::serialization;
using boost::format;

static const int DefaultBlockSize = 1024;
// The maximum length of text passwords. If longer are needed,
Expand Down Expand Up @@ -327,7 +327,7 @@ bool userAllowMkdir(int promptno, const char *path, mode_t mode )
// TODO: can we internationalize the y/n names? Seems strange to prompt in
// their own language but then have to respond 'y' or 'n'.
// xgroup(setup)
cerr << autosprintf( _("The directory \"%s\" does not exist. Should it be created? (y,n) "), path );
cerr << format(_("The directory \"%s\" does not exist. Should it be created? (y,n) ")) % path;
char answer[10];
char *res;

Expand Down Expand Up @@ -676,31 +676,30 @@ Cipher::CipherAlgorithm selectCipherAlgorithm()
{
// shown after algorithm name and description.
// xgroup(setup)
cout << autosprintf(_(" -- key length %i bits")
, it->keyLength.min()) << "\n";
cout << format(_(" -- key length %i bits")) % it->keyLength.min() << "\n";
} else
{
cout << autosprintf(
cout << format(
// shown after algorithm name and description.
// xgroup(setup)
_(" -- Supports key lengths of %i to %i bits"),
it->keyLength.min(), it->keyLength.max()) << "\n";
_(" -- Supports key lengths of %i to %i bits")) %
it->keyLength.min() % it->keyLength.max() << "\n";
}

if(it->blockSize.min() == it->blockSize.max())
{
cout << autosprintf(
cout << format(
// shown after algorithm name and description.
// xgroup(setup)
_(" -- block size %i bytes"), it->blockSize.min())
_(" -- block size %i bytes")) % it->blockSize.min()
<< "\n";
} else
{
cout << autosprintf(
cout << format(
// shown after algorithm name and description.
// xgroup(setup)
_(" -- Supports block sizes of %i to %i bytes"),
it->blockSize.min(), it->blockSize.max()) << "\n";
_(" -- Supports block sizes of %i to %i bytes")) %
it->blockSize.min() % it->blockSize.max() << "\n";
}
}

Expand All @@ -724,7 +723,7 @@ Cipher::CipherAlgorithm selectCipherAlgorithm()
Cipher::CipherAlgorithm alg = *it;

// xgroup(setup)
cout << autosprintf(_("Selected algorithm \"%s\""), alg.name.c_str())
cout << format(_("Selected algorithm \"%s\"")) % alg.name
<< "\n\n";

return alg;
Expand Down Expand Up @@ -767,7 +766,7 @@ Interface selectNameCoding()
++it;

// xgroup(setup)
cout << autosprintf(_("Selected algorithm \"%s\""), it->name.c_str())
cout << format(_("Selected algorithm \"%s\"")) % it->name
<< "\"\n\n";

return it->iface;
Expand All @@ -779,17 +778,17 @@ int selectKeySize( const Cipher::CipherAlgorithm &alg )
{
if(alg.keyLength.min() == alg.keyLength.max())
{
cout << autosprintf(_("Using key size of %i bits"),
alg.keyLength.min()) << "\n";
cout << format(_("Using key size of %i bits")) %
alg.keyLength.min() << "\n";
return alg.keyLength.min();
}

cout << autosprintf(
cout << format(
// xgroup(setup)
_("Please select a key size in bits. The cipher you have chosen\n"
"supports sizes from %i to %i bits in increments of %i bits.\n"
"For example: "), alg.keyLength.min(), alg.keyLength.max(),
alg.keyLength.inc()) << "\n";
"For example: ")) % alg.keyLength.min() % alg.keyLength.max() %
alg.keyLength.inc() << "\n";

int numAvail = (alg.keyLength.max() - alg.keyLength.min())
/ alg.keyLength.inc();
Expand Down Expand Up @@ -826,7 +825,7 @@ int selectKeySize( const Cipher::CipherAlgorithm &alg )
keySize = alg.keyLength.closest( keySize );

// xgroup(setup)
cout << autosprintf(_("Using key size of %i bits"), keySize) << "\n\n";
cout << format(_("Using key size of %i bits")) % keySize << "\n\n";

return keySize;
}
Expand All @@ -836,20 +835,20 @@ int selectBlockSize( const Cipher::CipherAlgorithm &alg )
{
if(alg.blockSize.min() == alg.blockSize.max())
{
cout << autosprintf(
cout << format(
// xgroup(setup)
_("Using filesystem block size of %i bytes"),
alg.blockSize.min()) << "\n";
_("Using filesystem block size of %i bytes")) %
alg.blockSize.min() << "\n";
return alg.blockSize.min();
}

cout << autosprintf(
cout << format(
// xgroup(setup)
_("Select a block size in bytes. The cipher you have chosen\n"
"supports sizes from %i to %i bytes in increments of %i.\n"
"Or just hit enter for the default (%i bytes)\n"),
alg.blockSize.min(), alg.blockSize.max(), alg.blockSize.inc(),
DefaultBlockSize);
"Or just hit enter for the default (%i bytes)\n")) %
alg.blockSize.min() % alg.blockSize.max() % alg.blockSize.inc() %
DefaultBlockSize;

// xgroup(setup)
cout << "\n" << _("filesystem block size: ");
Expand All @@ -865,8 +864,8 @@ int selectBlockSize( const Cipher::CipherAlgorithm &alg )
blockSize = alg.blockSize.closest( blockSize );

// xgroup(setup)
cout << autosprintf(_("Using filesystem block size of %i bytes"),
blockSize) << "\n\n";
cout << format(_("Using filesystem block size of %i bytes")) %
blockSize << "\n\n";

return blockSize;
}
Expand Down Expand Up @@ -1267,11 +1266,13 @@ void showFSInfo( const boost::shared_ptr<EncFSConfig> &config )
{
shared_ptr<Cipher> cipher = Cipher::New( config->cipherIface, -1 );
{
cout << autosprintf(
cout << format(
// xgroup(diag)
_("Filesystem cipher: \"%s\", version %i:%i:%i"),
config->cipherIface.name().c_str(), config->cipherIface.current(),
config->cipherIface.revision(), config->cipherIface.age());
_("Filesystem cipher: \"%s\", version %i:%i:%i")) %
config->cipherIface.name().c_str() %
config->cipherIface.current() %
config->cipherIface.revision() %
config->cipherIface.age();
// check if we support this interface..
if(!cipher)
cout << _(" (NOT supported)\n");
Expand All @@ -1282,17 +1283,19 @@ void showFSInfo( const boost::shared_ptr<EncFSConfig> &config )
{
Interface iface = cipher->interface();
// xgroup(diag)
cout << autosprintf(_(" (using %i:%i:%i)\n"),
iface.current(), iface.revision(), iface.age());
cout << format(_(" (using %i:%i:%i)\n")) %
iface.current() % iface.revision() % iface.age();
} else
cout << "\n";
}
}
{
// xgroup(diag)
cout << autosprintf(_("Filename encoding: \"%s\", version %i:%i:%i"),
config->nameIface.name().c_str(), config->nameIface.current(),
config->nameIface.revision(), config->nameIface.age());
cout << format(_("Filename encoding: \"%s\", version %i:%i:%i")) %
config->nameIface.name().c_str() %
config->nameIface.current() %
config->nameIface.revision() %
config->nameIface.age();

// check if we support the filename encoding interface..
shared_ptr<NameIO> nameCoder = NameIO::New( config->nameIface,
Expand All @@ -1307,14 +1310,14 @@ void showFSInfo( const boost::shared_ptr<EncFSConfig> &config )
if( config->nameIface != nameCoder->interface() )
{
Interface iface = nameCoder->interface();
cout << autosprintf(_(" (using %i:%i:%i)\n"),
iface.current(), iface.revision(), iface.age());
cout << format(_(" (using %i:%i:%i)\n")) %
iface.current() % iface.revision() % iface.age();
} else
cout << "\n";
}
}
{
cout << autosprintf(_("Key Size: %i bits"), config->keySize);
cout << format(_("Key Size: %i bits")) % config->keySize;
cipher = config->getCipher();
if(!cipher)
{
Expand All @@ -1325,33 +1328,33 @@ void showFSInfo( const boost::shared_ptr<EncFSConfig> &config )
}
if(config->kdfIterations > 0 && config->salt.size() > 0)
{
cout << autosprintf(_("Using PBKDF2, with %i iterations"),
config->kdfIterations) << "\n";
cout << autosprintf(_("Salt Size: %i bits"),
8*(int)config->salt.size()) << "\n";
cout << format(_("Using PBKDF2, with %i iterations")) %
config->kdfIterations << "\n";
cout << format(_("Salt Size: %i bits")) %
(8*config->salt.size()) << "\n";
}
if(config->blockMACBytes || config->blockMACRandBytes)
{
if(config->subVersion < 20040813)
{
cout << autosprintf(
cout << format(
// xgroup(diag)
_("Block Size: %i bytes + %i byte MAC header"),
config->blockSize,
config->blockMACBytes + config->blockMACRandBytes) << endl;
_("Block Size: %i bytes + %i byte MAC header")) %
config->blockSize %
(config->blockMACBytes + config->blockMACRandBytes) << endl;
} else
{
// new version stores the header as part of that block size..
cout << autosprintf(
cout << format(
// xgroup(diag)
_("Block Size: %i bytes, including %i byte MAC header"),
config->blockSize,
config->blockMACBytes + config->blockMACRandBytes) << endl;
_("Block Size: %i bytes, including %i byte MAC header")) %
config->blockSize %
(config->blockMACBytes + config->blockMACRandBytes) << endl;
}
} else
{
// xgroup(diag)
cout << autosprintf(_("Block Size: %i bytes"), config->blockSize);
cout << format(_("Block Size: %i bytes")) % config->blockSize;
cout << "\n";
}

Expand Down
2 changes: 1 addition & 1 deletion encfs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ libencfs_la_LIBADD = @RLOG_LIBS@ \
@OPENSSL_LIBS@ \
@BOOST_SERIALIZATION_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_SYSTEM_LIB@

EXTRASRC = ../intl/autosprintf.cpp
EXTRASRC =
if BUILD_OPENSSL
if BUILD_SSLCIPHER
EXTRASRC += SSL_Cipher.cpp
Expand Down
Loading

0 comments on commit 3373886

Please sign in to comment.