-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathVersion.c
More file actions
82 lines (74 loc) · 1.62 KB
/
Version.c
File metadata and controls
82 lines (74 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* Copyright (C) 2013 Klaus Reimer (k@ailis.de)
* See LICENSE.md file for copying conditions
*/
#include "Version.h"
jobject wrapVersion(JNIEnv* env, const struct libusb_version* pointer)
{
return wrapPointer(env, pointer, CLASS_PATH("Version"), "versionPointer");
}
const struct libusb_version* unwrapVersion(JNIEnv* env, jobject version)
{
return (struct libusb_version *) unwrapPointer(env, version,
"versionPointer");
}
/**
* int major()
*/
JNIEXPORT jint JNICALL METHOD_NAME(Version, major)
(
JNIEnv *env, jobject this
)
{
const struct libusb_version *version = unwrapVersion(env, this);
if (!version) return 0;
return version->major;
}
/**
* int minor()
*/
JNIEXPORT jint JNICALL METHOD_NAME(Version, minor)
(
JNIEnv *env, jobject this
)
{
const struct libusb_version *version = unwrapVersion(env, this);
if (!version) return 0;
return version->minor;
}
/**
* int micro()
*/
JNIEXPORT jint JNICALL METHOD_NAME(Version, micro)
(
JNIEnv *env, jobject this
)
{
const struct libusb_version *version = unwrapVersion(env, this);
if (!version) return 0;
return version->micro;
}
/**
* int nano()
*/
JNIEXPORT jint JNICALL METHOD_NAME(Version, nano)
(
JNIEnv *env, jobject this
)
{
const struct libusb_version *version = unwrapVersion(env, this);
if (!version) return 0;
return version->nano;
}
/**
* String rc()
*/
JNIEXPORT jstring JNICALL METHOD_NAME(Version, rc)
(
JNIEnv *env, jobject this
)
{
const struct libusb_version *version = unwrapVersion(env, this);
if (!version) return NULL;
return (*env)->NewStringUTF(env, version->rc);
}