little bug in cMenuEditStrItem?

Message ID 43EF0EF4.3030208@cadsoft.de
State New
Headers

Commit Message

Klaus Schmidinger Feb. 12, 2006, 10:33 a.m. UTC
  Markus Hahn wrote:
> Hi everybody, 
> 
> the issue is found in SetupRecordings->Name instant recording:
> If I edit the item an press enter to confirm the change  I stay 
> in the actuall  menu, editing mode ist  off. 
> On the other hand, if I do not confirm the change an go 
> out with kBack I the menu goes to the last parent menu. 
> 
> I think  kBack should make the same like kOK without 
> remember the changes.

You're absolutely right.

The attached patch should fix this.

Klaus
  

Comments

Suur Karu Feb. 12, 2006, 12:01 p.m. UTC | #1
Klaus Schmidinger wrote:

> You're absolutely right.
> 
> The attached patch should fix this.
> ------------------------------------------------------------------------
> 
> --- menuitems.h	2006/01/21 10:45:55	1.16
> +++ menuitems.h	2006/02/12 10:22:03
> @@ -77,6 +77,7 @@

2# patch -p0 <vdr-1.3.42-editstrkback.diff
(Stripping trailing CRs from patch.)
patching file menuitems.h
Hunk #1 succeeded at 65 with fuzz 2 (offset -12 lines).
(Stripping trailing CRs from patch.)
patching file menuitems.c



menuitems.c:242: error: `orgValue' was not declared in this scope
menuitems.c:242: warning: unused variable 'orgValue'
menuitems.c: In destructor `virtual cMenuEditStrItem::~cMenuEditStrItem()':
menuitems.c:257: error: `orgValue' was not declared in this scope
menuitems.c:257: warning: unused variable 'orgValue'
menuitems.c: In member function `virtual eOSState 
cMenuEditStrItem::ProcessKey(eKeys)':
menuitems.c:415: error: `orgValue' was not declared in this scope
menuitems.c:415: warning: unused variable 'orgValue'
menuitems.c:478: error: `orgValue' was not declared in this scope
make: *** [menuitems.o] Error 1
  
Klaus Schmidinger Feb. 12, 2006, 12:07 p.m. UTC | #2
Suur Karu wrote:
> Klaus Schmidinger wrote:
> 
>> You're absolutely right.
>>
>> The attached patch should fix this.
>> ------------------------------------------------------------------------
>>
>> --- menuitems.h    2006/01/21 10:45:55    1.16
>> +++ menuitems.h    2006/02/12 10:22:03
>> @@ -77,6 +77,7 @@
> 
> 
> 2# patch -p0 <vdr-1.3.42-editstrkback.diff
> (Stripping trailing CRs from patch.)
> patching file menuitems.h
> Hunk #1 succeeded at 65 with fuzz 2 (offset -12 lines).
> (Stripping trailing CRs from patch.)
> patching file menuitems.c
> 
> 
> 
> menuitems.c:242: error: `orgValue' was not declared in this scope
> menuitems.c:242: warning: unused variable 'orgValue'
> menuitems.c: In destructor `virtual cMenuEditStrItem::~cMenuEditStrItem()':
> menuitems.c:257: error: `orgValue' was not declared in this scope
> menuitems.c:257: warning: unused variable 'orgValue'
> menuitems.c: In member function `virtual eOSState 
> cMenuEditStrItem::ProcessKey(eKeys)':
> menuitems.c:415: error: `orgValue' was not declared in this scope
> menuitems.c:415: warning: unused variable 'orgValue'
> menuitems.c:478: error: `orgValue' was not declared in this scope
> make: *** [menuitems.o] Error 1

Are you sure you're applying this patch to VDR version 1.3.42?

Klaus
  
Suur Karu Feb. 12, 2006, 12:17 p.m. UTC | #3
Klaus Schmidinger wrote:
> Are you sure you're applying this patch to VDR version 1.3.42?
> 

Absolutely:

root@vdr:/usr/local/vdr-1.3.42# pwd
/usr/local/vdr-1.3.42

root@vdr:/usr/local/vdr-1.3.42# patch -p0 <vdr-1.3.42-editstrkback.diff
(Stripping trailing CRs from patch.)
patching file menuitems.h
Hunk #1 succeeded at 65 with fuzz 2 (offset -12 lines).
(Stripping trailing CRs from patch.)
patching file menuitems.c


Not very vanilla vdr, but i think it is not important there.
gcc version 3.4.5

Regards,
SK
  
Klaus Schmidinger Feb. 12, 2006, 12:19 p.m. UTC | #4
Suur Karu wrote:
> Klaus Schmidinger wrote:
> 
>> Are you sure you're applying this patch to VDR version 1.3.42?
>>
> 
> Absolutely:
> 
> root@vdr:/usr/local/vdr-1.3.42# pwd
> /usr/local/vdr-1.3.42
> 
> root@vdr:/usr/local/vdr-1.3.42# patch -p0 <vdr-1.3.42-editstrkback.diff
> (Stripping trailing CRs from patch.)
> patching file menuitems.h
> Hunk #1 succeeded at 65 with fuzz 2 (offset -12 lines).
> (Stripping trailing CRs from patch.)
> patching file menuitems.c
> 
> 
> Not very vanilla vdr, but i think it is not important there.
> gcc version 3.4.5

Well, it compiles here just fine.

Could you try with plain vanilla VDR 1.3.42?

Klaus
  
Suur Karu Feb. 12, 2006, 12:29 p.m. UTC | #5
Klaus Schmidinger wrote:
> Could you try with plain vanilla VDR 1.3.42?
> 

Yes, vanilla OK.
I will try to found, where problem is.

Thanks.
  

Patch

--- menuitems.h	2006/01/21 10:45:55	1.16
+++ menuitems.h	2006/02/12 10:22:03
@@ -77,6 +77,7 @@ 
 
 class cMenuEditStrItem : public cMenuEditItem {
 private:
+  char *orgValue;
   char *value;
   int length;
   char *allowed;
--- menuitems.c	2006/02/04 12:47:08	1.31
+++ menuitems.c	2006/02/12 10:31:08
@@ -239,6 +239,7 @@ 
 cMenuEditStrItem::cMenuEditStrItem(const char *Name, char *Value, int Length, const char *Allowed)
 :cMenuEditItem(Name)
 {
+  orgValue = NULL;
   value = Value;
   length = Length;
   allowed = strdup(Allowed);
@@ -253,6 +254,7 @@ 
 
 cMenuEditStrItem::~cMenuEditStrItem()
 {
+  free(orgValue);
   free(allowed);
 }
 
@@ -409,8 +411,10 @@ 
                  break;
     case kRight|k_Repeat:
     case kRight: AdvancePos();
-                 if (pos == 0)
+                 if (pos == 0) {
+                    orgValue = strdup(value);
                     SetHelpKeys();
+                    }
                  break;
     case kUp|k_Repeat:
     case kUp:
@@ -469,7 +473,13 @@ 
                     return cMenuEditItem::ProcessKey(Key);
                  }
                  break;
+    case kBack:
     case kOk:    if (InEditMode()) {
+                    if (Key == kBack && orgValue) {
+                       strcpy(value, orgValue);
+                       free(orgValue);
+                       orgValue = NULL;
+                       }
                     pos = -1;
                     newchar = true;
                     stripspace(value);