~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/internal/my_copy.cc

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
 
 
16
 
#include "mysys_priv.h"
17
 
#include <my_dir.h> /* for stat */
18
 
#include <mystrings/m_string.h>
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
15
 
 
16
#include <config.h>
 
17
 
 
18
#include <drizzled/internal/my_sys.h>
 
19
 
 
20
#include <fcntl.h>
 
21
 
 
22
#include <drizzled/internal/m_string.h>
19
23
#if defined(HAVE_UTIME_H)
20
24
#include <utime.h>
21
25
#elif defined(HAVE_SYS_UTIME_H)
28
32
};
29
33
#endif
30
34
 
 
35
#ifdef HAVE_SYS_STAT_H
 
36
# include <sys/stat.h>
 
37
#endif
 
38
 
31
39
#include <drizzled/util/test.h>
32
40
 
 
41
namespace drizzled
 
42
{
 
43
namespace internal
 
44
{
 
45
 
33
46
/*
34
47
  int my_copy(const char *from, const char *to, myf MyFlags)
35
48
 
54
67
  uint32_t Count;
55
68
  bool new_file_stat= 0; /* 1 if we could stat "to" */
56
69
  int create_flag;
57
 
  File from_file,to_file;
 
70
  int from_file,to_file;
58
71
  unsigned char buff[IO_SIZE];
59
72
  struct stat stat_buff,new_stat_buff;
60
73
 
67
80
  {
68
81
    if (stat(from, &stat_buff))
69
82
    {
70
 
      my_errno=errno;
 
83
      errno=errno;
71
84
      goto err;
72
85
    }
73
86
    if (MyFlags & MY_HOLD_ORIGINAL_MODES && new_file_stat)
79
92
                             MyFlags)) < 0)
80
93
      goto err;
81
94
 
82
 
    while ((Count=my_read(from_file, buff, sizeof(buff), MyFlags)) != 0)
 
95
    while ((Count= static_cast<uint32_t>(my_read(from_file, buff,
 
96
            sizeof(buff), MyFlags))) != 0)
83
97
    {
84
 
        if (Count == (uint) -1 ||
 
98
        if (Count == (uint32_t) -1 ||
85
99
            my_write(to_file,buff,Count,MYF(MyFlags | MY_NABP)))
86
100
        goto err;
87
101
    }
116
130
  }
117
131
  return(-1);
118
132
} /* my_copy */
 
133
 
 
134
} /* namespace internal */
 
135
} /* namespace drizzled */