[cmake-commits] hoffman committed cmFileCommand.cxx 1.98 1.99 cmFileCommand.h 1.33 1.34

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Feb 7 13:26:18 EST 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv7647

Modified Files:
	cmFileCommand.cxx cmFileCommand.h 
Log Message:
ENH: make sure files are binary for download and make status a pair of value string


Index: cmFileCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- cmFileCommand.h	6 Feb 2008 14:35:02 -0000	1.33
+++ cmFileCommand.h	7 Feb 2008 18:26:16 -0000	1.34
@@ -150,7 +150,11 @@
       "DOWNLOAD will download the givin URL to the given file. "
       "If LOG var is specified a log of the download will be put in var. "
       "If STATUS var is specified the status of the operation will"
-      " be put in var. If TIMEOUT time is specified, the operation will "
+      " be put in var. The status is returned in a list of length 2. "
+      "The first element is the numeric return value for the operation, "
+      "and the second element is a string value for the error. A 0 "
+      "numeric error means no error in the operation. "
+      "If TIMEOUT time is specified, the operation will "
       "timeout after time seconds, time can be specified as a float.\n";
     }
 

Index: cmFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.cxx,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- cmFileCommand.cxx	6 Feb 2008 14:46:58 -0000	1.98
+++ cmFileCommand.cxx	7 Feb 2008 18:26:16 -0000	1.99
@@ -1970,7 +1970,7 @@
       }
     i++;
     }
-  std::ofstream fout(file.c_str());
+  std::ofstream fout(file.c_str(), std::ios::binary);
   if(!fout)
     {
     this->SetError("FILE(DOWNLOAD url file TIMEOUT time) can not open "
@@ -2008,8 +2008,10 @@
   curl_easy_cleanup(curl);
   if(statusVar.size())
     {
-    this->Makefile->AddDefinition(statusVar.c_str(),
-                                  curl_easy_strerror(res));
+    cmOStringStream result;
+    result << (int)res << ";\"" << curl_easy_strerror(res) << "\"";
+    this->Makefile->AddDefinition(statusVar.c_str(), 
+                                  result.str().c_str());
     }
   curl_global_cleanup();
   if(chunkDebug.size())



More information about the Cmake-commits mailing list