found 401440 0.3pre-20000911-6
tag 401440 +patch

The problem is with how the program expects cin to behave. After the
last command is read, the program expects that cin will set the eof
bit. However, if there is any whitespace after the last command (such as
the final newline), then it won't set the eof until after that is read
on the next iteration. When the whitespace is read by itself, cin sets
eof and fail, and it doesn't alter the ev string. Because ev is not
re-set, it is exactly the same string it was last iteration, which
means that the last command gets executed twice.

I think the best solution is to check if cin fails, and if it does,
continue or break. Another is to set ev to an empty string before it
gets used in cin, so that if cin fails then ev is just a harmless empty
string.

-----patch-----
--- xmacroplay.orig.cpp 2012-09-30 07:23:15.000000000 -0700
+++ xmacroplay.cpp      2012-09-30 08:11:58.924690804 -0700
@@ -337,6 +337,8 @@
   
   while ( !cin.eof() ) {
        cin >> ev;
+       if (cin.fail())
+               break;
        if (ev[0]=='#')
        {
          cout << "Comment: " << ev << endl;
-----end of patch-----

-Brandon


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to