summaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.c
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-06 12:43:39 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-06 12:43:39 +0000
commit6a85c251311bcd39c5e83c9d41a392f35cbf4f14 (patch)
treef3bf018f81dee2549add1a7bdde000898d559e9c /gcc/ada/adaint.c
parent6d94f7f95e910dce941a0f4bed322c16d3718b44 (diff)
downloadgcc-6a85c251311bcd39c5e83c9d41a392f35cbf4f14.tar.gz
2009-05-06 Sergey Rybin <rybin@adacore.com>
* gnat_ugn.texi: Add subsection for Exits_From_Conditional_Loops rule Add formal definition for extra exit point metric 2009-05-06 Pascal Obry <obry@adacore.com> * adaint.c: Support for setting attributes on unicode filename on Windows. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147171 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r--gcc/ada/adaint.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 83da18b4e5b..1f5e1546796 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -3369,6 +3369,63 @@ __gnat_copy_attribs (char *from, char *to, int mode)
{
#if defined (VMS) || defined (__vxworks) || defined (__nucleus__)
return -1;
+
+#elif defined (_WIN32) && !defined (RTX)
+ TCHAR wfrom [GNAT_MAX_PATH_LEN + 2];
+ TCHAR wto [GNAT_MAX_PATH_LEN + 2];
+ BOOL res;
+ FILETIME fct, flat, flwt;
+ HANDLE hfrom, hto;
+
+ S2WSC (wfrom, from, GNAT_MAX_PATH_LEN + 2);
+ S2WSC (wto, to, GNAT_MAX_PATH_LEN + 2);
+
+ /* retrieve from times */
+
+ hfrom = CreateFile
+ (wfrom, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+
+ if (hfrom == INVALID_HANDLE_VALUE)
+ return -1;
+
+ res = GetFileTime (hfrom, &fct, &flat, &flwt);
+
+ CloseHandle (hfrom);
+
+ if (res == 0)
+ return -1;
+
+ /* retrieve from times */
+
+ hto = CreateFile
+ (wto, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+
+ if (hto == INVALID_HANDLE_VALUE)
+ return -1;
+
+ res = SetFileTime (hto, NULL, &flat, &flwt);
+
+ CloseHandle (hto);
+
+ if (res == 0)
+ return -1;
+
+ /* Set file attributes in full mode. */
+
+ if (mode == 1)
+ {
+ DWORD attribs = GetFileAttributes (wfrom);
+
+ if (attribs == INVALID_FILE_ATTRIBUTES)
+ return -1;
+
+ res = SetFileAttributes (wto, attribs);
+ if (res == 0)
+ return -1;
+ }
+
+ return 0;
+
#else
struct stat fbuf;
struct utimbuf tbuf;