[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/swf/ASHandlers.cpp serve...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/swf/ASHandlers.cpp serve... |
Date: |
Sun, 30 Jul 2006 01:41:17 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/07/30 01:41:17
Modified files:
. : ChangeLog
server/swf : ASHandlers.cpp ASHandlers.h
Log message:
* server/swf/ASHandlers.cpp, server/swf/ASHandlers.h:
merged GetUrl and GetUrl2 common code into a CommonGetUrl
method.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.557&r2=1.558
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ASHandlers.cpp?cvsroot=gnash&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ASHandlers.h?cvsroot=gnash&r1=1.5&r2=1.6
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.557
retrieving revision 1.558
diff -u -b -r1.557 -r1.558
--- ChangeLog 30 Jul 2006 01:09:24 -0000 1.557
+++ ChangeLog 30 Jul 2006 01:41:16 -0000 1.558
@@ -1,5 +1,8 @@
2006-07-29 Sandro Santilli <address@hidden>
+ * server/swf/ASHandlers.cpp, server/swf/ASHandlers.h:
+ merged GetUrl and GetUrl2 common code into a CommonGetUrl
+ method.
* server/movie_root.cpp, server/movie_root.h:
assert that movie_root::get_url is never called.
Index: server/swf/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/ASHandlers.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- server/swf/ASHandlers.cpp 27 Jul 2006 01:47:11 -0000 1.39
+++ server/swf/ASHandlers.cpp 30 Jul 2006 01:41:17 -0000 1.40
@@ -629,61 +629,7 @@
log_action("GetUrl: target=%s url=%s", target, url);
- // If the url starts with an "http" or "https",
- // then we want to load it into a web browser.
- if (strncmp(url, "http", 4) == 0)
- {
-// if (windowid) {
-// Atom mAtom = 486;
-// Display *mDisplay = XOpenDisplay(NULL);
-// XLockDisplay(mDisplay);
-// XChangeProperty (mDisplay, windowid,
mAtom,
-// XA_STRING, 8,
PropModeReplace,
-// (unsigned char *)url,
-// url_len);
-
-// XUnlockDisplay(mDisplay);
-// XCloseDisplay(mDisplay);
-// } else {
- string command = "firefox -remote \"openurl(";
- command += url;
- command += ")\"";
- dbglogfile << "Launching URL... " << command << endl;
-// sprite_instance *target = env.get_target();
-// target->get_url(url);
- system(command.c_str());
-// }
- return;
- }
-
- // If the url starts with "FSCommand:", then this is
- // a message for the host app.
- else if (strncmp(url, "FSCommand:", 10) == 0)
- {
- if (s_fscommand_handler) {
- // Call into the app.
-
(*s_fscommand_handler)(env.get_target()->get_root_interface(), url + 10,
target);
- }
- }
- else
- {
-#ifdef EXTERN_MOVIE
-// log_error("get url: target=%s, url=%s\n", target, url);
-
- tu_string tu_target = target;
- character* target_movie = env.find_target(tu_target);
- if (target_movie != NULL)
- {
- sprite_instance* root_movie =
env.get_target()->get_root_movie();
- attach_extern_movie(url, target_movie, root_movie);
- }
- else
- {
- log_error("get url: target %s not found\n", target);
- }
-#endif // EXTERN_MOVIE
- }
-
+ CommonGetUrl(env, target, url, 0u);
}
void
@@ -1491,22 +1437,16 @@
// @@ TODO range checks
}
-void
-SWFHandlers::ActionGetUrl2(ActionExec& thread)
+// Common code for GetUrl and GetUrl2. See:
+// http://sswf.sourceforge.net/SWFalexref.html#action_get_url
+// http://sswf.sourceforge.net/SWFalexref.html#action_get_url2
+void
+SWFHandlers::CommonGetUrl(as_environment& env,
+ const char* target, // the target window, or _level1..10
+ const char* url,
+ uint8_t method // 0:NONE, 1:GET, 2:POST
+ )
{
-// GNASH_REPORT_FUNCTION;
- as_environment& env = thread.env;
-
- ensure_stack(env, 2); // target, url
-
- const action_buffer& code = thread.code;
-
- assert( code[thread.pc] == SWF::ACTION_GETURL2 );
-
- // int method = code[pc + 3];
-
- const char* target = env.top(0).to_string();
- const char* url = env.top(1).to_string();
// If the url starts with "FSCommand:", then this is
// a message for the host app.
@@ -1523,7 +1463,7 @@
#ifdef EXTERN_MOVIE
// log_error("get url2: target=%s, url=%s\n", target, url);
- character* target_movie = env.find_target(env.top(0));
+ character* target_movie = env.find_target(target);
if (target_movie != NULL)
{
sprite_instance* root_movie =
env.get_target()->get_root_movie();
@@ -1533,8 +1473,43 @@
{
log_error("get url2: target %s not found\n", target);
}
+#else
+ string command = "firefox -remote \"openurl(";
+ command += url;
+ command += ")\"";
+ dbglogfile << "Launching URL... " << command << endl;
+ system(command.c_str());
#endif // EXTERN_MOVIE
}
+}
+
+void
+SWFHandlers::ActionGetUrl2(ActionExec& thread)
+{
+// GNASH_REPORT_FUNCTION;
+ as_environment& env = thread.env;
+
+ ensure_stack(env, 2); // target, url
+
+ const action_buffer& code = thread.code;
+
+ assert( code[thread.pc] == SWF::ACTION_GETURL2 );
+
+ uint8_t method = code[thread.pc + 3];
+ // handle malformed SWFs
+ if ( method > 2 )
+ {
+ log_warning("Bogus GetUrl2 method (%d) in SWF file, set to 0",
+ method);
+ method=0;
+ }
+
+
+ const char* target = env.top(0).to_string();
+ const char* url = env.top(1).to_string();
+
+ CommonGetUrl(env, target, url, method);
+
env.drop(2);
}
Index: server/swf/ASHandlers.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/ASHandlers.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/swf/ASHandlers.h 24 Jul 2006 14:53:25 -0000 1.5
+++ server/swf/ASHandlers.h 30 Jul 2006 01:41:17 -0000 1.6
@@ -160,6 +160,21 @@
// called by ensure_stack() above.
static void fix_stack_underrun(as_environment& env, size_t required);
+ /// Common code for ActionGetUrl and ActionGetUrl2
+ //
+ /// @see http://sswf.sourceforge.net/SWFalexref.html#action_get_url2
+ /// @see http://sswf.sourceforge.net/SWFalexref.html#action_get_url
+ ///
+ /// @param target
+ /// the target window or _level1 to _level10
+ ///
+ /// @param method
+ /// 0:NONE, 1:GET, 2:POST
+ ///
+ static void CommonGetUrl(as_environment& env,
+ const char* target, const char* url,
+ uint8_t method);
+
static void ActionEnd(ActionExec& thread);
static void ActionNextFrame(ActionExec& thread);
static void ActionPrevFrame(ActionExec& thread);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/swf/ASHandlers.cpp serve...,
Sandro Santilli <=