This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Integrating Ralf's rebase into setup.exe


Still missing a lot of the errors that were fixed in my patch. Here's the remainder:

1) 'hex' and 'endl' are also in the std:: namespace
2) unbind_main.cc needs 'using namespace std;'
3) (new) rebind_main will rebind the first commandline argument over and over; it needs to use argv[i] not argv[1]
4) fiximage.cc and rebaseimage.cc seem not have gotten any of the std:: fixes.

errmmm...why not inspect the patch below for correctness, and then apply & commit, rather than implementing all of the fixes by hand, which invariably will skip/miss some?

--Chuck
Index: checkimage.cc
===================================================================
RCS file: /cvsroot/kde-cygwin/tools/rebase/checkimage.cc,v
retrieving revision 1.5
diff -u -r1.5 checkimage.cc
--- checkimage.cc	31 Dec 2002 18:33:14 -0000	1.5
+++ checkimage.cc	31 Dec 2002 18:54:05 -0000
@@ -32,7 +32,7 @@
   if (!dll.isLoaded())
     {
       if (Base::debug)
-        std::cout << "error: could not open file" << endl;
+        std::cout << "error: could not open file" << std::endl;
       SetLastError(ERROR_FILE_NOT_FOUND);
       return false;
     }
@@ -40,7 +40,7 @@
   if (!dll.checkRelocations())
     {
       if (Base::debug)
-        std::cout << "dll relocation errors - please fix the errors at first" << endl;
+        std::cout << "dll relocation errors - please fix the errors at first" << std::endl;
       SetLastError(ERROR_INVALID_DATA);
       return false;
     }
Index: fiximage.cc
===================================================================
RCS file: /cvsroot/kde-cygwin/tools/rebase/fiximage.cc,v
retrieving revision 1.3
diff -u -r1.3 fiximage.cc
--- fiximage.cc	31 Dec 2002 12:56:48 -0000	1.3
+++ fiximage.cc	31 Dec 2002 18:54:05 -0000
@@ -29,12 +29,12 @@
   LinkedObjectFile dll(filename,true);
 
   if (Base::debug)
-    cout << filename << ": " << endl;
+    std::cout << filename << ": " << std::endl;
 
   if (!dll.isLoaded())
     {
       if (Base::debug)
-        cout << "error: could not open file" << endl;
+        std::cout << "error: could not open file" << std::endl;
       SetLastError(ERROR_FILE_NOT_FOUND);
       return false;
     }
@@ -42,7 +42,7 @@
   if (!dll.fixRelocations())
     {
       if (Base::debug)
-        cout << "error: could not fix relocation problems" << endl;
+        std::cout << "error: could not fix relocation problems" << std::endl;
       SetLastError(ERROR_INVALID_DATA);
       return false;
     }
Index: getimageinfos.cc
===================================================================
RCS file: /cvsroot/kde-cygwin/tools/rebase/getimageinfos.cc,v
retrieving revision 1.4
diff -u -r1.4 getimageinfos.cc
--- getimageinfos.cc	31 Dec 2002 18:33:14 -0000	1.4
+++ getimageinfos.cc	31 Dec 2002 18:54:06 -0000
@@ -34,7 +34,7 @@
   if (!dll.isLoaded())
     {
       if (Base::debug)
-        std::cout << "error: could not open file" << endl;
+        std::cout << "error: could not open file" << std::endl;
       SetLastError(ERROR_FILE_NOT_FOUND);
       return false;
     }
@@ -43,7 +43,7 @@
   *ImageSize = dll.getNTHeader()->OptionalHeader.SizeOfImage;
 
   if (Base::debug)
-    std::cout << "ImageBase: 0x" << hex << *ImageBase << " ImageSize: 0x" << *ImageSize << endl;
+    std::cout << "ImageBase: 0x" << std::hex << *ImageBase << " ImageSize: 0x" << *ImageSize << std::endl;
 
   SetLastError(NO_ERROR);
   return true;
Index: rebaseimage.cc
===================================================================
RCS file: /cvsroot/kde-cygwin/tools/rebase/rebaseimage.cc,v
retrieving revision 1.2
diff -u -r1.2 rebaseimage.cc
--- rebaseimage.cc	31 Dec 2002 12:56:48 -0000	1.2
+++ rebaseimage.cc	31 Dec 2002 18:54:07 -0000
@@ -54,7 +54,7 @@
   if (!dll.checkRelocations())
     {
       if (Base::debug)
-        cout << "error: dll relocation errors - please fix the errors at first" << endl;
+        std::cout << "error: dll relocation errors - please fix the errors at first" << std::endl;
       SetLastError(ERROR_INVALID_DATA);
       return false;
     }
@@ -84,7 +84,7 @@
   if (ntheader->OptionalHeader.ImageBase == *NewImageBase)
     {
       if (Base::debug)
-        cout << "dll is already rebased" << endl;
+        std::cout << "dll is already rebased" << std::endl;
       SetLastError(NO_ERROR);
       return true;
     }
@@ -97,7 +97,7 @@
   if (!dll.performRelocation(difference))
     {
       if (Base::debug)
-        cout << "error: could not rebase image" << endl;
+        std::cout << "error: could not rebase image" << std::endl;
       SetLastError(ERROR_BAD_FORMAT);
       return false;
     }
Index: rebind_main.cc
===================================================================
RCS file: /cvsroot/kde-cygwin/tools/rebase/rebind_main.cc,v
retrieving revision 1.3
diff -u -r1.3 rebind_main.cc
--- rebind_main.cc	31 Dec 2002 18:33:14 -0000	1.3
+++ rebind_main.cc	31 Dec 2002 18:54:08 -0000
@@ -61,7 +61,7 @@
       char *a = argv[i];
       char *b = NULL;
       char *c = NULL;
-      LinkedObjectFile dll(argv[1]);
+      LinkedObjectFile dll(argv[i]);
       // FIXME: add this stuff
       // dll.checkRelocations();
       // dll.fixRelocations();
Index: unbind_main.cc
===================================================================
RCS file: /cvsroot/kde-cygwin/tools/rebase/unbind_main.cc,v
retrieving revision 1.4
diff -u -r1.4 unbind_main.cc
--- unbind_main.cc	31 Dec 2002 18:33:14 -0000	1.4
+++ unbind_main.cc	31 Dec 2002 18:54:08 -0000
@@ -30,6 +30,8 @@
 
 #include "objectfile.h"
 
+using namespace std;
+
 char *Win32Path(char *s);
 void Usage();
 int fVerbose = 1;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]