[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11699: Part of a patch from Albert
From: |
Rob Savoye |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11699: Part of a patch from Albert Lee <trisk at forkgnu.org>: |
Date: |
Tue, 15 Dec 2009 17:09:04 -0700 |
User-agent: |
Bazaar (2.0.2) |
------------------------------------------------------------
revno: 11699
committer: Rob Savoye <address@hidden>
branch nick: trunk
timestamp: Tue 2009-12-15 17:09:04 -0700
message:
Part of a patch from Albert Lee <trisk at forkgnu.org>:
- Clean up configure tests and check if isfinite is allowed by the C++
compiler
- Use <clocale> instead of <locale> for LC_ALL and std::setlocale
- Remove duplicates from GNASHRC list
- Remove most OS-specific content in prcpucfg-glibc.h
- Improve architecture and compiler support in prcpucfg-glibc.h
- Use std:: prefixes consistently
- Use putenv (SUSv2) instead of setenv to modify GNASHRC
- Prepend rather than append new GNASHRC entries
- Use gnash::StringNoCaseEqual instead of strcasecmp
- Fix quotes in agg autoconf macro
- Prevent pthreads check from mangling CXXFLAGS
modified:
backend/Renderer_ogl.cpp
configure.ac
gui/gnash.cpp
libbase/rc.cpp
macros/agg.m4
macros/pthreads.m4
plugin/mozilla-sdk/include/prcpucfg-glibc.h
plugin/plugin.cpp
utilities/dumpshm.cpp
utilities/flvdumper.cpp
utilities/soldumper.cpp
=== modified file 'backend/Renderer_ogl.cpp'
--- a/backend/Renderer_ogl.cpp 2009-10-06 07:45:26 +0000
+++ b/backend/Renderer_ogl.cpp 2009-12-16 00:09:04 +0000
@@ -789,8 +789,8 @@
gluOrtho2D(x0, x1, y0, y1);
- _width = fabsf(x1 - x0);
- _height = fabsf(y1 - y0);
+ _width = std::fabs(x1 - x0);
+ _height = std::fabs(y1 - y0);
glScalef(static_cast<float>(twipsToPixels(_width)) /
static_cast<float>(viewport_width),
@@ -1309,9 +1309,9 @@
LOG_ONCE( log_unimpl(_("Unidirectionally scaled strokes in OGL
renderer")) );
}
- float stroke_scale = fabsf(mat.get_x_scale()) + fabsf(mat.get_y_scale());
+ float stroke_scale = std::fabs(mat.get_x_scale()) +
std::fabs(mat.get_y_scale());
stroke_scale /= 2.0f;
- stroke_scale *= (fabsf(_xscale) + fabsf(_yscale)) / 2.0f;
+ stroke_scale *= (std::fabs(_xscale) + std::fabs(_yscale)) / 2.0f;
width *= stroke_scale;
width = twipsToPixels(width);
=== modified file 'configure.ac'
--- a/configure.ac 2009-11-25 11:20:17 +0000
+++ b/configure.ac 2009-12-16 00:09:04 +0000
@@ -1475,6 +1475,7 @@
AC_CHECK_HEADERS(signal.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(sys/time.h)
+AC_CHECK_HEADERS(ieeefp.h)
dnl libcurl3-dev on Ubuntu has a dependency on lber, and Gnash won't link
dnl on most machines without it. While it isn't diretly used by Gnash at all,
dnl it's to work around an Ubuntu packaging bug.
@@ -1559,30 +1560,36 @@
dnl AC_CHECK_FUNCS(strcasecmp stricmp)
dnl AC_CHECK_FUNCS(vsnprintf)
-dnl These two tests need the math library or they won't link
-dnl on OpenBSD, even if the functions exist.
-save_LIBS=$LIBS
-LIBS="$LIBS -lm"
AC_CACHE_CHECK([for finite], ac_cv_finite,
- [AC_TRY_LINK([#include <math.h>],
+ [AC_TRY_COMPILE([
+ #include <math.h>
+ #ifdef HAVE_IEEEFP_H
+ #include <ieeefp.h>
+ #endif],
[double x; int y; y = finite(x);],
ac_cv_finite=yes,
ac_cv_finite=no
)])
if test x"$ac_cv_finite" = x"yes"; then
- AC_DEFINE(HAVE_FINITE, [1], [Has finite])
+ AC_SEARCH_LIBS(finite, m,
+ [AC_DEFINE(HAVE_FINITE, [1], [Has finite])]
+ )
fi
+AC_LANG_PUSH(C++)
AC_CACHE_CHECK([for isfinite], ac_cv_isfinite,
- [AC_TRY_LINK([#include <math.h>],
- [double x; int y; y = isfinite(x);],
+ [AC_TRY_COMPILE([#include <cmath>],
+ [using namespace std; double x; int y; y = isfinite(x);],
ac_cv_isfinite=yes,
ac_cv_isfinite=no
)])
+AC_LANG_POP(C++)
if test x"$ac_cv_isfinite" = x"yes"; then
+ dnl Don't give up if isfinite is not found in -lm
+ dnl isfinite is defined as a macro in C99.
+ AC_SEARCH_LIBS(isfinite, m)
AC_DEFINE(HAVE_ISFINITE, [1], [Has isfinite])
fi
-LIBS=$save_LIBS
AC_LANG_PUSH(C++)
AC_CACHE_CHECK([whether $CXX implements __PRETTY_FUNCTION__],
ac_cv_implements___PRETTY_FUNCTION__, [
=== modified file 'gui/gnash.cpp'
--- a/gui/gnash.cpp 2009-11-16 12:57:54 +0000
+++ b/gui/gnash.cpp 2009-12-16 00:09:04 +0000
@@ -51,7 +51,7 @@
#include <ios>
#ifdef ENABLE_NLS
-# include <clocale>
+# include <locale>
#endif
#ifdef GUI_ALP
=== modified file 'libbase/rc.cpp'
--- a/libbase/rc.cpp 2009-07-21 17:43:34 +0000
+++ b/libbase/rc.cpp 2009-12-16 00:09:04 +0000
@@ -37,7 +37,7 @@
#include <limits>
#include <cstdlib> // getenv
#include <string>
-#include <vector>
+#include <list>
#include <iostream>
#include <fstream>
#include <sstream>
@@ -164,18 +164,23 @@
}
// Check the GNASHRC environment variable
- // TODO: keep note of the already-parsed files
- // to avoid parsign multiple times ?
- // (would mess up user-reguested order)
+ // Parse each file only once
char *gnashrc = std::getenv("GNASHRC");
if (gnashrc)
{
std::string paths(gnashrc);
-
Tok t(paths, Sep(":"));
+ std::list<std::string> l;
+
for (Tok::iterator i = t.begin(), e = t.end(); i != e; ++i)
{
+ l.remove(*i);
+ l.push_back(*i);
+ }
+
+ for (std::list<std::string>::const_iterator i = l.begin(), e =
l.end(); i != e; ++i)
+ {
parseFile(*i);
}
}
=== modified file 'macros/agg.m4'
--- a/macros/agg.m4 2009-02-25 22:33:03 +0000
+++ b/macros/agg.m4 2009-12-16 00:09:04 +0000
@@ -42,7 +42,7 @@
$PKG_CONFIG --atleast-version 2.5.0 libagg && agg25=yes
dnl I think this setting of agg_include_dir is too error prone!
- agg_include_dir="`$PKG_CONFIG --cflags-only-I libagg | cut -d " " -f 1
| sed -e 's/-I//g'`"
+ agg_include_dir="`$PKG_CONFIG --cflags-only-I libagg | cut -d ' ' -f 1
| sed -e 's/-I//g'`"
if test -f $agg_include_dir/agg_gradient_lut.h ; then
agg25=yes
fi
=== modified file 'macros/pthreads.m4'
--- a/macros/pthreads.m4 2009-04-21 00:17:56 +0000
+++ b/macros/pthreads.m4 2009-12-16 00:09:04 +0000
@@ -118,7 +118,6 @@
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
- CXXFLAGS="$CXXFLAGS $flag"
PTHREAD_LIBS=""
;;
@@ -149,8 +148,10 @@
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
+ save_CXXFLAGS="$CXXFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
dnl Check for various functions. We must include pthread.h,
dnl since some functions may be macros. (On the Sequent, we
@@ -169,6 +170,7 @@
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
+ CXXFLAGS="$save_CXXFLAGS"
AC_MSG_RESULT($pthreads)
if test "x$pthreads" = xyes; then
=== modified file 'plugin/mozilla-sdk/include/prcpucfg-glibc.h'
--- a/plugin/mozilla-sdk/include/prcpucfg-glibc.h 2009-02-25 22:33:03
+0000
+++ b/plugin/mozilla-sdk/include/prcpucfg-glibc.h 2009-12-16 00:09:04
+0000
@@ -19,6 +19,7 @@
/*
* This file is used by not only Linux but also other glibc systems
* such as GNU/Hurd and GNU/k*BSD.
+ * Gnash now uses it for all other Unix-like platforms as well.
*/
#ifndef nspr_cpucfg___
@@ -28,7 +29,17 @@
#define LINUX
#endif
-#define PR_AF_INET6 10 /* same as AF_INET6 */
+#if defined(__sgi) || defined(sgi) || defined(__sgi__)
+
+#ifndef IRIX
+ #define IRIX
+#endif
+
+#ifndef _SGI_MP_SOURCE
+ #define _SGI_MP_SOURCE
+#endif
+
+#endif
#if defined(__powerpc64__)
@@ -213,7 +224,7 @@
#define PR_BYTES_PER_WORD_LOG2 3
#define PR_BYTES_PER_DWORD_LOG2 3
-#elif defined(__x86_64__)
+#elif defined(__x86_64__) || defined(__x86_64) || defined(__amd64__)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
@@ -304,11 +315,59 @@
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
-#elif defined(__sparc__)
+#elif defined(__sparc__) || defined(sparc)
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
+#if defined(__sparcv9) || defined(__arch64__)
+#define IS_64
+#endif
+
+#ifdef IS_64
+
+#define PR_BYTES_PER_BYTE 1
+#define PR_BYTES_PER_SHORT 2
+#define PR_BYTES_PER_INT 4
+#define PR_BYTES_PER_INT64 8
+#define PR_BYTES_PER_LONG 8
+#define PR_BYTES_PER_FLOAT 4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD 8
+#define PR_BYTES_PER_DWORD 8
+
+#define PR_BITS_PER_BYTE 8
+#define PR_BITS_PER_SHORT 16
+#define PR_BITS_PER_INT 32
+#define PR_BITS_PER_INT64 64
+#define PR_BITS_PER_LONG 64
+#define PR_BITS_PER_FLOAT 32
+#define PR_BITS_PER_DOUBLE 64
+#define PR_BITS_PER_WORD 64
+
+#define PR_BITS_PER_BYTE_LOG2 3
+#define PR_BITS_PER_SHORT_LOG2 4
+#define PR_BITS_PER_INT_LOG2 5
+#define PR_BITS_PER_INT64_LOG2 6
+#define PR_BITS_PER_LONG_LOG2 6
+#define PR_BITS_PER_FLOAT_LOG2 5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2 6
+
+#define PR_ALIGN_OF_SHORT 2
+#define PR_ALIGN_OF_INT 4
+#define PR_ALIGN_OF_LONG 8
+#define PR_ALIGN_OF_INT64 8
+#define PR_ALIGN_OF_FLOAT 4
+#define PR_ALIGN_OF_DOUBLE 8
+#define PR_ALIGN_OF_POINTER 8
+#define PR_ALIGN_OF_WORD 8
+
+#define PR_BYTES_PER_WORD_LOG2 3
+#define PR_BYTES_PER_DWORD_LOG2 3
+
+#else /* IS_64 */
+
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
@@ -349,7 +408,9 @@
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
-#elif defined(__i386__)
+#endif /* IS_64 */
+
+#elif defined(__i386__) || defined(i386)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
@@ -394,75 +455,12 @@
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
-#elif defined(__sgi) || defined(sgi) || defined(__sgi__)
-
-#ifndef IRIX
- #define IRIX
-#endif
-
-#ifndef _SGI_MP_SOURCE
- #define _SGI_MP_SOURCE
-#endif
-
-#undef IS_LITTLE_ENDIAN
-#define IS_BIG_ENDIAN 1
-
-#undef PR_AF_INET6
-#define PR_AF_INET6 24 /* same as AF_INET6 */
-
-#define PR_BYTES_PER_BYTE 1
-#define PR_BYTES_PER_SHORT 2
-#define PR_BYTES_PER_INT 4
-#define PR_BYTES_PER_INT64 8
-#define PR_BYTES_PER_LONG 4
-#define PR_BYTES_PER_FLOAT 4
-#define PR_BYTES_PER_DOUBLE 8
-#define PR_BYTES_PER_WORD 4
-#define PR_BYTES_PER_DWORD 8
-
-#define PR_BITS_PER_BYTE 8
-#define PR_BITS_PER_SHORT 16
-#define PR_BITS_PER_INT 32
-#define PR_BITS_PER_INT64 64
-#define PR_BITS_PER_LONG 32
-#define PR_BITS_PER_FLOAT 32
-#define PR_BITS_PER_DOUBLE 64
-#define PR_BITS_PER_WORD 32
-
-#define PR_BITS_PER_BYTE_LOG2 3
-#define PR_BITS_PER_SHORT_LOG2 4
-#define PR_BITS_PER_INT_LOG2 5
-#define PR_BITS_PER_INT64_LOG2 6
-#define PR_BITS_PER_LONG_LOG2 5
-#define PR_BITS_PER_FLOAT_LOG2 5
-#define PR_BITS_PER_DOUBLE_LOG2 6
-#define PR_BITS_PER_WORD_LOG2 5
-
-#define PR_BYTES_PER_WORD_LOG2 2
-#define PR_BYTES_PER_DWORD_LOG2 3
-
-#define PR_ALIGN_OF_SHORT 2
-#define PR_ALIGN_OF_INT 4
-#define PR_ALIGN_OF_LONG 4
-#define PR_ALIGN_OF_INT64 8
-#define PR_ALIGN_OF_FLOAT 4
-#define PR_ALIGN_OF_DOUBLE 8
-#define PR_ALIGN_OF_POINTER 4
-#define PR_ALIGN_OF_WORD 4
-
-#define HAVE_LONG_LONG
-#define HAVE_ALIGNED_DOUBLES
-#define HAVE_ALIGNED_LONGLONGS
-
-#define _PR_POLL_BACKCOMPAT
-
-
-#elif defined(__mips__)
-
-#ifdef __MIPSEB__
-#define IS_BIG_ENDIAN 1
-#undef IS_LITTLE_ENDIAN
-#elif defined(__MIPSEL__)
+#elif defined(__mips__) || defined(__mips)
+
+#if defined(__MIPSEB__) || defined(__MIPSEB)
+#define IS_BIG_ENDIAN 1
+#undef IS_LITTLE_ENDIAN
+#elif defined(__MIPSEL__) || defined(__MIPSEL)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#else
@@ -699,9 +697,13 @@
#define HAVE_LONG_LONG
#if PR_ALIGN_OF_DOUBLE == 8
#define HAVE_ALIGNED_DOUBLES
+#else
+#undef HAVE_ALIGNED_DOUBLES
#endif
#if PR_ALIGN_OF_INT64 == 8
#define HAVE_ALIGNED_LONGLONGS
+#else
+#undef HAVE_ALIGNED_LONGLONGS
#endif
#ifndef NO_NSPR_10_SUPPORT
=== modified file 'plugin/plugin.cpp'
--- a/plugin/plugin.cpp 2009-09-07 09:57:20 +0000
+++ b/plugin/plugin.cpp 2009-12-16 00:09:04 +0000
@@ -21,6 +21,7 @@
#endif
#include <cstdlib> // getenv
+#include <stdlib.h> // putenv
#define MIME_TYPES_HANDLED "application/x-shockwave-flash"
// The name must be this value to get flash movies that check the
@@ -60,6 +61,7 @@
#include "plugin.h"
#include <csignal>
#include "GnashSystemIOHeaders.h"
+#include "StringPredicates.h"
#include <cstdio>
#include <cstddef>
#include <cstring>
@@ -68,6 +70,7 @@
#include <sys/wait.h>
#include <fcntl.h>
#include <cerrno>
+#include <climits>
#include <string>
#include <vector>
#include <iostream>
@@ -97,6 +100,10 @@
# include <nsStringAPI.h>
#endif // HAVE_XPCOM
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
extern NPNetscapeFuncs NPNFuncs;
NPBool plugInitialized = FALSE;
@@ -145,8 +152,7 @@
NPError
NS_PluginInitialize()
{
- if ( plugInitialized )
- {
+ if ( plugInitialized ) {
#if GNASH_PLUGIN_DEBUG > 1
std::cout << "NS_PluginInitialize called, but ignored (we already
initialized)" << std::endl;
#endif
@@ -204,16 +210,13 @@
(void *)&supportsXEmbed);
- if (err != NPERR_NO_ERROR || !supportsXEmbed)
- {
+ if (err != NPERR_NO_ERROR || !supportsXEmbed) {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "NPAPI ERROR: No xEmbed support in this browser!"
- << std::endl;
+ << std::endl;
#endif
return NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
- else
- {
+ } else {
#if GNASH_PLUGIN_DEBUG > 1
std::cout << "xEmbed supported in this browser" << std::endl;
#endif
@@ -229,17 +232,14 @@
GTK2 support is currently also necessary. Fail if not
present.
*/
- if (err != NPERR_NO_ERROR || toolkit != NPNVGtk2)
- {
+ if (err != NPERR_NO_ERROR || toolkit != NPNVGtk2) {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "NPAPI ERROR: No GTK2 support in this browser!"
" Have version " << (int)toolkit << std::endl;
#endif
return NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
- else
- {
+ } else {
#if GNASH_PLUGIN_DEBUG > 1
std::cout << "GTK2 supported in this browser" << std::endl;
#endif
@@ -250,66 +250,58 @@
Check for environment variables.
*/
char* opts = std::getenv("GNASH_OPTIONS");
- if (opts != NULL)
- {
+ if (opts != NULL) {
#if GNASH_PLUGIN_DEBUG > 1
std::cout << "GNASH_OPTIONS : " << opts << std::endl;
#endif
// Should the plugin wait for gdb to be attached?
- if ( strstr(opts, "waitforgdb") )
- {
+ if ( strstr(opts, "waitforgdb") ) {
waitforgdb = true;
}
// Should the plugin write a script to invoke
// the standalone player for debugging ?
- if ( strstr(opts, "writelauncher") )
- {
+ if ( strstr(opts, "writelauncher") ) {
createSaLauncher = true;
}
}
// Append SYSCONFDIR/gnashpluginrc and ~/.gnashpluginrc to GNASHRC
- do {
- // TODO: extract content in a set, add to set
- // and serialize back (to avoid duplicates)
-
- std::string newGnashRc;
- char *gnashrc = std::getenv("GNASHRC");
- if ( gnashrc )
- {
- newGnashRc.assign(gnashrc);
- newGnashRc.append(":");
- }
-
- newGnashRc.append(SYSCONFDIR);
- newGnashRc.append("/gnashpluginrc");
-
- char *home = std::getenv("HOME");
- if ( home )
- {
- newGnashRc.append(":");
- newGnashRc.append(home);
- newGnashRc.append("/.gnashpluginrc");
- }
- else
- {
- std::cout << "WARNING: NPAPI plugin could not find user home dir"
<< std::endl;
- }
-
- if ( setenv("GNASHRC", newGnashRc.c_str(), 1) )
- {
- std::cout << "WARNING: NPAPI plugin could not append to the
GNASHRC env variable" << std::endl;
- }
+
+ std::string newGnashRc("GNASHRC=");
+
+ newGnashRc.append(SYSCONFDIR);
+ newGnashRc.append("/gnashpluginrc");
+
+ char *home = std::getenv("HOME");
+ if ( home ) {
+ newGnashRc.append(":");
+ newGnashRc.append(home);
+ newGnashRc.append("/.gnashpluginrc");
+ } else {
+ std::cout << "WARNING: NPAPI plugin could not find user home dir" <<
std::endl;
+ }
+
+ char *gnashrc = std::getenv("GNASHRC");
+ if ( gnashrc ) {
+ newGnashRc.append(":");
+ newGnashRc.append(gnashrc);
+ }
+
+ // putenv doesn't copy the string in standards-conforming implementations
+ gnashrc = new char[PATH_MAX];
+ std::strncpy(gnashrc, newGnashRc.c_str(), PATH_MAX);
+ gnashrc[PATH_MAX-1] = '\0';
+
+ if ( putenv(gnashrc) ) {
+ std::cout << "WARNING: NPAPI plugin could not append to the GNASHRC
env variable" << std::endl;
+ }
#if GNASH_PLUGIN_DEBUG > 1
- else std::cout << "NOTE: NPAPI plugin set GNASHRC to " << newGnashRc
<< std::endl;
+ else std::cout << "NOTE: NPAPI plugin set GNASHRC to " << newGnashRc <<
std::endl;
#endif
- } while (0);
-
-
/* Success */
plugInitialized = TRUE;
@@ -327,8 +319,7 @@
NS_PluginShutdown()
{
#if 0
- if (!plugInitialized)
- {
+ if (!plugInitialized) {
#if GNASH_PLUGIN_DEBUG > 1
std::cout << "Plugin already shut down" << std::endl;
#endif
@@ -351,8 +342,7 @@
{
NPError err = NPERR_NO_ERROR;
- switch (aVariable)
- {
+ switch (aVariable) {
case NPPVpluginNameString:
*static_cast<const char **> (aValue) = PLUGIN_NAME;
break;
@@ -429,19 +419,17 @@
for (size_t i=0, n=data->argc; i<n; ++i)
{
std::string name, val;
+ gnash::StringNoCaseEqual noCaseCompare;
- if (data->argn[i])
- {
+ if (data->argn[i]) {
name = data->argn[i];
}
- if (data->argv[i])
- {
+ if (data->argv[i]) {
val = data->argv[i];
}
- if ( ! strcasecmp(name.c_str(), "name") )
- {
+ if (noCaseCompare(name, "name")) {
_name = val;
}
@@ -456,8 +444,7 @@
#if GNASH_PLUGIN_DEBUG > 1
std::cout << "plugin instance destruction" << std::endl;
#endif
- if (_ichan)
- {
+ if (_ichan) {
#if GNASH_PLUGIN_DEBUG > 1
std::cout << "shutting down input chan " << _ichan << std::endl;
#endif
@@ -467,8 +454,7 @@
_ichan = 0;
}
- if ( _ichanWatchId )
- {
+ if ( _ichanWatchId ) {
g_source_remove(_ichanWatchId);
_ichanWatchId = 0;
}
@@ -490,16 +476,13 @@
NPBool
nsPluginInstance::init(NPWindow* aWindow)
{
- if(!aWindow)
- {
+ if(!aWindow) {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << __PRETTY_FUNCTION__ << " ERROR: Window handle was bogus!"
<< std::endl;
#endif
return FALSE;
- }
- else
- {
+ } else {
#if GNASH_PLUGIN_DEBUG > 1
std::cout << "X origin: = " << aWindow->x
<< ", Y Origin = " << aWindow->y
@@ -525,8 +508,7 @@
std::cout << "Gnash plugin shutting down" << std::endl;
#endif
- if (_childpid > 0)
- {
+ if (_childpid > 0) {
// it seems that waiting after a SIGINT hangs firefox
// IFF not run from the console (see bug#17082).
// SIGTERM instead solves this problem
@@ -551,17 +533,14 @@
NPError
nsPluginInstance::SetWindow(NPWindow* aWindow)
{
- if(!aWindow)
- {
+ if(!aWindow) {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << __FUNCTION__ << ": ERROR: Window handle was bogus!"
<< std::endl;
#endif
return NPERR_INVALID_PARAM;
#if 0
- }
- else
- {
+ } else {
log_debug("%s: X origin = %d, Y Origin = %d, Width = %d,"
" Height = %d, WindowID = %p, this = %p",
__FUNCTION__,
@@ -646,8 +625,7 @@
O_CREAT | O_WRONLY,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
- if (_filefd < 0)
- {
+ if (_filefd < 0) {
_filefd = open(fname.c_str(),
O_TRUNC | O_WRONLY,
S_IRUSR | S_IRGRP | S_IROTH);
@@ -664,27 +642,19 @@
nsPluginInstance::DestroyStream(NPStream* /*stream*/, NPError /*reason*/)
{
- if (_streamfd != -1)
- {
- if (close(_streamfd) == -1)
- {
+ if (_streamfd != -1) {
+ if (close(_streamfd) == -1) {
perror("closing _streamfd");
- }
- else
- {
+ } else {
_streamfd = -1;
}
}
#ifdef WRITE_FILE
- if (_filefd != -1)
- {
- if (close(_filefd) == -1)
- {
+ if (_filefd != -1) {
+ if (close(_filefd) == -1) {
perror("closing _filefd");
- }
- else
- {
+ } else {
_filefd = -1;
}
}
@@ -700,8 +670,11 @@
#if GNASH_PLUGIN_DEBUG > 1
//std::cout << "Stream for " << stream->url << " is ready" << std::endl;
#endif
- if ( _streamfd != -1 ) return 1024;
- else return 0;
+ if ( _streamfd != -1 ) {
+ return 1024;
+ } else {
+ return 0;
+ }
}
/// \brief Read the data stream from Mozilla/Firefox
@@ -728,8 +701,7 @@
bool
nsPluginInstance::handlePlayerRequests(GIOChannel* iochan, GIOCondition cond)
{
- if ( cond & G_IO_HUP )
- {
+ if ( cond & G_IO_HUP ) {
#if GNASH_PLUGIN_DEBUG > 1
std::cout << "Player request channel hang up" << std::endl;
#endif
@@ -744,16 +716,14 @@
std::cout << "Checking player requests on fd " << inputfd << std::endl;
#endif
- do
- {
+ do {
GError* error=NULL;
gchar* request;
gsize requestSize=0;
GIOStatus status = g_io_channel_read_line(iochan, &request,
&requestSize, NULL, &error);
- switch ( status )
- {
+ switch ( status ) {
case G_IO_STATUS_ERROR:
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "Error reading request line: " << error->message
@@ -800,16 +770,14 @@
bool
nsPluginInstance::processPlayerRequest(gchar* buf, gsize linelen)
{
- if ( linelen < 4 )
- {
+ if ( linelen < 4 ) {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "Invalid player request (too short): " << buf <<
std::endl;
#endif
return false;
}
- if ( ! strncmp(buf, "GET ", 4) )
- {
+ if ( ! std::strncmp(buf, "GET ", 4) ) {
char* target = buf + 4;
if ( ! *target )
{
@@ -820,13 +788,10 @@
}
char* url = target;
while (*url && *url != ':') ++url;
- if ( *url )
- {
+ if ( *url ) {
*url='\0';
++url;
- }
- else
- {
+ } else {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "No colon found after GETURL target string"
<< std::endl;
@@ -841,9 +806,7 @@
NPN_GetURL(_instance, url, target);
return true;
- }
- else if ( ! strncmp(buf, "INVOKE ", 7) )
- {
+ } else if ( ! std::strncmp(buf, "INVOKE ", 7) ) {
char* command = buf + 7;
if ( ! *command ) {
#ifdef GNASH_PLUGIN_DEBUG
@@ -877,16 +840,13 @@
#endif
NPN_GetURL(_instance, jsurl.str().c_str(), tgt);
return true;
- }
- else if ( ! strncmp(buf, "POST ", 5))
- {
+ } else if ( ! strncmp(buf, "POST ", 5)) {
char* target = buf + 5;
if (! *target) return false;
char* postdata = target;
while (*postdata && *postdata != ':') ++postdata;
- if ( *postdata )
- {
+ if ( *postdata ) {
*postdata='\0';
++postdata;
}
@@ -901,13 +861,10 @@
char* url = postdata;
while (*url && *url != '$') ++url;
- if (*url)
- {
+ if (*url) {
*url='\0';
++url;
- }
- else
- {
+ } else {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "No $ character found after getURL target string"
<< std::endl;
@@ -920,9 +877,7 @@
postdata, false);
return true;
- }
- else
- {
+ } else {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "Unknown player request: '" << buf << "'" << std::endl;
#endif
@@ -1162,9 +1117,7 @@
if (gnash_env == NULL) {
procname = GNASHBINDIR;
procname += "/gtk-gnash";
- }
- else
- {
+ } else {
procname = gnash_env;
}
@@ -1179,8 +1132,7 @@
struct stat procstats;
// See if the file actually exists, otherwise we can't spawn it
- if (stat(procname.c_str(), &procstats) == -1)
- {
+ if (stat(procname.c_str(), &procstats) == -1) {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "Invalid path to standalone executable: " <<
procname << std::endl;
@@ -1195,8 +1147,7 @@
int c2p_pipe[2];
int ret = pipe(p2c_pipe);
- if (ret == -1)
- {
+ if (ret == -1) {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "ERROR: parent to child pipe() failed: " <<
std::strerror(errno) << std::endl;
@@ -1205,8 +1156,7 @@
_streamfd = p2c_pipe[1];
ret = pipe(c2p_pipe);
- if (ret == -1)
- {
+ if (ret == -1) {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "ERROR: child to parent pipe() failed: " <<
std::strerror(errno) << std::endl;
@@ -1255,8 +1205,7 @@
#ifdef CREATE_STANDALONE_GNASH_LAUNCHER
std::ofstream saLauncher;
- if ( createSaLauncher )
- {
+ if ( createSaLauncher ) {
std::stringstream ss;
static int debugno = 0;
debugno = (debugno + 1) % 10;
@@ -1332,8 +1281,7 @@
assert(argc <= maxargc);
#ifdef CREATE_STANDALONE_GNASH_LAUNCHER
- if ( saLauncher )
- {
+ if ( saLauncher ) {
// allow caller to pass any additional argument
saLauncher << "$@"
<< std::endl;
@@ -1348,8 +1296,7 @@
_childpid = fork();
// If the fork failed, childpid is -1. So print out an error message.
- if (_childpid == -1)
- {
+ if (_childpid == -1) {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "ERROR: dup2() failed: " << strerror(errno) << std::endl;
#endif
@@ -1357,14 +1304,12 @@
}
// If we are the parent and fork() worked, childpid is a positive integer.
- if (_childpid > 0)
- {
+ if (_childpid > 0) {
delete[] argv;//don't need the argument list
// we want to write to p2c pipe, so close read-fd0
ret = close (p2c_pipe[0]);
- if (ret == -1)
- {
+ if (ret == -1) {
// this is not really a fatal error...
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "ERROR: p2c_pipe[0] close() failed: " <<
strerror(errno)
@@ -1406,8 +1351,7 @@
// We want to read parent to child, so close write-fd1
ret = close (p2c_pipe[1]);
- if (ret == -1)
- {
+ if (ret == -1) {
// not really a fatal error
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "ERROR: close() failed: " << strerror(errno) << std::endl;
@@ -1417,8 +1361,7 @@
// close standard input and direct read-fd1 to standard input
ret = dup2 (p2c_pipe[0], fileno(stdin));
- if (ret == -1)
- {
+ if (ret == -1) {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "ERROR: dup2() failed: " << strerror(errno) << std::endl;
#endif
@@ -1433,14 +1376,13 @@
// aren't open. This will tend to close most fd's in most programs.
int numfailed = 0, closed = 0;
int anfd = fileno(stderr)+1;
- for ( ; numfailed < 10; anfd++)
- {
+ for ( ; numfailed < 10; anfd++) {
if ( anfd == c2p_pipe[1] ) continue; // don't close this
if ( anfd == c2p_pipe[0] ) continue; // don't close this either
(correct?)
ret = close (anfd);
- if (ret < 0) numfailed++;
- else
- {
+ if (ret < 0) {
+ numfailed++;
+ } else {
numfailed = 0;
closed++;
}
@@ -1458,8 +1400,7 @@
#if GNASH_PLUGIN_DEBUG > 1
std::cout << "Starting process: ";
- for (int i = 0; argv[i] != 0; ++i)
- {
+ for (int i = 0; argv[i] != 0; ++i) {
std::cout << argv[i] << " ";
}
std::cout << std::endl;
@@ -1513,8 +1454,7 @@
NPN_GetProperty(npp, window, sDocument, &vDoc);
NPN_ReleaseObject(window);
- if (!NPVARIANT_IS_OBJECT(vDoc))
- {
+ if (!NPVARIANT_IS_OBJECT(vDoc)) {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "Can't get window object" << std::endl;
#endif
@@ -1528,8 +1468,7 @@
NPN_GetProperty(npp, npDoc, sLocation, &vLoc);
NPN_ReleaseObject(npDoc);
- if (!NPVARIANT_IS_OBJECT(vLoc))
- {
+ if (!NPVARIANT_IS_OBJECT(vLoc)) {
#ifdef GNASH_PLUGIN_DEBUG
std::cout <<"Can't get window.location object" << std::endl;
#endif
@@ -1543,8 +1482,7 @@
NPN_GetProperty(npp, npLoc, sProperty, &vProp);
NPN_ReleaseObject(npLoc);
- if (!NPVARIANT_IS_STRING(vProp))
- {
+ if (!NPVARIANT_IS_STRING(vProp)) {
#ifdef GNASH_PLUGIN_DEBUG
std::cout << "Can't get window.location.href object" << std::endl;
#endif
@@ -1560,8 +1498,7 @@
getPluginDescription()
{
static const char* desc = NULL;
- if (!desc)
- {
+ if (!desc) {
desc = std::getenv("GNASH_PLUGIN_DESCRIPTION");
if (desc == NULL) desc = PLUGIN_DESCRIPTION;
}
=== modified file 'utilities/dumpshm.cpp'
--- a/utilities/dumpshm.cpp 2009-10-03 21:48:49 +0000
+++ b/utilities/dumpshm.cpp 2009-12-16 00:09:04 +0000
@@ -60,7 +60,7 @@
#include <cerrno>
#ifdef ENABLE_NLS
-# include <locale>
+# include <clocale>
#endif
#include "log.h"
=== modified file 'utilities/flvdumper.cpp'
--- a/utilities/flvdumper.cpp 2009-10-02 12:38:13 +0000
+++ b/utilities/flvdumper.cpp 2009-12-16 00:09:04 +0000
@@ -31,7 +31,7 @@
#include <vector>
#ifdef ENABLE_NLS
-# include <locale>
+# include <clocale>
#endif
#include "log.h"
=== modified file 'utilities/soldumper.cpp'
--- a/utilities/soldumper.cpp 2009-10-02 12:38:13 +0000
+++ b/utilities/soldumper.cpp 2009-12-16 00:09:04 +0000
@@ -25,7 +25,7 @@
#include <cstring>
#ifdef ENABLE_NLS
-# include <locale>
+# include <clocale>
#endif
extern "C"{
- [Gnash-commit] /srv/bzr/gnash/trunk r11699: Part of a patch from Albert Lee <trisk at forkgnu.org>:,
Rob Savoye <=