CVS: setedit/mainsrc editwind.cc, 1.11, 1.12 keytrans.cc, 1.25, 1.26 ceditor.cc, 1.169, 1.170 edspe
Brought to you by:
set
From: Salvador E. T. <se...@us...> - 2016-11-17 18:24:46
|
Update of /cvsroot/setedit/setedit/mainsrc In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22569/mainsrc Modified Files: editwind.cc keytrans.cc ceditor.cc edspecs.cc Log Message: * Added: [Debian] multi-arch tag. * Added: [Debian] To compile using all installed CPUs. * Modified: Editor desktop files to allow 32 -> 64 bits migration. * Added: Support for LP64 architectures (i.e. AMD64) * Fixed: Uses of memcpy that could potentially generate problems, some of them were problematic. * Added: More checks when reading setenvir.dat. * Fixed: [txhgen.cc] Potential use of unitilialized var. * Fixed: [Errors parser] to support the new gnu make quotation style. Index: editwind.cc =================================================================== RCS file: /cvsroot/setedit/setedit/mainsrc/editwind.cc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** editwind.cc 23 Jun 2004 19:33:22 -0000 1.11 --- editwind.cc 17 Nov 2016 18:24:42 -0000 1.12 *************** *** 1,3 **** ! /* Copyright (C) 1996-2003 by Salvador E. Tropea (SET), see copyrigh file for details */ // That's the first include because is used to configure the editor. --- 1,3 ---- ! /* Copyright (C) 1996-2016 by Salvador E. Tropea (SET), see copyrigh file for details */ // That's the first include because is used to configure the editor. *************** *** 30,34 **** "\x77\x78\x79\x7A\x7B\x7C" ! const int TCEditWindow::ResumeVersion=6; const char *TCEditWindow::clipboardTitle=__("Clipboard"); const char *TCEditWindow::untitled=__("Untitled"); --- 30,34 ---- "\x77\x78\x79\x7A\x7B\x7C" ! const int TCEditWindow::ResumeVersion=7; const char *TCEditWindow::clipboardTitle=__("Clipboard"); const char *TCEditWindow::untitled=__("Untitled"); *************** *** 201,205 **** r.extraSize=sizeof(EditorResume)-(sizeof(EditorResumeV5)+sizeof(uint32)); ! time(&r.dateResume); } --- 201,207 ---- r.extraSize=sizeof(EditorResume)-(sizeof(EditorResumeV5)+sizeof(uint32)); ! time_t aux; ! time(&aux); ! r.dateResume=(uint32)aux; } *************** *** 298,302 **** r.version=6; r.extraSize=sizeof(EditorResume)-(sizeof(EditorResumeV5)+sizeof(uint32)); ! time(&r.dateResume); } } --- 300,306 ---- r.version=6; r.extraSize=sizeof(EditorResume)-(sizeof(EditorResumeV5)+sizeof(uint32)); ! time_t aux; ! time(&aux); ! r.dateResume=(uint32)aux; } } *************** *** 336,340 **** EnlargeSizesResume(r); r.extraSize=sizeof(EditorResume)-(sizeof(EditorResumeV5)+sizeof(uint32)); ! time(&r.dateResume); } --- 340,346 ---- EnlargeSizesResume(r); r.extraSize=sizeof(EditorResume)-(sizeof(EditorResumeV5)+sizeof(uint32)); ! time_t aux; ! time(&aux); ! r.dateResume=(uint32)aux; } Index: keytrans.cc =================================================================== RCS file: /cvsroot/setedit/setedit/mainsrc/keytrans.cc,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** keytrans.cc 3 Jun 2015 14:20:12 -0000 1.25 --- keytrans.cc 17 Nov 2016 18:24:42 -0000 1.26 *************** *** 1,3 **** ! /* Copyright (C) 1996-2015 by Salvador E. Tropea (SET), see copyrigh file for details */ /***************************************************************************** --- 1,3 ---- ! /* Copyright (C) 1996-2016 by Salvador E. Tropea (SET), see copyrigh file for details */ /***************************************************************************** *************** *** 174,178 **** { if (node->flags==kbtIsMacro || node->flags==kbtIsSeq) ! delete[] node->d.macro; else if (node->flags==kbtIsSComm) // It removes a branch in the tree --- 174,178 ---- { if (node->flags==kbtIsMacro || node->flags==kbtIsSeq) ! delete[] node->dp.macro; else if (node->flags==kbtIsSComm) // It removes a branch in the tree *************** *** 237,241 **** { case kbtIsComm: ! DynStrCat(cat,TranslateEdCommand(node->d.command)); break; case kbtIsMacro: --- 237,241 ---- { case kbtIsComm: ! DynStrCat(cat,TranslateEdCommand(node->dd.command)); break; case kbtIsMacro: *************** *** 295,302 **** return -1; case kbtIsMacro: ! ret->d.data=GetMNameC(ret); break; case kbtIsSeq: ! ret->d.data=GetTSeqC(ret); break; } --- 295,302 ---- return -1; case kbtIsMacro: ! ret->dp.data=GetMNameC(ret); break; case kbtIsSeq: ! ret->dp.data=GetTSeqC(ret); break; } *************** *** 394,401 **** if (!nAux) return 0; ! node->d.data=nAux; break; case kbtIsMacro: ! node->d.data=newStr(GetMNameC(node)); break; case kbtIsSeq: --- 394,401 ---- if (!nAux) return 0; ! node->dp.data=nAux; break; case kbtIsMacro: ! node->dp.data=newStr(GetMNameC(node)); break; case kbtIsSeq: *************** *** 406,410 **** return 0; memcpy(s2,s,size); ! node->d.data=s2; break; } --- 406,410 ---- return 0; memcpy(s2,s,size); ! node->dp.data=s2; break; } *************** *** 527,531 **** aux=OffSet; CompactTable(GetTableE(node)); ! node->d.offset=aux; break; case kbtIsMacro: --- 527,531 ---- aux=OffSet; CompactTable(GetTableE(node)); ! node->dd.offset=aux; break; case kbtIsMacro: *************** *** 533,537 **** AlignSize(aux); strcpy((char *)(newBase+OffSet),GetMNameE(node)); ! node->d.offset=OffSet; OffSet+=aux; break; --- 533,537 ---- AlignSize(aux); strcpy((char *)(newBase+OffSet),GetMNameE(node)); ! node->dd.offset=OffSet; OffSet+=aux; break; *************** *** 541,545 **** AlignSize(aux); memcpy((KeyTSeq *)(newBase+OffSet),s,aux); ! node->d.offset=OffSet; OffSet+=aux; break; --- 541,545 ---- AlignSize(aux); memcpy((KeyTSeq *)(newBase+OffSet),s,aux); ! node->dd.offset=OffSet; OffSet+=aux; break; *************** *** 634,638 **** // change the pointer. if (lastTableInSearch) ! lastTableInSearch->d.data=curTable; if (updateBase) base=curTable; --- 634,638 ---- // change the pointer. if (lastTableInSearch) ! lastTableInSearch->dp.data=curTable; if (updateBase) base=curTable; *************** *** 706,710 **** node->flags=kbtIsSComm; KeyTTable *nT=(KeyTTable *)new char[sizeof(KeyTTable)+sizeof(KeyTNode)]; ! node->d.data=nT; nT->cant=1; nT->total=0; // Later --- 706,710 ---- node->flags=kbtIsSComm; KeyTTable *nT=(KeyTTable *)new char[sizeof(KeyTTable)+sizeof(KeyTNode)]; ! node->dp.data=nT; nT->cant=1; nT->total=0; // Later *************** *** 717,721 **** { // Easy ;-) node->flags=kbtIsMacro; ! node->d.data=newStr((char *)data); } else --- 717,721 ---- { // Easy ;-) node->flags=kbtIsMacro; ! node->dp.data=newStr((char *)data); } else *************** *** 726,730 **** { node->flags=kbtIsComm; ! node->d.command=(unsigned short)((unsigned long)p->at(0)); } else --- 726,730 ---- { node->flags=kbtIsComm; ! node->dd.command=(unsigned short)((unsigned long)p->at(0)); } else *************** *** 735,739 **** s->commands[i]=(unsigned short)((unsigned long)p->at(i)); node->flags=kbtIsSeq; ! node->d.data=s; } } --- 735,739 ---- s->commands[i]=(unsigned short)((unsigned long)p->at(i)); node->flags=kbtIsSeq; ! node->dp.data=s; } } *************** *** 768,785 **** fwrite(Signature,sizeof(Signature),1,f); fputc(Version,f); ! ushort w=TGKey::GetAltSettings(); ! fwrite(&w,sizeof(w),1,f); if (type==kbtStatic) { // Don't save the keys if not needed ! unsigned c=0; ! fwrite(&c,sizeof(cSize),1,f); } else { ! fwrite(&cSize,sizeof(cSize),1,f); fwrite(base,cSize,1,f); } ! int translateKeyPad=TGKey::GetKbdMapping(TGKey::dosTranslateKeypad); ! fwrite(&translateKeyPad,sizeof(translateKeyPad),1,f); fclose(f); return 0; --- 768,785 ---- fwrite(Signature,sizeof(Signature),1,f); fputc(Version,f); ! uint16 w=TGKey::GetAltSettings(); ! fwrite(&w,2,1,f); if (type==kbtStatic) { // Don't save the keys if not needed ! uint32 c=0; ! fwrite(&c,4,1,f); } else { ! fwrite(&cSize,4,1,f); fwrite(base,cSize,1,f); } ! int32 translateKeyPad=TGKey::GetKbdMapping(TGKey::dosTranslateKeypad); ! fwrite(&translateKeyPad,4,1,f); fclose(f); return 0; *************** *** 807,817 **** GenError(__("Wrong version")); ! ushort w; ! if (!fread(&w,sizeof(w),1,f)) GenError(__("Read error")); TGKey::SetAltSettings(w); ! int lcSize,replaceK=0; ! if (!fread(&lcSize,sizeof(lcSize),1,f)) GenError(__("Read error")); if (lcSize) --- 807,817 ---- GenError(__("Wrong version")); ! uint16 w; ! if (!fread(&w,2,1,f)) GenError(__("Read error")); TGKey::SetAltSettings(w); ! int32 lcSize,replaceK=0; ! if (!fread(&lcSize,4,1,f)) GenError(__("Read error")); if (lcSize) *************** *** 828,833 **** if (V>=4) { ! int translateKeyPad; ! if (!fread(&translateKeyPad,sizeof(translateKeyPad),1,f)) GenError(__("Read error")); TGKey::SetKbdMapping(translateKeyPad ? TGKey::dosTranslateKeypad : TGKey::dosNormalKeypad); --- 828,833 ---- if (V>=4) { ! int32 translateKeyPad; ! if (!fread(&translateKeyPad,4,1,f)) GenError(__("Read error")); TGKey::SetKbdMapping(translateKeyPad ? TGKey::dosTranslateKeypad : TGKey::dosNormalKeypad); *************** *** 860,864 **** { unsigned short cant; unsigned short commands[a]; } KeyTSeq##a ! #define pSeq(a) (((char *)&a)-((char *)&base)) #define dSeqSel(name,comm) \ KeyTSeq3 name={ 3, {cmcSelectOn,comm,cmcSelectOff} } --- 860,864 ---- { unsigned short cant; unsigned short commands[a]; } KeyTSeq##a ! #define pSeq(a) ((int)(((char *)&a)-((char *)&base))) #define dSeqSel(name,comm) \ KeyTSeq3 name={ 3, {cmcSelectOn,comm,cmcSelectOff} } Index: ceditor.cc =================================================================== RCS file: /cvsroot/setedit/setedit/mainsrc/ceditor.cc,v retrieving revision 1.169 retrieving revision 1.170 diff -C2 -d -r1.169 -r1.170 *** ceditor.cc 3 Jun 2015 14:20:12 -0000 1.169 --- ceditor.cc 17 Nov 2016 18:24:42 -0000 1.170 *************** *** 1,3 **** ! /* Copyright (C) 1996-2015 by Salvador E. Tropea (SET), see copyrigh file for details */ /***************************************************************************** --- 1,3 ---- ! /* Copyright (C) 1996-2016 by Salvador E. Tropea (SET), see copyrigh file for details */ /***************************************************************************** *************** *** 7,19 **** E-Mail: sal...@in... or se...@ie... or se...@co... - Telephone: (+5411) 4759-0013 - - Postal Address: - Salvador E. Tropea - Curapaligue 2124 - (1678) Caseros - 3 de Febrero - Prov: Buenos Aires - Argentina - Contributors: Robert Hoehne (Rob...@Ma...) --- 7,10 ---- *************** *** 1993,2005 **** { case kbtIsComm: ! handleCommand(node.d.command); break; case kbtIsMacro: lock(); ! SLPSearchMacro(this,node.d.macro,False); unlock(); break; case kbtIsSeq: ! se=node.d.sequence; for (i=0; i<se->cant; i++) handleCommand(se->commands[i]); --- 1984,1996 ---- { case kbtIsComm: ! handleCommand(node.dd.command); break; case kbtIsMacro: lock(); ! SLPSearchMacro(this,node.dp.macro,False); unlock(); break; case kbtIsSeq: ! se=node.dp.sequence; for (i=0; i<se->cant; i++) handleCommand(se->commands[i]); *************** *** 2547,2551 **** addToUndo(undoDelCharDel,inEditPtr); int wasATab=*inEditPtr=='\t'; ! memcpy(inEditPtr,inEditPtr+1,restCharsInLine); if (wasATab) RecalculateXofLineInEdit(); --- 2538,2542 ---- addToUndo(undoDelCharDel,inEditPtr); int wasATab=*inEditPtr=='\t'; ! memmove(inEditPtr,inEditPtr+1,restCharsInLine); if (wasATab) RecalculateXofLineInEdit(); *************** *** 2580,2584 **** addToUndo(undoDelCharDel,inEditPtr); int wasATab=*inEditPtr=='\t'; ! memcpy(inEditPtr,inEditPtr+1,restCharsInLine); if (wasATab) RecalculateXofLineInEdit(); --- 2571,2575 ---- addToUndo(undoDelCharDel,inEditPtr); int wasATab=*inEditPtr=='\t'; ! memmove(inEditPtr,inEditPtr+1,restCharsInLine); if (wasATab) RecalculateXofLineInEdit(); *************** *** 5242,5246 **** if (includeEOL && b) { ! memcpy(b,CLY_crlf,CLY_LenEOL); b+=CLY_LenEOL; } --- 5233,5237 ---- if (includeEOL && b) { ! memmove(b,CLY_crlf,CLY_LenEOL); b+=CLY_LenEOL; } *************** *** 7782,7790 **** { FillGapInBuffer(x,curPos.x,s,tabSize,OptimalFill); ! memcpy(s+extraSpaces,p,length); lenLines.set(curPos.y,lenLines[curPos.y]+extraSpaces); } else ! memcpy(s,p,length); if (allowUndo) --- 7773,7781 ---- { FillGapInBuffer(x,curPos.x,s,tabSize,OptimalFill); ! memmove(s+extraSpaces,p,length); lenLines.set(curPos.y,lenLines[curPos.y]+extraSpaces); } else ! memmove(s,p,length); if (allowUndo) *************** *** 7972,7976 **** curPos.x=x; addToUndo(undoDelete,to); ! memcpy(from,to,restCharsInLine+1); // Update markers --- 7963,7967 ---- curPos.x=x; addToUndo(undoDelete,to); ! memmove(from,to,restCharsInLine+1); // Update markers *************** *** 8160,8164 **** // do the work ! CLY_memcpy(from,to,(size_t)(bufLen-(to-buffer))); bufLen-=(unsigned)(to-from); --- 8151,8155 ---- // do the work ! memmove(from,to,(size_t)(bufLen-(to-buffer))); bufLen-=(unsigned)(to-from); *************** *** 12274,12278 **** if (Eated) { ! memcpy(buffer+PosAux,buffer+PosAux+Eated,bufLen-(PosAux+Eated)); bufLen-=Eated; selEnd-=Eated; --- 12265,12269 ---- if (Eated) { ! memmove(buffer+PosAux,buffer+PosAux+Eated,bufLen-(PosAux+Eated)); bufLen-=Eated; selEnd-=Eated; *************** *** 12412,12416 **** // If one of the 2 chars is a tab the X must be recalculated int wasATab=*(inEditPtr-1)=='\t' || *inEditPtr=='\t'; ! CLY_memcpy(inEditPtr-1,inEditPtr,restCharsInLine+1); AdjustLineSel((uint32)(inEditPtr-bufEdit),-1,True); --- 12403,12407 ---- // If one of the 2 chars is a tab the X must be recalculated int wasATab=*(inEditPtr-1)=='\t' || *inEditPtr=='\t'; ! memmove(inEditPtr-1,inEditPtr,restCharsInLine+1); AdjustLineSel((uint32)(inEditPtr-bufEdit),-1,True); *************** *** 14149,14153 **** l++; uint32 *ret=new uint32[l]; ! memcpy(ret,markers,l*sizeof(uint32)); return ret; } --- 14140,14144 ---- l++; uint32 *ret=new uint32[l]; ! memmove(ret,markers,l*sizeof(uint32)); return ret; } Index: edspecs.cc =================================================================== RCS file: /cvsroot/setedit/setedit/mainsrc/edspecs.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** edspecs.cc 25 Feb 2009 16:11:31 -0000 1.9 --- edspecs.cc 17 Nov 2016 18:24:42 -0000 1.10 *************** *** 1,3 **** ! /* Copyright (C) 2001-2004 by Salvador E. Tropea (SET), see copyrigh file for details */ /* This file is an adaptation of idespecs.cc from Robert Hoehne to make the editor */ --- 1,3 ---- ! /* Copyright (C) 2001-2016 by Salvador E. Tropea (SET), see copyrigh file for details */ /* This file is an adaptation of idespecs.cc from Robert Hoehne to make the editor */ *************** *** 123,131 **** { ushort len; ! fread(&len,sizeof(ushort),1,f); ! if (!feof(f)) { ! fread(s,len,1,f); ! s[len]=0; } else --- 123,132 ---- { ushort len; ! if (fread(&len,sizeof(ushort),1,f) && !feof(f)) { ! if (fread(s,len,1,f)) ! s[len]=0; ! else ! *s=0; } else *************** *** 145,150 **** if (f) { ! fread(Name,sizeof(Signature),1,f); ! if (strcmp(Name,Signature)==0) { do --- 146,151 ---- if (f) { ! if (fread(Name,sizeof(Signature),1,f) && ! strcmp(Name,Signature)==0) { do |