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
97309dd0
Commit
97309dd0
authored
Jul 19, 2013
by
Ben Straub
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1726 from crazymaster/development
git_buf_text_gather_stats doesn't work for multi-byte characters
parents
847b8e0e
d0b25d9d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
src/buf_text.c
+1
-1
tests-clar/object/blob/filter.c
+5
-2
No files found.
src/buf_text.c
View file @
97309dd0
...
...
@@ -262,7 +262,7 @@ bool git_buf_text_gather_stats(
while
(
scan
<
end
)
{
unsigned
char
c
=
*
scan
++
;
if
(
(
c
>
0x1F
&&
c
<
0x7F
)
||
c
>
0x9f
)
if
(
c
>
0x1F
&&
c
!=
0x7F
)
stats
->
printable
++
;
else
switch
(
c
)
{
case
'\0'
:
...
...
tests-clar/object/blob/filter.c
View file @
97309dd0
...
...
@@ -5,7 +5,7 @@
#include "buf_text.h"
static
git_repository
*
g_repo
=
NULL
;
#define NUM_TEST_OBJECTS
8
#define NUM_TEST_OBJECTS
9
static
git_oid
g_oids
[
NUM_TEST_OBJECTS
];
static
const
char
*
g_raw
[
NUM_TEST_OBJECTS
]
=
{
""
,
...
...
@@ -15,9 +15,10 @@ static const char *g_raw[NUM_TEST_OBJECTS] = {
"foo
\n
bar
\r
both
\r\n
reversed
\n\r
again
\n
problems
\r
"
,
"123
\n\000\001\002\003\004
abc
\255\254\253\r\n
"
,
"
\xEF\xBB\xBF
This is UTF-8
\n
"
,
"
\xEF\xBB\xBF\xE3\x81\xBB\xE3\x81\x92\xE3\x81\xBB\xE3\x81\x92\r\n\xE3\x81\xBB\xE3\x81\x92\xE3\x81\xBB\xE3\x81\x92\r\n
"
,
"
\xFE\xFF\x00
T
\x00
h
\x00
i
\x00
s
\x00
!"
};
static
git_off_t
g_len
[
NUM_TEST_OBJECTS
]
=
{
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
17
,
-
1
,
12
};
static
git_off_t
g_len
[
NUM_TEST_OBJECTS
]
=
{
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
17
,
-
1
,
-
1
,
12
};
static
git_buf_text_stats
g_stats
[
NUM_TEST_OBJECTS
]
=
{
{
0
,
0
,
0
,
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
2
,
0
,
6
,
0
},
...
...
@@ -26,6 +27,7 @@ static git_buf_text_stats g_stats[NUM_TEST_OBJECTS] = {
{
0
,
0
,
4
,
4
,
1
,
31
,
0
},
{
0
,
1
,
1
,
2
,
1
,
9
,
5
},
{
GIT_BOM_UTF8
,
0
,
0
,
1
,
0
,
16
,
0
},
{
GIT_BOM_UTF8
,
0
,
2
,
2
,
2
,
27
,
0
},
{
GIT_BOM_UTF16_BE
,
5
,
0
,
0
,
0
,
7
,
5
},
};
static
git_buf
g_crlf_filtered
[
NUM_TEST_OBJECTS
]
=
{
...
...
@@ -36,6 +38,7 @@ static git_buf g_crlf_filtered[NUM_TEST_OBJECTS] = {
{
"foo
\n
bar
\r
both
\n
reversed
\n\r
again
\n
problems
\r
"
,
0
,
38
},
{
"123
\n\000\001\002\003\004
abc
\255\254\253\n
"
,
0
,
16
},
{
"
\xEF\xBB\xBF
This is UTF-8
\n
"
,
0
,
17
},
{
"
\xEF\xBB\xBF\xE3\x81\xBB\xE3\x81\x92\xE3\x81\xBB\xE3\x81\x92\n\xE3\x81\xBB\xE3\x81\x92\xE3\x81\xBB\xE3\x81\x92\n
"
,
0
,
29
},
{
"
\xFE\xFF\x00
T
\x00
h
\x00
i
\x00
s
\x00
!"
,
0
,
12
}
};
...
...
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