[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-dev] [patch] Avoid some warnings and get the code to build
From: |
Petter Reinholdtsen |
Subject: |
[Gnash-dev] [patch] Avoid some warnings and get the code to build |
Date: |
Wed, 29 Mar 2006 14:10:27 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (usg-unix-v) |
Here is a few more patches for the CVS version of gnash. A few
'const' are lost with casting. This patch fixes some of those:
diff -ru libbase/container.h.orig libbase/container.h
--- libbase/container.h.orig 2006-03-29 13:55:42.000000000 +0200
+++ ./libbase/container.h 2006-03-29 13:49:27.701685750 +0200
@@ -85,7 +85,7 @@
public:
size_t operator()(const T& data) const
{
- unsigned char* p = (unsigned char*) &data;
+ const unsigned char* p = (const unsigned char*) &data;
int size = sizeof(T);
return sdbm_hash(p, size);
@@ -251,7 +251,7 @@
/// \brief
/// If you need a const tu_stringi, don't create a new object;
/// these things have the same internal representation.
- const tu_stringi& to_tu_stringi() const { return *(tu_stringi*)
this; }
+ const tu_stringi& to_tu_stringi() const { return *(const
tu_stringi*) this; }
/// \brief
/// operator= returns void; if you want to know why, ask Charles Bloom
:)
Then there is at least one case where a const string is written to.
This fixes that the problem i noticed:
diff -ru gnash/libbase/log.cpp ./libbase/log.cpp
--- gnash/libbase/log.cpp 2006-03-29 13:55:42.000000000 +0200
+++ ./libbase/log.cpp 2006-03-29 13:42:27.249094965 +0200
@@ -423,7 +423,7 @@
LogFile&
LogFile::operator << (const char *str)
{
- char *c = (char *)str;
+ string c(str);
_logentry = timestamp();
_logentry += ": ";
@@ -437,7 +437,7 @@
// for logging, we have to strip the CR off the end otr we get
// blanks lines as the previous implementation required a CR, and
// now we don't.
- int len = strlen(c);
+ int len = c.length();
if (c[len] == '\n') {
c[len] = 0;
}
There is also a warning because 'static' isn't the first word in the
statement to declare a variable. This fixes that problem:
diff -ru gnash/server/Object.h ./server/Object.h
--- gnash/server/Object.h 2006-03-29 13:55:50.000000000 +0200
+++ ./server/Object.h 2006-03-29 13:35:20.917532363 +0200
@@ -341,7 +341,7 @@
bool m_is_protected;
/// mask for flags
- const static int as_prop_flags_mask = 0x7;
+ static const int as_prop_flags_mask = 0x7;
/// Default constructor
as_prop_flags() : m_flags(0), m_is_protected(false)
Finally, there is a build error because a non-existing class member is
being initialized:
diff -ru gnash/plugin/plugin.cpp ./plugin/plugin.cpp
--- gnash/plugin/plugin.cpp 2006-03-29 13:55:46.000000000 +0200
+++ ./plugin/plugin.cpp 2006-03-29 13:56:10.892361556 +0200
@@ -468,8 +468,8 @@
_glxContext(NULL),
_shutdown(FALSE),
_glInitialized(FALSE),
- _thread(NULL),
- _newwin(FALSE)
+ _thread(NULL)
+// _newwin(FALSE)
{
GNASH_REPORT_FUNCTION;
}
Please include these patches in a future version of gnash.
Friendly,
--
Petter Reinholdtsen
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-dev] [patch] Avoid some warnings and get the code to build,
Petter Reinholdtsen <=