summaryrefslogtreecommitdiff
path: root/plugins/MirOTR/libotr/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-02-28 20:00:53 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-02-28 20:00:53 +0300
commit2e9d13165b4fd765d95f88d26282be022e708b0d (patch)
treed9b65c84d86a5c1c74dbd944c08350c0c781dc95 /plugins/MirOTR/libotr/src
parent62116c7d1c0d4def03c0331688a63ee6144f8363 (diff)
MirOTR:
- fix for Unicode file names; - fix for reading utf8 strings from Windows GUI; - contact_get_id: unused second parameter removed; - contact_get_id: result is encoded in utf8, thus preventing from errors;
Diffstat (limited to 'plugins/MirOTR/libotr/src')
-rw-r--r--plugins/MirOTR/libotr/src/instag.c12
-rw-r--r--plugins/MirOTR/libotr/src/instag.h6
-rw-r--r--plugins/MirOTR/libotr/src/privkey.c20
-rw-r--r--plugins/MirOTR/libotr/src/privkey.h10
4 files changed, 24 insertions, 24 deletions
diff --git a/plugins/MirOTR/libotr/src/instag.c b/plugins/MirOTR/libotr/src/instag.c
index a1142239a4..602e6c5fa9 100644
--- a/plugins/MirOTR/libotr/src/instag.c
+++ b/plugins/MirOTR/libotr/src/instag.c
@@ -70,13 +70,13 @@ OtrlInsTag * otrl_instag_find(OtrlUserState us, const char *accountname,
/* Read our instance tag from a file on disk into the given
* OtrlUserState. */
-gcry_error_t otrl_instag_read(OtrlUserState us, const char *filename)
+gcry_error_t otrl_instag_read(OtrlUserState us, const wchar_t *filename)
{
gcry_error_t err;
FILE *instf;
/* Open the instance tag file. */
- instf = fopen(filename, "rb");
+ instf = _wfopen(filename, L"rb");
if (!instf) {
return gcry_error_from_errno(errno);
}
@@ -183,14 +183,14 @@ gcry_error_t otrl_instag_read_FILEp(OtrlUserState us, FILE *instf)
}
/* Generate a new instance tag for the given account and write to file */
-gcry_error_t otrl_instag_generate(OtrlUserState us, const char *filename,
+gcry_error_t otrl_instag_generate(OtrlUserState us, const wchar_t *filename,
const char *accountname, const char *protocol)
{
gcry_error_t err;
FILE *instf;
/* Open the instance tag file. */
- instf = fopen(filename, "wb");
+ instf = _wfopen(filename, L"wb");
if (!instf) {
return gcry_error_from_errno(errno);
}
@@ -243,13 +243,13 @@ gcry_error_t otrl_instag_generate_FILEp(OtrlUserState us, FILE *instf,
}
/* Write our instance tags to a file on disk. */
-gcry_error_t otrl_instag_write(OtrlUserState us, const char *filename)
+gcry_error_t otrl_instag_write(OtrlUserState us, const wchar_t *filename)
{
gcry_error_t err;
FILE *instf;
/* Open the instance tag file. */
- instf = fopen(filename, "wb");
+ instf = _wfopen(filename, L"wb");
if (!instf) {
return gcry_error_from_errno(errno);
}
diff --git a/plugins/MirOTR/libotr/src/instag.h b/plugins/MirOTR/libotr/src/instag.h
index c8aabb324f..e5524aa63c 100644
--- a/plugins/MirOTR/libotr/src/instag.h
+++ b/plugins/MirOTR/libotr/src/instag.h
@@ -61,7 +61,7 @@ OtrlInsTag * otrl_instag_find(OtrlUserState us, const char *accountname,
/* Read our instance tag from a file on disk into the given
* OtrlUserState. */
-gcry_error_t otrl_instag_read(OtrlUserState us, const char *filename);
+gcry_error_t otrl_instag_read(OtrlUserState us, const wchar_t *filename);
/* Read our instance tag from a file on disk into the given
* OtrlUserState. The FILE* must be open for reading. */
@@ -71,7 +71,7 @@ gcry_error_t otrl_instag_read_FILEp(OtrlUserState us, FILE *instf);
otrl_instag_t otrl_instag_get_new();
/* Get a new instance tag for the given account and write to file*/
-gcry_error_t otrl_instag_generate(OtrlUserState us, const char *filename,
+gcry_error_t otrl_instag_generate(OtrlUserState us, const wchar_t *filename,
const char *accountname, const char *protocol);
/* Get a new instance tag for the given account and write to file
@@ -80,7 +80,7 @@ gcry_error_t otrl_instag_generate_FILEp(OtrlUserState us, FILE *instf,
const char *accountname, const char *protocol);
/* Write our instance tags to a file on disk. */
-gcry_error_t otrl_instag_write(OtrlUserState us, const char *filename);
+gcry_error_t otrl_instag_write(OtrlUserState us, const wchar_t *filename);
/* Write our instance tags to a file on disk.
* The FILE* must be open for writing. */
diff --git a/plugins/MirOTR/libotr/src/privkey.c b/plugins/MirOTR/libotr/src/privkey.c
index 6e4bbe40fc..d6890f48d5 100644
--- a/plugins/MirOTR/libotr/src/privkey.c
+++ b/plugins/MirOTR/libotr/src/privkey.c
@@ -177,7 +177,7 @@ static gcry_error_t make_pubkey(unsigned char **pubbufp, size_t *publenp,
/* Read a sets of private DSA keys from a file on disk into the given
* OtrlUserState. */
-gcry_error_t otrl_privkey_read(OtrlUserState us, const char *filename)
+gcry_error_t otrl_privkey_read(OtrlUserState us, const wchar_t *filename)
{
FILE *privf;
gcry_error_t err;
@@ -185,7 +185,7 @@ gcry_error_t otrl_privkey_read(OtrlUserState us, const char *filename)
/* Open the privkey file. We use rb mode so that on WIN32, fread()
* reads the same number of bytes that fstat() indicates are in the
* file. */
- privf = fopen(filename, "rb");
+ privf = _wfopen(filename, L"rb");
if (!privf) {
err = gcry_error_from_errno(errno);
return err;
@@ -526,7 +526,7 @@ gcry_error_t otrl_privkey_generate_calculate(void *newkey)
return gcry_error(GPG_ERR_NO_ERROR);
}
-static FILE* privkey_fopen(const char *filename, gcry_error_t *errp)
+static FILE* privkey_fopen(const wchar_t *filename, gcry_error_t *errp)
{
FILE *privf;
#ifndef WIN32
@@ -536,7 +536,7 @@ static FILE* privkey_fopen(const char *filename, gcry_error_t *errp)
#ifndef WIN32
oldmask = umask(077);
#endif
- privf = fopen(filename, "w+b");
+ privf = _wfopen(filename, L"w+b");
if (!privf && errp) {
*errp = gcry_error_from_errno(errno);
}
@@ -568,7 +568,7 @@ void otrl_privkey_generate_cancelled(OtrlUserState us, void *newkey)
/* Call this from the main thread only. It will write the newly created
* private key into the given file and store it in the OtrlUserState. */
gcry_error_t otrl_privkey_generate_finish(OtrlUserState us,
- void *newkey, const char *filename)
+ void *newkey, const wchar_t *filename)
{
gcry_error_t err;
FILE *privf = privkey_fopen(filename, &err);
@@ -623,7 +623,7 @@ gcry_error_t otrl_privkey_generate_finish_FILEp(OtrlUserState us,
/* Generate a private DSA key for a given account, storing it into a
* file on disk, and loading it into the given OtrlUserState. Overwrite any
* previously generated keys for that account in that OtrlUserState. */
-gcry_error_t otrl_privkey_generate(OtrlUserState us, const char *filename,
+gcry_error_t otrl_privkey_generate(OtrlUserState us, const wchar_t *filename,
const char *accountname, const char *protocol)
{
gcry_error_t err;
@@ -670,14 +670,14 @@ static unsigned int ctoh(char c)
* OtrlUserState. Use add_app_data to add application data to each
* ConnContext so created. */
gcry_error_t otrl_privkey_read_fingerprints(OtrlUserState us,
- const char *filename,
+ const wchar_t*filename,
void (*add_app_data)(void *data, ConnContext *context),
void *data)
{
gcry_error_t err;
FILE *storef;
- storef = fopen(filename, "rb");
+ storef = _wfopen(filename, L"rb");
if (!storef) {
err = gcry_error_from_errno(errno);
return err;
@@ -765,12 +765,12 @@ gcry_error_t otrl_privkey_read_fingerprints_FILEp(OtrlUserState us,
/* Write the fingerprint store from a given OtrlUserState to a file on disk. */
gcry_error_t otrl_privkey_write_fingerprints(OtrlUserState us,
- const char *filename)
+ const wchar_t *filename)
{
gcry_error_t err;
FILE *storef;
- storef = fopen(filename, "wb");
+ storef = _wfopen(filename, L"wb");
if (!storef) {
err = gcry_error_from_errno(errno);
return err;
diff --git a/plugins/MirOTR/libotr/src/privkey.h b/plugins/MirOTR/libotr/src/privkey.h
index 3b2c1735e3..a3389d736d 100644
--- a/plugins/MirOTR/libotr/src/privkey.h
+++ b/plugins/MirOTR/libotr/src/privkey.h
@@ -49,7 +49,7 @@ unsigned char *otrl_privkey_fingerprint_raw(OtrlUserState us,
/* Read a sets of private DSA keys from a file on disk into the given
* OtrlUserState. */
-gcry_error_t otrl_privkey_read(OtrlUserState us, const char *filename);
+gcry_error_t otrl_privkey_read(OtrlUserState us, const wchar_t *filename);
/* Read a sets of private DSA keys from a FILE* into the given
* OtrlUserState. The FILE* must be open for reading. */
@@ -76,7 +76,7 @@ gcry_error_t otrl_privkey_generate_calculate(void *newkey);
/* Call this from the main thread only. It will write the newly created
* private key into the given file and store it in the OtrlUserState. */
gcry_error_t otrl_privkey_generate_finish(OtrlUserState us,
- void *newkey, const char *filename);
+ void *newkey, const wchar_t *filename);
/* Call this from the main thread only. It will write the newly created
* private key into the given FILE* (which must be open for reading and
@@ -92,7 +92,7 @@ void otrl_privkey_generate_cancelled(OtrlUserState us, void *newkey);
/* Generate a private DSA key for a given account, storing it into a
* file on disk, and loading it into the given OtrlUserState. Overwrite any
* previously generated keys for that account in that OtrlUserState. */
-gcry_error_t otrl_privkey_generate(OtrlUserState us, const char *filename,
+gcry_error_t otrl_privkey_generate(OtrlUserState us, const wchar_t *filename,
const char *accountname, const char *protocol);
/* Generate a private DSA key for a given account, storing it into a
@@ -106,7 +106,7 @@ gcry_error_t otrl_privkey_generate_FILEp(OtrlUserState us, FILE *privf,
* OtrlUserState. Use add_app_data to add application data to each
* ConnContext so created. */
gcry_error_t otrl_privkey_read_fingerprints(OtrlUserState us,
- const char *filename,
+ const wchar_t *filename,
void (*add_app_data)(void *data, ConnContext *context),
void *data);
@@ -120,7 +120,7 @@ gcry_error_t otrl_privkey_read_fingerprints_FILEp(OtrlUserState us,
/* Write the fingerprint store from a given OtrlUserState to a file on disk. */
gcry_error_t otrl_privkey_write_fingerprints(OtrlUserState us,
- const char *filename);
+ const wchar_t *filename);
/* Write the fingerprint store from a given OtrlUserState to a FILE*.
* The FILE* must be open for writing. */