View Single Post
Old 09-03-2009, 08:50 PM   #135
pwarren
Connoisseur
pwarren can program the VCR without an owner's manual.pwarren can program the VCR without an owner's manual.pwarren can program the VCR without an owner's manual.pwarren can program the VCR without an owner's manual.pwarren can program the VCR without an owner's manual.pwarren can program the VCR without an owner's manual.pwarren can program the VCR without an owner's manual.pwarren can program the VCR without an owner's manual.pwarren can program the VCR without an owner's manual.pwarren can program the VCR without an owner's manual.pwarren can program the VCR without an owner's manual.
 
Posts: 95
Karma: 186186
Join Date: May 2009
Location: Canberra, Australia
Device: Irex Iliad (Dead), EcoReader (Smashed screen), Kobo Touch
I've come up with pretty much the same fixes as ericshliao.

If I were to compile FBReader that had only used EpdRefreshAuto(Epd,0) from xepdmgr, and ran it like: ./bin/xepdmgr :0 ./bin/FBReader

would I then expect that no screen refreshes would take place?

Because that's not what I see happening. Having EpdRefreshAutio(Epd,0) seems to make no difference to the refresh behaviour. I guess I could have introduced bugs in the code with my c++ compatibility changes. Here's my diff for xepdmgrclient.c:

Code:
pwarren@buildhost:~/fbreader-0.10.7-iliad/zlibrary/core/src/application$ diff -u /home/pwarren/iliad/xepdmgr-1.9-iliad/xepdmgrclient.c ./xepdmgrclient.c
--- /home/pwarren/iliad/xepdmgr-1.9-iliad/xepdmgrclient.c       2009-04-26 07:30:26.000000000 +1000
+++ ./xepdmgrclient.c   2009-08-31 12:30:13.000000000 +1000
@@ -40,7 +40,8 @@
 EpdInit(char *Display)
 {
         _sEpd *Epd;
-        if((Epd=malloc(sizeof(_sEpd)))==NULL)
+       Epd = (_sEpd *)malloc(sizeof(_sEpd));
+        if((Epd==NULL))
                 return(NULL); /* Insufficient memory */
         memset(Epd,0,sizeof(_sEpd));
         if((Epd->dpy=XOpenDisplay(Display))==NULL) {
@@ -95,7 +96,9 @@
 int
 EpdRefreshAuto(sEpd *Epd,int Enabled)
 {
-        return(EpdLocalSend((_sEpd *)Epd,(Enabled!=0)?"Auto(1)\n":"Auto(0)\n"));
+  char *on = "Auto(1)\n";
+  char *off = "Auto(0)\n";
+  return(EpdLocalSend((_sEpd *)Epd,(Enabled!=0)?on:off));
 }

 /* Implementation of local functions */
@@ -123,14 +126,16 @@
                 cur_id=-1; /* incorrect format or atom not read */
         if(cmd==NULL || (cmd_next_id!=NULL && cur_id!=next_id)) {
                 /* server has already read this property; overwrite the property */
-                if((text=malloc(2+strlen(NewCmd)+1))==NULL)
+         text = (char *)malloc(2+strlen(NewCmd)+1);
+                if(text==NULL)
                         return(-1);
                 text[0]=(cmd_next_id!=NULL)?next_id+'0':'?';
                 text[1]='\n';
                 strcpy(text+2,NewCmd);
         } else {
-                /* Doesn't know if the server has read this yet; append to the property */
-                if((text=malloc(strlen(cmd)+strlen(NewCmd)+1))==NULL)
+               /* Doesn't know if the server has read this yet; append to the property */
+         text=(char *)malloc(strlen(cmd)+strlen(NewCmd)+1);
+         if(text==NULL)
                         return(-1);
                 strcpy(text,cmd);
                 strcat(text,NewCmd);
Any ideas?
pwarren is offline   Reply With Quote