Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150417115040.GC29062@openwall.com>
Date: Fri, 17 Apr 2015 14:50:40 +0300
From: Aleksey Cherepanov <lyosha@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: Improving Johnny

Mathieu,

On Tue, Apr 14, 2015 at 02:40:38PM -0400, Mathieu Laprise wrote:
> First, I reviewed the code to see if the string were marked as
> translatable. Almost all of them were. I found a problematic case in
> MainWindow::showJohnError. There were two functions in #define and their
> strings didn't register as translatable in the .ts file.

I think you talk about

#define C(code, text) case QProcess :: code: message = tr(text); break;
#define P(code) C(code, "Problem with john: " # code);
    switch (error) {
        C(FailedToStart,
          "John failed to start. "
          "Check your Path to John setting. "
          "Check permissions on respective file.");
        C(Crashed, "John crashed.");
        P(Timedout);
        P(WriteError);
        P(ReadError);
        P(UnknownError);
    default:
        message = tr("There is a problem. Johnny could not handle it.");
    }
#undef P
#undef C

C and P are not functions, they are macros. So they are expanded
before compilation and tr() is called for each string. "their strings
didn't register as translatable in the .ts file" - is it your
assumption? Did you try it? Or are they not registered as translatable
in some qt's tool? Please give more details, I'm curious.

Also you've changed the behaviour:

+        message = tr("Problem with john #") + QString::number(error);

So johnny prints error's number while the code with macros showed
error's name. Do you understand why? Please explain.

I'd say it is a regression. Though the piece of code is
overcomplicated and with macros. Macros are a bad style for C++. So
I think the regression is ok as an intermediate step.

Thanks!

-- 
Regards,
Aleksey Cherepanov

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.