diff --git a/deploy/brandelf.c b/deploy/brandelf.c index 530297bbf2..863136f9c8 100644 --- a/deploy/brandelf.c +++ b/deploy/brandelf.c @@ -28,11 +28,7 @@ */ #include -//NOTE: commented out to make it compile on linux -// __FBSDID("$FreeBSD: src/usr.bin/brandelf/brandelf.c,v 1.25.22.2 2012/03/16 03:22:37 eadler Exp $"); - #include -//NOTE: changed path to make it compile on linux #include #include #include @@ -51,7 +47,7 @@ struct ELFtypes { const char *str; int value; }; -/* XXX - any more types? */ + static struct ELFtypes elftypes[] = { { "FreeBSD", ELFOSABI_FREEBSD }, { "Linux", ELFOSABI_LINUX }, @@ -59,10 +55,8 @@ static struct ELFtypes elftypes[] = { { "SVR4", ELFOSABI_SYSV } }; -int -main(int argc, char **argv) +int main(int argc, char **argv) { - const char *strtype = "FreeBSD"; int type = ELFOSABI_FREEBSD; int retval = 0; @@ -86,7 +80,7 @@ main(int argc, char **argv) listed = 1; break; case 'v': - /* does nothing */ + /* do nothing */ break; case 't': if (force) @@ -163,16 +157,14 @@ main(int argc, char **argv) return retval; } -static void -usage(void) +static void usage(void) { (void)fprintf(stderr, "usage: brandelf [-lv] [-f ELF_ABI_number] [-t string] file ...\n"); exit(1); } -static const char * -iselftype(int etype) +static const char * iselftype(int etype) { size_t elfwalk; @@ -184,8 +176,7 @@ iselftype(int etype) return 0; } -static int -elftype(const char *elfstrtype) +static int elftype(const char *elfstrtype) { size_t elfwalk; @@ -197,8 +188,7 @@ elftype(const char *elfstrtype) return -1; } -static void -printelftypes(void) +static void printelftypes(void) { size_t elfwalk; diff --git a/src/bootstrap.js b/src/bootstrap.js index 56b93c201f..ae28a6067e 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -5,6 +5,7 @@ Copyright (C) 2011 James Roe Copyright (C) 2011 execjosh, http://execjosh.blogspot.com Copyright (C) 2012 James M. Greene + Copyright (c) 2018 pixiuPL Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -94,7 +95,6 @@ phantom.defaultErrorHandler = function (message, stack) { }; phantom.onError = phantom.defaultErrorHandler; - phantom.callback = function (callback) { var ret = phantom.createCallback(); ret.called.connect(function (args) { @@ -310,7 +310,6 @@ phantom.callback = function (callback) { } cache[filename] = module; module._load(); - return module.exports; }; diff --git a/src/callback.cpp b/src/callback.cpp index 7baf6ceae3..3969590b5f 100644 --- a/src/callback.cpp +++ b/src/callback.cpp @@ -28,12 +28,13 @@ */ #include - #include "callback.h" Callback::Callback(QObject* parent) : QObject(parent) { + // No action here? + // TODO Implement some type of action } QVariant Callback::call(const QVariantList& arguments) diff --git a/src/callback.h b/src/callback.h index 32521b32fc..a22f2ea177 100644 --- a/src/callback.h +++ b/src/callback.h @@ -35,14 +35,11 @@ class Callback : public QObject { Q_OBJECT - Q_PROPERTY(QVariant returnValue READ returnValue WRITE setReturnValue) public: Callback(QObject* parent); - QVariant call(const QVariantList& arguments); - QVariant returnValue() const; void setReturnValue(const QVariant& returnValue); diff --git a/src/childprocess.cpp b/src/childprocess.cpp index f62537c727..ac221b208f 100644 --- a/src/childprocess.cpp +++ b/src/childprocess.cpp @@ -33,9 +33,7 @@ // ChildProcessContext // -ChildProcessContext::ChildProcessContext(QObject* parent) - : QObject(parent) - , m_proc(this) +ChildProcessContext::ChildProcessContext(QObject* parent) : QObject(parent), m_proc(this) { connect(&m_proc, SIGNAL(readyReadStandardOutput()), this, SLOT(_readyReadStandardOutput())); connect(&m_proc, SIGNAL(readyReadStandardError()), this, SLOT(_readyReadStandardError())); @@ -44,23 +42,17 @@ ChildProcessContext::ChildProcessContext(QObject* parent) } ChildProcessContext::~ChildProcessContext() = default; - -// public: - qint64 ChildProcessContext::pid() const { Q_PID pid = m_proc.pid(); - -#if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE) return pid; -#else +// TODO Investigate... return pid->dwProcessId; #endif } void ChildProcessContext::kill(const QString& signal) { - // TODO: it would be nice to be able to handle more signals if ("SIGKILL" == signal) { m_proc.kill(); } else { @@ -80,8 +72,7 @@ void ChildProcessContext::_setEncoding(const QString& encoding) bool ChildProcessContext::_start(const QString& cmd, const QStringList& args) { m_proc.start(cmd, args); - // TODO: Is there a better way to do this??? - return m_proc.waitForStarted(1000); + return m_proc.waitForStarted(1000); } qint64 ChildProcessContext::_write(const QString &chunk, const QString &encoding) @@ -100,7 +91,6 @@ qint64 ChildProcessContext::_write(const QString &chunk, const QString &encoding } qint64 bytesWritten = m_proc.write(codec->fromUnicode(chunk)); - return bytesWritten; } @@ -126,14 +116,12 @@ void ChildProcessContext::_readyReadStandardError() void ChildProcessContext::_finished(const int exitCode, const QProcess::ExitStatus exitStatus) { Q_UNUSED(exitStatus) - emit exit(exitCode); } void ChildProcessContext::_error(const QProcess::ProcessError error) { Q_UNUSED(error) - emit exit(m_proc.exitCode()); } diff --git a/src/childprocess.h b/src/childprocess.h index 0ab502b67c..29e2e1834e 100644 --- a/src/childprocess.h +++ b/src/childprocess.h @@ -31,11 +31,7 @@ #include #include - -#ifdef Q_OS_WIN #include -#endif - #include "encoding.h" /** @@ -43,8 +39,8 @@ */ class ChildProcessContext : public QObject { - Q_OBJECT - Q_PROPERTY(qint64 pid READ pid) + Q_OBJECT; + Q_PROPERTY(qint64 pid READ pid); public: explicit ChildProcessContext(QObject* parent = Q_NULLPTR); @@ -52,10 +48,8 @@ class ChildProcessContext : public QObject qint64 pid() const; Q_INVOKABLE void kill(const QString& signal = "SIGTERM"); - Q_INVOKABLE void _setEncoding(const QString& encoding); Q_INVOKABLE bool _start(const QString& cmd, const QStringList& args); - Q_INVOKABLE qint64 _write(const QString &chunk, const QString &encoding); Q_INVOKABLE void _close(); diff --git a/src/crashdump.cpp b/src/crashdump.cpp index 73063a5c9b..a33a70ffd0 100644 --- a/src/crashdump.cpp +++ b/src/crashdump.cpp @@ -32,20 +32,13 @@ #include #include #include - #include - -#if defined(Q_OS_WIN) #include -#else #include #include -#endif - #include "crashdump.h" -void -print_crash_message() +void print_crash_message() { fputs("PhantomJS has crashed. Please read the bug reporting guide at\n" " and file a bug report.\n", @@ -53,8 +46,6 @@ print_crash_message() fflush(stderr); } -#if defined(Q_OS_WIN) - static LONG WINAPI unhandled_exception_filter(LPEXCEPTION_POINTERS ptrs) { fprintf(stderr, "Fatal Windows exception, code 0x%08x.\n", @@ -63,13 +54,7 @@ static LONG WINAPI unhandled_exception_filter(LPEXCEPTION_POINTERS ptrs) return EXCEPTION_EXECUTE_HANDLER; } -#if _MSC_VER >= 1400 -static void -invalid_parameter_handler(const wchar_t* expression, - const wchar_t* function, - const wchar_t* file, - unsigned int line, - uintptr_t /*reserved*/) +static void invalid_parameter_handler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t ) { // The parameters all have the value NULL unless a debug version of the CRT library is used // https://msdn.microsoft.com/en-us/library/a9yf33zb(v=VS.80).aspx @@ -135,8 +120,7 @@ init_crash_handler_os() #else // not Windows; Unix assumed -static void -handle_fatal_signal(int signo) +static void handle_fatal_signal(int signo) { // It would be nice to print the offending signal name here, but // strsignal() isn't reliably available. Instead we let the shell do it. @@ -144,8 +128,7 @@ handle_fatal_signal(int signo) raise(signo); } -static void -init_crash_handler_os() +static void init_crash_handler_os() { const char* offender; @@ -196,8 +179,7 @@ init_crash_handler_os() #endif // not Windows -void -init_crash_handler() +void init_crash_handler() { // Qt, QtWebkit, and PhantomJS mostly don't make use of C++ exceptions, // so in the rare cases where an exception does get thrown, it will diff --git a/src/crashdump.h b/src/crashdump.h index a2167c4e8b..b5435871b5 100644 --- a/src/crashdump.h +++ b/src/crashdump.h @@ -28,10 +28,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CRASHDUMP_H #define CRASHDUMP_H extern void print_crash_message(); extern void init_crash_handler(); -#endif // CRASHDUMP_H +