summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2006-08-05 12:04:27 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2006-08-05 12:04:27 +0000
commit0fc982e4a8e2ef78bd46122a08fb630bc684a56d (patch)
treeb5fc54a6fe6b3b084b286f367118a458c9aecbde
parent78e6fdc61d1fdba84fd47611414cd2dd5b76a298 (diff)
downloadmdk-0fc982e4a8e2ef78bd46122a08fb630bc684a56d.tar.gz
mdk-0fc982e4a8e2ef78bd46122a08fb630bc684a56d.tar.bz2
Bug fix: mixvm's smem correctly handles negative zero
git-archimport-id: mdk@sv.gnu.org/mdk--devel--1--patch-11
-rw-r--r--mixlib/xmix_vm_handlers.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/mixlib/xmix_vm_handlers.c b/mixlib/xmix_vm_handlers.c
index 5fcd209..4ebfc77 100644
--- a/mixlib/xmix_vm_handlers.c
+++ b/mixlib/xmix_vm_handlers.c
@@ -663,6 +663,7 @@ cmd_smem_ (mix_vm_cmd_dispatcher_t *dis, const gchar *carg)
glong value = 0;
int k = 0;
gchar *arg = NULL;
+ mix_word_t wval;
if (ok)
{
@@ -679,6 +680,12 @@ cmd_smem_ (mix_vm_cmd_dispatcher_t *dis, const gchar *carg)
{
while (isspace (arg[k])) k++;
value = atol (arg + k);
+
+ if ((value == 0) && (arg[k] == '-'))
+ wval = MIX_WORD_MINUS_ZERO;
+ else
+ wval = mix_word_new (value);
+
if ( arg[k] == '+' || arg[k] == '-' ) k++;
while (isdigit (arg[k])) k++;
ok = arg[k] == '\0';
@@ -686,12 +693,14 @@ cmd_smem_ (mix_vm_cmd_dispatcher_t *dis, const gchar *carg)
}
if (ok)
- mix_vm_set_addr_contents (dis->vm, mix_short_new (addr),
- mix_word_new (value));
+ {
+ mix_vm_set_addr_contents (dis->vm, mix_short_new (addr), wval);
+ }
else
{
log_error_ (dis, _("Invalid argument: %s"), arg);
}
+
if (arg) g_free (arg);
return ok;