Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check target number to be greater than zero, before calling Structure#toArray #1092

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove unnecessary NULL checks
matthiasblaesing committed May 6, 2019
commit 1bfce0864bc4eb9a8cd490a9d7976ffefd23cbe5
48 changes: 12 additions & 36 deletions contrib/platform/src/com/sun/jna/platform/win32/Netapi32Util.java
Original file line number Diff line number Diff line change
@@ -219,12 +219,8 @@ public static LocalGroup[] getLocalGroups(String serverName) {
LMAccess.LOCALGROUP_INFO_1[] groups = (LOCALGROUP_INFO_1[]) group.toArray(entriesRead.getValue());
for (LOCALGROUP_INFO_1 lgpi : groups) {
LocalGroup lgp = new LocalGroup();
if (lgpi.lgrui1_name != null) {
lgp.name = lgpi.lgrui1_name;
}
if (lgpi.lgrui1_comment != null) {
lgp.comment = lgpi.lgrui1_comment;
}
lgp.name = lgpi.lgrui1_name;
lgp.comment = lgpi.lgrui1_comment;
result.add(lgp);
}
}
@@ -272,12 +268,8 @@ public static Group[] getGlobalGroups(String serverName) {
LMAccess.GROUP_INFO_1[] groups = (LMAccess.GROUP_INFO_1[]) group.toArray(entriesRead.getValue());
for (LMAccess.GROUP_INFO_1 lgpi : groups) {
LocalGroup lgp = new LocalGroup();
if (lgpi.grpi1_name != null) {
lgp.name = lgpi.grpi1_name;
}
if (lgpi.grpi1_comment != null) {
lgp.comment = lgpi.grpi1_comment;
}
lgp.name = lgpi.grpi1_name;
lgp.comment = lgpi.grpi1_comment;
result.add(lgp);
}
}
@@ -505,24 +497,14 @@ public static DomainController getDC() {
throw new Win32Exception(rc);
}
DomainController dc = new DomainController();
if (pdci.dci.DomainControllerAddress != null) {
dc.address = pdci.dci.DomainControllerAddress;
}
dc.address = pdci.dci.DomainControllerAddress;
dc.addressType = pdci.dci.DomainControllerAddressType;
if (pdci.dci.ClientSiteName != null) {
dc.clientSiteName = pdci.dci.ClientSiteName;
}
if (pdci.dci.DnsForestName != null) {
dc.dnsForestName = pdci.dci.DnsForestName;
}
dc.clientSiteName = pdci.dci.ClientSiteName;
dc.dnsForestName = pdci.dci.DnsForestName;
dc.domainGuid = pdci.dci.DomainGuid;
if (pdci.dci.DomainName != null) {
dc.domainName = pdci.dci.DomainName;
}
dc.domainName = pdci.dci.DomainName;
dc.flags = pdci.dci.Flags;
if (pdci.dci.DomainControllerName != null) {
dc.name = pdci.dci.DomainControllerName;
}
dc.name = pdci.dci.DomainControllerName;
rc = Netapi32.INSTANCE.NetApiBufferFree(pdci.dci.getPointer());
if (LMErr.NERR_Success != rc) {
throw new Win32Exception(rc);
@@ -701,16 +683,10 @@ public static UserInfo getUserInfo(String accountName, String domainName) {
if (rc == LMErr.NERR_Success) {
USER_INFO_23 info_23 = new USER_INFO_23(bufptr.getValue());
UserInfo userInfo = new UserInfo();
if (info_23.usri23_comment != null) {
userInfo.comment = info_23.usri23_comment;
}
userInfo.comment = info_23.usri23_comment;
userInfo.flags = info_23.usri23_flags;
if (info_23.usri23_full_name != null) {
userInfo.fullName = info_23.usri23_full_name;
}
if (info_23.usri23_name != null) {
userInfo.name = info_23.usri23_name;
}
userInfo.fullName = info_23.usri23_full_name;
userInfo.name = info_23.usri23_name;
if (info_23.usri23_user_sid != null) {
userInfo.sidString = Advapi32Util.convertSidToStringSid(info_23.usri23_user_sid);
}