text
stringlengths
0
357
old2? old2 : "");
}
free(param->packed);
param->packed = new1;
}
/**
* Set parameter to an integer.
*
* @memberof dc_param_t
* @param param Parameter object to modify.
* @param key Key of the parameter to modify, one of the DC_PARAM_* constants.
* @param value Value to store for key.
* @return None.
*/
void dc_param_set_int(dc_param_t* param, int key, int32_t value)
{
if (param==NULL || key==0) {
return;
}
char* value_str = dc_mprintf("%i", (int)value);
if (value_str==NULL) {
return;
}
dc_param_set(param, key, value_str);
free(value_str);
}
/**
* Set parameter to a float.
*
* @memberof dc_param_t
* @param param Parameter object to modify.
* @param key Key of the parameter to modify, one of the DC_PARAM_* constants.
* @param value Value to store for key.
* @return None.
*/
void dc_param_set_float(dc_param_t* param, int key, double value)
{
if (param==NULL || key==0) {
return;
}
char* value_str = dc_ftoa(value);
if (value_str==NULL) {
return;
}
dc_param_set(param, key, value_str);
free(value_str);
}
```
Filename: dc_pgp.c
```c
/* End-to-end-encryption and other cryptographic functions based upon OpenSSL
and BSD's netpgp.
If we want to switch to other encryption engines, here are the functions to
be replaced.
However, eg. GpgME cannot (easily) be used standalone and GnuPG's licence
would not allow the original creator of Delta Chat to release a proprietary
version, which, however, is required for the Apple store. (NB: the original
creator is the only person who could do this, a normal licensee is not
allowed to do so at all)
So, we do not see a simple alternative - but everyone is welcome to implement
one :-) */
#include "dc_context.h"
#ifdef DC_USE_RPGP
#include <librpgp.h>
#else
#include <netpgp-extra.h>
#include <openssl/rand.h>
#endif
#include "dc_key.h"
#include "dc_keyring.h"
#include "dc_pgp.h"
#include "dc_hash.h"
#ifdef DC_USE_RPGP
void dc_pgp_init(void)
{
}
#else // !DC_USE_RPGP
static int s_io_initialized = 0;
static pgp_io_t s_io;