Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
c6ebdb29
Commit
c6ebdb29
authored
Nov 22, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32: use GIT_ASSERT
parent
4f5f1127
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
19 deletions
+15
-19
src/unix/map.c
+1
-1
src/win32/findfile.c
+4
-2
src/win32/map.c
+1
-1
src/win32/path_w32.c
+1
-3
src/win32/precompiled.h
+0
-1
src/win32/thread.c
+5
-8
src/win32/w32_buffer.c
+3
-3
No files found.
src/unix/map.c
View file @
c6ebdb29
...
...
@@ -66,7 +66,7 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, off64_t offset
int
p_munmap
(
git_map
*
map
)
{
assert
(
map
!=
NULL
);
GIT_ASSERT_ARG
(
map
);
munmap
(
map
->
data
,
map
->
len
);
return
0
;
...
...
src/win32/findfile.c
View file @
c6ebdb29
...
...
@@ -53,7 +53,9 @@ static wchar_t* win32_walkpath(wchar_t *path, wchar_t *buf, size_t buflen)
{
wchar_t
term
,
*
base
=
path
;
assert
(
path
&&
buf
&&
buflen
);
GIT_ASSERT_ARG_WITH_RETVAL
(
path
,
NULL
);
GIT_ASSERT_ARG_WITH_RETVAL
(
buf
,
NULL
);
GIT_ASSERT_ARG_WITH_RETVAL
(
buflen
,
NULL
);
term
=
(
*
path
==
L'"'
)
?
*
path
++
:
L';'
;
...
...
@@ -109,7 +111,7 @@ static int win32_find_git_in_registry(
HKEY
hKey
;
int
error
=
GIT_ENOTFOUND
;
assert
(
buf
);
GIT_ASSERT_ARG
(
buf
);
if
(
!
RegOpenKeyExW
(
hive
,
key
,
0
,
KEY_READ
,
&
hKey
))
{
DWORD
dwType
,
cbData
;
...
...
src/win32/map.c
View file @
c6ebdb29
...
...
@@ -117,7 +117,7 @@ int p_munmap(git_map *map)
{
int
error
=
0
;
assert
(
map
!=
NULL
);
GIT_ASSERT_ARG
(
map
);
if
(
map
->
data
)
{
if
(
!
UnmapViewOfFile
(
map
->
data
))
{
...
...
src/win32/path_w32.c
View file @
c6ebdb29
...
...
@@ -492,14 +492,12 @@ size_t git_win32_path_remove_namespace(wchar_t *str, size_t len)
prefix_len
=
CONST_STRLEN
(
unc_prefix
);
}
if
(
remainder
)
{
/*
* Sanity check that the new string isn't longer than the old one.
* (This could only happen due to programmer error introducing a
* prefix longer than the namespace it replaces.)
*/
assert
(
len
>=
remainder_len
+
prefix_len
);
if
(
remainder
&&
len
>=
remainder_len
+
prefix_len
)
{
if
(
prefix
)
memmove
(
str
,
prefix
,
prefix_len
*
sizeof
(
wchar_t
));
...
...
src/win32/precompiled.h
View file @
c6ebdb29
#include "common.h"
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
...
...
src/win32/thread.c
View file @
c6ebdb29
...
...
@@ -94,10 +94,7 @@ int git_thread_join(
/* Check for the thread having exited uncleanly. If exit was unclean,
* then we don't have a return value to give back to the caller. */
if
(
exit
!=
CLEAN_THREAD_EXIT
)
{
assert
(
false
);
thread
->
result
=
NULL
;
}
GIT_ASSERT
(
exit
==
CLEAN_THREAD_EXIT
);
if
(
value_ptr
)
*
value_ptr
=
thread
->
result
;
...
...
@@ -149,7 +146,7 @@ int git_cond_init(git_cond *cond)
{
/* This is an auto-reset event. */
*
cond
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
assert
(
*
cond
);
GIT_ASSERT
(
*
cond
);
/* If we can't create the event, claim that the reason was out-of-memory.
* The actual reason can be fetched with GetLastError(). */
...
...
@@ -164,7 +161,7 @@ int git_cond_free(git_cond *cond)
return
EINVAL
;
closed
=
CloseHandle
(
*
cond
);
assert
(
closed
);
GIT_ASSERT
(
closed
);
GIT_UNUSED
(
closed
);
*
cond
=
NULL
;
...
...
@@ -186,7 +183,7 @@ int git_cond_wait(git_cond *cond, git_mutex *mutex)
return
error
;
wait_result
=
WaitForSingleObject
(
*
cond
,
INFINITE
);
assert
(
WAIT_OBJECT_0
==
wait_result
);
GIT_ASSERT
(
WAIT_OBJECT_0
==
wait_result
);
GIT_UNUSED
(
wait_result
);
return
git_mutex_lock
(
mutex
);
...
...
@@ -200,7 +197,7 @@ int git_cond_signal(git_cond *cond)
return
EINVAL
;
signaled
=
SetEvent
(
*
cond
);
assert
(
signaled
);
GIT_ASSERT
(
signaled
);
GIT_UNUSED
(
signaled
);
return
0
;
...
...
src/win32/w32_buffer.c
View file @
c6ebdb29
...
...
@@ -32,13 +32,13 @@ int git_buf_put_w(git_buf *buf, const wchar_t *string_w, size_t len_w)
return
-
1
;
}
assert
(
string_w
);
GIT_ASSERT
(
string_w
);
/* Measure the string necessary for conversion */
if
((
utf8_len
=
WideCharToMultiByte
(
CP_UTF8
,
WC_ERR_INVALID_CHARS
,
string_w
,
(
int
)
len_w
,
NULL
,
0
,
NULL
,
NULL
))
==
0
)
return
0
;
assert
(
utf8_len
>
0
);
GIT_ASSERT
(
utf8_len
>
0
);
GIT_ERROR_CHECK_ALLOC_ADD
(
&
new_size
,
buf
->
size
,
(
size_t
)
utf8_len
);
GIT_ERROR_CHECK_ALLOC_ADD
(
&
new_size
,
new_size
,
1
);
...
...
@@ -50,7 +50,7 @@ int git_buf_put_w(git_buf *buf, const wchar_t *string_w, size_t len_w)
CP_UTF8
,
WC_ERR_INVALID_CHARS
,
string_w
,
(
int
)
len_w
,
&
buf
->
ptr
[
buf
->
size
],
utf8_len
,
NULL
,
NULL
))
==
0
)
return
handle_wc_error
();
assert
(
utf8_write_len
==
utf8_len
);
GIT_ASSERT
(
utf8_write_len
==
utf8_len
);
buf
->
size
+=
utf8_write_len
;
buf
->
ptr
[
buf
->
size
]
=
'\0'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment