Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
2e086ee4
Commit
2e086ee4
authored
Jun 28, 2016
by
Sylvain Berfini
🐮
Browse files
Fix iconv conversion from UTF8 to UTF8 on Android and possibly others
parent
297f63c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
15 deletions
+23
-15
coreapi/message_storage.c
coreapi/message_storage.c
+11
-7
coreapi/sqlite3_bctbx_vfs.c
coreapi/sqlite3_bctbx_vfs.c
+12
-8
No files found.
coreapi/message_storage.c
View file @
2e086ee4
...
...
@@ -58,13 +58,17 @@ static char *utf8_convert(const char *filename){
size_t
inbyteleft
=
MAX_PATH_SIZE
,
outbyteleft
=
MAX_PATH_SIZE
;
iconv_t
cb
;
strncpy
(
db_file_locale
,
filename
,
MAX_PATH_SIZE
-
1
);
cb
=
iconv_open
(
"UTF-8"
,
nl_langinfo
(
CODESET
));
if
(
cb
!=
(
iconv_t
)
-
1
)
{
int
ret
;
ret
=
iconv
(
cb
,
&
inbuf
,
&
inbyteleft
,
&
outbuf
,
&
outbyteleft
);
if
(
ret
==
-
1
)
db_file_utf8
[
0
]
=
'\0'
;
iconv_close
(
cb
);
if
(
strcasecmp
(
"UTF-8"
,
nl_langinfo
(
CODESET
))
==
0
)
{
strncpy
(
db_file_utf8
,
filename
,
MAX_PATH_SIZE
-
1
);
}
else
{
strncpy
(
db_file_locale
,
filename
,
MAX_PATH_SIZE
-
1
);
cb
=
iconv_open
(
"UTF-8"
,
nl_langinfo
(
CODESET
));
if
(
cb
!=
(
iconv_t
)
-
1
)
{
int
ret
;
ret
=
iconv
(
cb
,
&
inbuf
,
&
inbyteleft
,
&
outbuf
,
&
outbyteleft
);
if
(
ret
==
-
1
)
db_file_utf8
[
0
]
=
'\0'
;
iconv_close
(
cb
);
}
}
#endif
return
ms_strdup
(
db_file_utf8
);
...
...
coreapi/sqlite3_bctbx_vfs.c
View file @
2e086ee4
...
...
@@ -260,7 +260,7 @@ static char* ConvertFromUtf8Filename(const char* fName){
bctbx_free
(
wideFilename
);
return
convertedFilename
;
#elif defined(__QNXNTO__)
return
bctbx_strdup
(
fName
);
return
bctbx_strdup
(
fName
);
#else
#define MAX_PATH_SIZE 1024
char
db_file_utf8
[
MAX_PATH_SIZE
]
=
{
'\0'
};
...
...
@@ -269,13 +269,17 @@ static char* ConvertFromUtf8Filename(const char* fName){
size_t
inbyteleft
=
MAX_PATH_SIZE
,
outbyteleft
=
MAX_PATH_SIZE
;
iconv_t
cb
;
strncpy
(
db_file_utf8
,
fName
,
MAX_PATH_SIZE
-
1
);
cb
=
iconv_open
(
nl_langinfo
(
CODESET
),
"UTF-8"
);
if
(
cb
!=
(
iconv_t
)
-
1
)
{
int
ret
;
ret
=
iconv
(
cb
,
&
inbuf
,
&
inbyteleft
,
&
outbuf
,
&
outbyteleft
);
if
(
ret
==
-
1
)
db_file_locale
[
0
]
=
'\0'
;
iconv_close
(
cb
);
if
(
strcasecmp
(
"UTF-8"
,
nl_langinfo
(
CODESET
))
==
0
)
{
strncpy
(
db_file_locale
,
fName
,
MAX_PATH_SIZE
-
1
);
}
else
{
strncpy
(
db_file_utf8
,
fName
,
MAX_PATH_SIZE
-
1
);
cb
=
iconv_open
(
nl_langinfo
(
CODESET
),
"UTF-8"
);
if
(
cb
!=
(
iconv_t
)
-
1
)
{
int
ret
;
ret
=
iconv
(
cb
,
&
inbuf
,
&
inbyteleft
,
&
outbuf
,
&
outbyteleft
);
if
(
ret
==
-
1
)
db_file_locale
[
0
]
=
'\0'
;
iconv_close
(
cb
);
}
}
return
bctbx_strdup
(
db_file_locale
);
#endif
...
...
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