Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bynect committed Jan 13, 2021
1 parent d3f36f5 commit fd3baf6
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 29 deletions.
3 changes: 2 additions & 1 deletion partials/libbson/Bcon.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public BconType BCON_DATE_TIME (int64 val);
[CCode (cname = "BCON_NULL")]
public BconType BCON_NULL ();

//FIXME
[CCode (cname = "BCON_REGEX")]
public BconType BCON_REGEX (string regex, string flags);//FIXME
public BconType BCON_REGEX (string regex, string flags);

[CCode (cname = "BCON_DBPOINTER")]
public BconType BCON_DBPOINTER (Collection coll, BsonOid oid);
Expand Down
13 changes: 10 additions & 3 deletions partials/libbson/Bson.vapi
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@

/**
* bson_realloc_func
*/

[CCode (cname = "bson_realloc_func", simple_generics = true)]
public delegate T? ReallocFunc<T, C> (T? mem, size_t num_bytes, C? ctx);

/**
* bson_t
*/
Expand All @@ -11,9 +18,9 @@ public class Bson {
[CCode (cname = "bson_new")]
public Bson ();

//FIXME
// [CCode (cname = "bson_new_from_buffer")]
// public Bson.from_buffer (ref uint8 buf, size_t buf_len, ReallocFunc func);
//FIXME: Array or pointer for the buffer?
[CCode (cname = "bson_new_from_buffer")]
public Bson.from_buffer (ref uint8 buf, size_t buf_len, ReallocFunc func);

[CCode (cname = "bson_new_from_data")]
public Bson.from_data (uint8 data, size_t length);
Expand Down
10 changes: 4 additions & 6 deletions partials/libbson/BsonString.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ public struct BsonUnichar {
* Various chars and string methods
*/

//FIXME
// [CCode (cname = "bson_ascii_strtoll")]
// public int64 ascii_strtoll (string str, ref char? endptr, int base);
[CCode (cname = "bson_ascii_strtoll")]
public int64 ascii_strtoll (string str, out string? endptr, int _base);

[CCode (cname = "bson_isspace")]
public bool is_space (char c);
Expand Down Expand Up @@ -80,9 +79,8 @@ public void strndup (string str, size_t size);
[CCode (cname = "bson_strnlen")]
public size_t strnlen (string dst, size_t max);

//FIXME
// [CCode (cname = "bson_uint32_to_string")]
// public size_t uint32_to_string (uint32 value, ref string strptr, string str, size_t size);
[CCode (cname = "bson_uint32_to_string")]
public size_t uint32_to_string (uint32 value, out string strptr, string str, size_t size);

[CCode (cname = "bson_utf8_escape_for_json")]
public string utf8_escape_for_json (string utf8, ssize_t utf8_len);
Expand Down
6 changes: 3 additions & 3 deletions partials/libmongoc/Client.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public class Client {
[CCode (cname = "mongoc_client_get_server_description")]
public ServerDescription get_server_description (uint32 server_id);

//FIXME
[CCode (cname = "mongoc_client_get_server_descriptions", array_length_type = "size_t")]
public ServerDescription[] get_server_descriptions (size_t n);
//FIXME: Fix array length
[CCode (cname = "mongoc_client_get_server_descriptions", array_length_pos = 1, array_length_type = "size_t")]
public ServerDescription[] get_server_descriptions ();

[CCode (cname = "mongoc_client_get_server_status")]
public bool get_server_status (ReadPrefs read_prefs, Bson reply, BsonError? error);
Expand Down
21 changes: 10 additions & 11 deletions partials/libmongoc/ClientPool.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,34 @@ public class ClientPool {
public ClientPool (Uri uri);

//Methods
[CCode (cname = "client_pool_enable_auto_encryption")]
[CCode (cname = "mongoc_client_pool_enable_auto_encryption")]
public bool enable_auto_encryption (Bson? opts, BsonError? error);

[CCode (cname = "client_pool_max_size")]
[CCode (cname = "mongoc_client_pool_max_size")]
public void max_size (uint32 max_pool_size);

[CCode (cname = "client_pool_min_size")]
[CCode (cname = "mongoc_client_pool_min_size")]
public void min_size (uint32 min_pool_size);

[CCode (cname = "client_pool_pop")]
[CCode (cname = "mongoc_client_pool_pop")]
public Client pop ();

[CCode (cname = "client_pool_push")]
[CCode (cname = "mongoc_client_pool_push")]
public void push (Client client);

[CCode (cname = "client_pool_set_apm_callbacks", simple_generics = true)]
[CCode (cname = "mongoc_client_pool_set_apm_callbacks", simple_generics = true)]
public bool set_apm_callbacks<T> (APMCallbacks callbacks, T? context = null);

[CCode (cname = "client_pool_set_appname")]
[CCode (cname = "mongoc_client_pool_set_appname")]
public bool set_appname (string name);

[CCode (cname = "client_pool_set_error_api")]
[CCode (cname = "mongoc_client_pool_set_error_api")]
public bool set_error_api (int32 version);

//XXX
[CCode (cname = "client_pool_set_ssl_opts")]
[CCode (cname = "mongoc_client_pool_set_ssl_opts")]
public void set_ssl_opts (SSLOpts opts);

[CCode (cname = "client_pool_try_pop")]
[CCode (cname = "mongoc_client_pool_try_pop")]
public Client? try_pop ();

}
15 changes: 14 additions & 1 deletion partials/libmongoc/Opts.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,20 @@ public class SessionOpt {
[CCode (cname = "mongoc_ssl_opt_t")]
public struct SSLOpts {

//FIXME
public const string pem_file;

public const string pem_pwd;

public const string ca_file;

public const string ca_dir;

public const string crl_file;

public bool weak_cert_validation;

public bool allow_invalid_hostname;

[CCode (cname = "mongoc_ssl_opt_get_default")]
public static SSLOpts get_default ();

Expand Down
8 changes: 4 additions & 4 deletions partials/libmongoc/Stream.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
[Compact]
public class Stream {

//Methods
//Constructions
//FIXME
[CCode (cname = "mongoc_stream_buffered_new")]
public Stream (Stream base_stream, size_t buffer);

//Methods
[CCode (cname = "mongoc_stream_close")]
public int close ();

Expand Down Expand Up @@ -59,9 +60,9 @@ public class Stream {
public class ChangeStream {

//Methods
//FIXME: bson must be location reference
//FIXME: needs a bson reference
[CCode (cname = "mongoc_change_stream_next")]
public bool next (Bson bson);
public bool next (ref Bson bson);

[CCode (cname = "mongoc_change_stream_next")]
public Bson? get_resume_token (ChangeStream stream);
Expand Down Expand Up @@ -98,7 +99,6 @@ public struct StreamFile {
[CCode (cname = "mongoc_stream_file_new_for_path")]
public static Stream? new_for_path (string path, int flags, int mode);

//FIXME
[CCode (cname = "mongoc_stream_file_get_fd")]
public int get_fd ();

Expand Down

0 comments on commit fd3baf6

Please sign in to comment.