Skip to content

Commit

Permalink
Merge tag '5.9.0' into master-loongarch64-port
Browse files Browse the repository at this point in the history
  • Loading branch information
theaoqi committed Feb 23, 2022
2 parents 2220c06 + 107836a commit 4aea280
Show file tree
Hide file tree
Showing 68 changed files with 1,426 additions and 233 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ dist: trusty

language: java

# disable shallow clone
git:
depth: false

before_install:
- |
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)'
Expand All @@ -19,7 +15,7 @@ before_install:
- export PATH=$JAVA_HOME/bin:$PATH;

install:
- export APACHE_ANT_BASE=$(curl http://apache.mirror.iphh.net/ant/binaries/ | grep "apache-ant-1.9..*-bin.tar.gz" | tail -1 | sed 's/.*href="\(.*\)-bin.tar.gz".*/\1/g')
- export APACHE_ANT_BASE=$(curl http://apache.mirror.iphh.net/ant/binaries/ | grep "apache-ant-1.9..*-bin.tar.gz" | tail -1 | sed 's/.*href="\([^"]*\)-bin.tar.gz".*/\1/g')
- 'echo "Apache Ant ARCHIVE: $APACHE_ANT_BASE"'
- 'wget http://apache.mirror.iphh.net/ant/binaries/$APACHE_ANT_BASE-bin.tar.gz && tar xzf $APACHE_ANT_BASE-bin.tar.gz && sudo mv $APACHE_ANT_BASE /usr/local/$APACHE_ANT_BASE && sudo rm -f /usr/local/ant && sudo ln -s /usr/local/$APACHE_ANT_BASE /usr/local/ant && sudo ln -s /usr/local/$APACHE_ANT_BASE/bin/ant /usr/local/bin/ant || true'
- 'sudo apt-get -y install texinfo || true'
Expand Down
23 changes: 22 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@ NOTE: as of JNA 4.0, JNA is now dual-licensed under LGPL and AL 2.0 (see LICENSE

NOTE: JNI native support is typically incompatible between minor versions, and almost always incompatible between major versions.

Release 5.9.0
=============

Features
--------
* [#1336](https://github.com/java-native-access/jna/pull/1336): Add `HKEY_CURRENT_USER_LOCAL_SETTINGS` to `c.s.j.p.win32.WinReg` - [@Dani-Hub](https://github.com/Dani-Hub).
* [#1337](https://github.com/java-native-access/jna/pull/1337): Add `REG_NOTIFY_THREAD_AGNOSTIC` to `c.s.j.p.win32.WinNet` and update `REG_LEGAL_CHANGE_FILTER` - [@Dani-Hub](https://github.com/Dani-Hub).
* [#1338](https://github.com/java-native-access/jna/pull/1338): Add `RegNotifyChangeKeyValue` to `c.s.j.p.win32.Advapi32` - [@Dani-Hub](https://github.com/Dani-Hub).
* [#1340](https://github.com/java-native-access/jna/issues/1340): Add `CM_Get_DevNode_Registry_Property` to `c.s.j.p.win32.Cfgmgr32` and corresponding util in `c.s.j.p.win32.Cfgmgr32Util` - [@dbwiddis](https://github.com/dbwiddis).
* [#1352](https://github.com/java-native-access/jna/pull/1352): Add `BringWindowToTop` to `c.s.j.p.win32.User32` - [@kahgoh](https://github.com/kahgoh).
* [#1354](https://github.com/java-native-access/jna/pull/1352): Add `GetParent` to `c.s.j.p.win32.User32` - [@kahgoh](https://github.com/kahgoh).
* [#1360](https://github.com/java-native-access/jna/issues/1360): Add `CommandLineToArgvW` to `c.s.j.p.win32.Shell32` and corresponding util in `c.s.j.p.win32.Shell32Util` - [@dbwiddis](https://github.com/dbwiddis).
* [#1363](https://github.com/java-native-access/jna/issues/1363): Update `NUMA_NODE_RELATIONSHIP` in `c.s.j.p.win32.WinNT` to new version of the structure and improve support for future values of `c.s.j.p.win32.WinNT.LOGICAL_PROCESSOR_RELATIONSHIP` - [@dbwiddis](https://github.com/dbwiddis).

Bug Fixes
---------
* [#1343](https://github.com/java-native-access/jna/issues/1343): `c.s.j.p.mac.CoreFoundation.CFStringRef#stringValue` buffer needs space for a null byte - [@dbwiddis](https://github.com/dbwiddis).
* [#1351](https://github.com/java-native-access/jna/issues/1351): Define `c.s.j.p.unix.size_t.ByReference` and fix macOS sysctl `size_t *` parameters - [@dbwiddis](https://github.com/dbwiddis).
* [#1362](https://github.com/java-native-access/jna/issues/1362): Clear security sensitive data after usage in `c.s.j.p.win32.Crypt32Util#cryptProtectData` and `#cryptUnprotectData` - [@dmytro-sheyko](https://github.com/dmytro-sheyko).
* [#1361](https://github.com/java-native-access/jna/issues/1361): Make `c.s.j.p.win32.Crypt32Util#cryptProtectData` and `#cryptUnprotectData` properly handle 0-length array as input - [@dmytro-sheyko](https://github.com/dmytro-sheyko).

Release 5.8.0
=============

Expand Down Expand Up @@ -50,7 +71,7 @@ Features
* [#1239](https://github.com/java-native-access/jna/pull/1239): Improve performance of allocation of `c.s.j.Memory` objects - [@joerg1985](https://github.com/joerg1985).
* [#1246](https://github.com/java-native-access/jna/pull/1246): Improve performance of `c.s.j.Structure#read` and `c.s.j.Structure#write` - [@joerg1985](https://github.com/joerg1985).
* [#1260](https://github.com/java-native-access/jna/pull/1260): Add mapping for X11 generic events - [@lafoletc](https://github.com/lafoletc).
* [#1263](https://github.com/java-native-access/jna/pull/1263): Add LowLevelMouseProc - [@nordiakt](https://github.com/nordiakt)
* [#1263](https://github.com/java-native-access/jna/pull/1263): Add LowLevelMouseProc - [@nordiakt](https://github.com/nordiakt).
* [#1265](https://github.com/java-native-access/jna/pull/1265): Add mapping for XQueryExtension - [@lafoletc](https://github.com/lafoletc).
* [#1299](https://github.com/java-native-access/jna/pull/1299): Add `c.s.j.p.win32.IPHlpApi#GetExtendedTcpTable`, `c.s.j.p.win32.IPHlpApi#GetExtendedUdpTable`, and supporting structures. - [@dbwiddis](https://github.com/dbwiddis).

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
![Java Native Access - JNA](https://github.com/java-native-access/jna/raw/master/www/images/jnalogo.jpg "Java Native Access - JNA")

[![Github Actions Build Status](https://github.com/java-native-access/jna/workflows/Java%20CI/badge.svg)](https://github.com/java-native-access/jna/actions?query=workflow%3A%22Java+CI%22)
[![Travis Build Status](https://travis-ci.org/java-native-access/jna.svg?branch=master)](https://travis-ci.org/java-native-access/jna)
[![Travis Build Status](https://api.travis-ci.com/java-native-access/jna.svg?branch=master)](https://travis-ci.com/github/java-native-access/jna)
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/j6vmpjrw5iktb8iu/branch/master?svg=true)](https://ci.appveyor.com/project/dblock/jna-gsxuq/branch/master)

Java Native Access (JNA)
========================

The definitive JNA reference (including an overview and usage details) is in the [JavaDoc](http://java-native-access.github.io/jna/5.8.0/javadoc/). Please read the [overview](http://java-native-access.github.io/jna/5.8.0/javadoc/overview-summary.html#overview_description). Questions, comments, or exploratory conversations should begin on the [mailing list](http://groups.google.com/group/jna-users), although you may find it easier to find answers to already-solved problems on [StackOverflow](http://stackoverflow.com/questions/tagged/jna).
The definitive JNA reference (including an overview and usage details) is in the [JavaDoc](http://java-native-access.github.io/jna/5.9.0/javadoc/). Please read the [overview](http://java-native-access.github.io/jna/5.9.0/javadoc/overview-summary.html#overview_description). Questions, comments, or exploratory conversations should begin on the [mailing list](http://groups.google.com/group/jna-users), although you may find it easier to find answers to already-solved problems on [StackOverflow](http://stackoverflow.com/questions/tagged/jna).

JNA provides Java programs easy access to native shared libraries without writing anything but Java code - no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes.

Expand Down Expand Up @@ -63,20 +63,20 @@ Pre-built platform support may be found [here](https://github.com/java-native-ac
Download
========

Version 5.8.0
Version 5.9.0

JNA
---

[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna/5.8.0/jar) [jna-5.8.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.8.0/jna-5.8.0.jar) [jna-5.8.0-jpms.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.8.0/jna-5.8.0-jpms.jar)
[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna/5.9.0/jar) [jna-5.9.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.9.0/jna-5.9.0.jar) [jna-jpms-5.9.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-jpms/5.9.0/jna-jpms-5.9.0.jar)

This is the core artifact of JNA and contains only the binding library and the
core helper classes.

JNA Platform
------------

[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna-platform.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna-platform/5.8.0/jar) [jna-platform-5.8.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.8.0/jna-platform-5.8.0.jar) [jna-platform-5.8.0-jpms.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.8.0/jna-platform-5.8.0-jpms.jar)
[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna-platform.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna-platform/5.9.0/jar) [jna-platform-5.9.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.9.0/jna-platform-5.9.0.jar) [jna-platform-jpms-5.9.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform-jpms/5.9.0/jna-platform-jpms-5.9.0.jar)

This artifact holds cross-platform mappings and mappings for a number of commonly used platform
functions, including a large number of Win32 mappings as well as a set of utility classes
Expand Down Expand Up @@ -144,12 +144,12 @@ Using the Library
* [Platform Library](https://github.com/java-native-access/jna/blob/master/www/PlatformLibrary.md)
* [Direct Method Mapping](https://github.com/java-native-access/jna/blob/master/www/DirectMapping.md) (Optimization)
* [Frequently Asked Questions (FAQ)](https://github.com/java-native-access/jna/blob/master/www/FrequentlyAskedQuestions.md)
* [Avoiding Crashes](http://java-native-access.github.io/jna/5.8.0/javadoc/overview-summary.html#crash-protection)
* [Avoiding Crashes](http://java-native-access.github.io/jna/5.9.0/javadoc/overview-summary.html#crash-protection)

Primary Documentation (JavaDoc)
===============================

The definitive JNA reference is in the [JavaDoc](http://java-native-access.github.io/jna/5.8.0/javadoc/).
The definitive JNA reference is in the [JavaDoc](http://java-native-access.github.io/jna/5.9.0/javadoc/).

Developers
==========
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ environment:
matrix:
- TARGET_ARCH: x86_64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
CYGWIN_PACKAGES: git,make,automake,libtool,mingw64-x86_64-gcc-g++,mingw64-x86_64-gcc-core
CYGWIN_PACKAGES: git,make,automake,libtool,mingw64-x86_64-gcc-g++,mingw64-x86_64-gcc-core,perl
CHOCO_PACKAGES: ant cygwin
CYGWIN_SETUP: cygwinsetup.exe # from choco
JAVA_HOME: C:\Program Files\Java\jdk1.8.0

- TARGET_ARCH: x86
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
CYGWIN_PACKAGES: git,make,automake,libtool,mingw64-i686-gcc-g++,mingw64-i686-gcc-core
CYGWIN_PACKAGES: git,make,automake,libtool,mingw64-i686-gcc-g++,mingw64-i686-gcc-core,perl
CHOCO_PACKAGES: ant cygwin
CYGWIN_SETUP: cygwinsetup.exe # from choco
JAVA_HOME: C:\Program Files (x86)\Java\jdk1.8.0 # 32-bit
Expand Down
4 changes: 2 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

<!-- JNA library release version - android versionCode is derived from mjar/minor/revision -->
<property name="jna.major" value="5"/>
<property name="jna.minor" value="8"/>
<property name="jna.minor" value="9"/>
<property name="jna.revision" value="0"/>
<property name="jna.build" value="0"/> <!--${build.number}-->
<condition property="version.suffix" value="" else="-SNAPSHOT">
Expand Down Expand Up @@ -1615,7 +1615,7 @@ cd ..
<arg value="-DpomFile=${pom-platform}"/>
<arg value="-Dfile=${platform-jar}"/>
<arg value="-Dfiles=${platform-sources-jar},${platform-javadoc-jar}"/>
<arg value="-Dtypes=jar,jar,jar"/>
<arg value="-Dtypes=jar,jar"/>
<arg value="-Dclassifiers=sources,javadoc"/>
</artifact:mvn>

Expand Down
6 changes: 3 additions & 3 deletions contrib/platform/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ com.sun.jna.platform.wince;version=${osgi.version}
<exports package="com.sun.jna.platform.win32.COM.util.annotation" />
<exports package="com.sun.jna.platform.wince" />
<requires module="java.logging" />
<requires module="java.desktop" />
<requires module="java.datatransfer" />
<requires module="com.sun.jna" />
<requires module="java.desktop" transitive="true" />
<requires module="java.datatransfer" transitive="true" />
<requires module="com.sun.jna" transitive="true" />
</ModuleGenerator>
<move file="dist/jna-platform.jar" tofile="${build.dir}/jna-platform-base.jar" />
<jar jarfile="dist/jna-platform.jar" duplicate="preserve" createUnicodeExtraFields="never" encoding="UTF-8" manifest="${build.dir}/manifest/automatic.mf">
Expand Down
2 changes: 1 addition & 1 deletion contrib/platform/src/com/sun/jna/platform/linux/Udev.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class UdevContext extends PointerType {
*
* @return this object, unmodified.
*/
UdevContext ref() {
public UdevContext ref() {
return INSTANCE.udev_ref(this);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 Daniel Widdis
* Copyright (c) 2019, 2021 Daniel Widdis
*
* The contents of this file is dual-licensed under 2
* alternative Open Source/Free licenses: LGPL 2.1 or later and
Expand Down Expand Up @@ -303,7 +303,7 @@ public boolean booleanValue() {
* <p>
* CFArray is “toll-free bridged” with its Cocoa Foundation counterpart,
* {@code NSArray}. Therefore, in a method where you see an {@code NSArray *}
* parameter, you can pass in a {@link #CFArrayRef}.
* parameter, you can pass in a {@code CFArrayRef} .
*/
class CFArrayRef extends CFTypeRef {
public CFArrayRef() {
Expand Down Expand Up @@ -487,14 +487,20 @@ public static CFStringRef createCFString(String s) {
* failed.
*/
public String stringValue() {
// Get number of characters (UTF-16 code pairs)
// Code points > 0xffff will have 2 characters per Unicode character
CFIndex length = INSTANCE.CFStringGetLength(this);
if (length.longValue() == 0) {
return "";
}
// Calculate maximum possible size in UTF8 bytes
// This will be 3 x length
CFIndex maxSize = INSTANCE.CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8);
if (maxSize.intValue() == kCFNotFound) {
throw new StringIndexOutOfBoundsException("CFString maximum number of bytes exceeds LONG_MAX.");
}
// Increment size by 1 for a null byte
maxSize.setValue(maxSize.longValue() + 1);
Memory buf = new Memory(maxSize.longValue());
if (0 != INSTANCE.CFStringGetCString(this, buf, maxSize, kCFStringEncodingUTF8)) {
return buf.getString(0, "UTF8");
Expand Down
4 changes: 2 additions & 2 deletions contrib/platform/src/com/sun/jna/platform/mac/IOKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ CFTypeRef IORegistryEntrySearchCFProperty(IORegistryEntry entry, String plane, C
* @param connect
* An {@code io_connect_t} handle is returned on success, to be used
* with the IOConnectXXX APIs. It should be destroyed with
* {@link IOServiceClose}.
* {@link #IOServiceClose}.
* @return A return code generated by {@code IOService::newUserClient}.
*/
int IOServiceOpen(IOService service, int owningTask, int type, PointerByReference connect);
Expand Down Expand Up @@ -828,7 +828,7 @@ CFTypeRef IORegistryEntrySearchCFProperty(IORegistryEntry entry, String plane, C
* <p>
* Caller should NOT release the returned CFDictionary - it will be
* released as part of the {@link CFTypeRef} returned by
* {@link IOPSCopyPowerSourcesInfo}.
* {@link #IOPSCopyPowerSourcesInfo}.
*/
CFDictionaryRef IOPSGetPowerSourceDescription(CFTypeRef blob, CFTypeRef ps);

Expand Down
Loading

0 comments on commit 4aea280

Please sign in to comment.