~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_walkdirs_win32.pyx

  • Committer: Vincent Ladeuil
  • Date: 2010-01-25 15:55:48 UTC
  • mto: (4985.1.4 add-attr-cleanup)
  • mto: This revision was merged to the branch mainline in revision 4988.
  • Revision ID: v.ladeuil+lp@free.fr-20100125155548-0l352pujvt5bzl5e
Deploy addAttrCleanup on the whole test suite.

Several use case worth mentioning:

- setting a module or any other object attribute is the majority
by far. In some cases the setting itself is deferred but most of
the time we want to set at the same time we add the cleanup.

- there multiple occurrences of protecting hooks or ui factory
which are now useless (the test framework takes care of that now),

- there was some lambda uses that can now be avoided.

That first cleanup already simplifies things a lot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
                                 wcslen(data.cFileName))
110
110
 
111
111
 
112
 
cdef int _get_mode_bits(WIN32_FIND_DATAW *data):
 
112
cdef int _get_mode_bits(WIN32_FIND_DATAW *data): # cannot_raise
113
113
    cdef int mode_bits
114
114
 
115
115
    mode_bits = 0100666 # writeable file, the most common
121
121
    return mode_bits
122
122
 
123
123
 
124
 
cdef __int64 _get_size(WIN32_FIND_DATAW *data):
 
124
cdef __int64 _get_size(WIN32_FIND_DATAW *data): # cannot_raise
125
125
    # Pyrex casts a DWORD into a PyLong anyway, so it is safe to do << 32
126
126
    # on a DWORD
127
127
    return ((<__int64>data.nFileSizeHigh) << 32) + data.nFileSizeLow
128
128
 
129
129
 
130
 
cdef double _ftime_to_timestamp(FILETIME *ft):
 
130
cdef double _ftime_to_timestamp(FILETIME *ft): # cannot_raise
131
131
    """Convert from a FILETIME struct into a floating point timestamp.
132
132
 
133
133
    The fields of a FILETIME structure are the hi and lo part
147
147
    return (val * 1.0e-7) - 11644473600.0
148
148
 
149
149
 
150
 
cdef int _should_skip(WIN32_FIND_DATAW *data):
 
150
cdef int _should_skip(WIN32_FIND_DATAW *data): # cannot_raise
151
151
    """Is this '.' or '..' so we should skip it?"""
152
152
    if (data.cFileName[0] != c'.'):
153
153
        return 0