Merge branch 'fix-javatest' of https://github.com/axet/miniupnp

This commit is contained in:
Thomas Bernard 2012-01-19 12:33:50 +01:00
commit e824f0ccad
3 changed files with 18 additions and 7 deletions

View File

@ -18,7 +18,7 @@ INSTALL = install
SH = /bin/sh SH = /bin/sh
JAVA = java JAVA = java
# see http://code.google.com/p/jnaerator/ # see http://code.google.com/p/jnaerator/
JNAERATOR = jnaerator-0.9.3.jar JNAERATOR = jnaerator-0.9.7.jar
#following libs are needed on Solaris #following libs are needed on Solaris
#LDLIBS=-lsocket -lnsl -lresolv #LDLIBS=-lsocket -lnsl -lresolv
@ -192,7 +192,16 @@ testigddescparse: $(TESTIGDDESCPARSE)
miniupnpcstrings.h: miniupnpcstrings.h.in updateminiupnpcstrings.sh VERSION miniupnpcstrings.h: miniupnpcstrings.h.in updateminiupnpcstrings.sh VERSION
$(SH) updateminiupnpcstrings.sh $(SH) updateminiupnpcstrings.sh
jar: $(SHAREDLIBRARY) jnaerator-0.9.8-shaded.jar:
wget http://jnaerator.googlecode.com/files/jnaerator-0.9.8-shaded.jar
jnaerator-0.9.7.jar:
wget http://jnaerator.googlecode.com/files/jnaerator-0.9.7.jar
jnaerator-0.9.3.jar:
wget http://jnaerator.googlecode.com/files/jnaerator-0.9.3.jar
jar: $(SHAREDLIBRARY) $(JNAERATOR)
$(JAVA) -jar $(JNAERATOR) -library miniupnpc miniupnpc.h declspec.h upnpcommands.h upnpreplyparse.h igd_desc_parse.h miniwget.h upnperrors.h $(SHAREDLIBRARY) -package fr.free.miniupnp -o . -jar java/miniupnpc_$(OS).jar -v $(JAVA) -jar $(JNAERATOR) -library miniupnpc miniupnpc.h declspec.h upnpcommands.h upnpreplyparse.h igd_desc_parse.h miniwget.h upnperrors.h $(SHAREDLIBRARY) -package fr.free.miniupnp -o . -jar java/miniupnpc_$(OS).jar -v
minihttptestserver: minihttptestserver.o minihttptestserver: minihttptestserver.o

View File

@ -1,4 +1,6 @@
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import fr.free.miniupnp.*; import fr.free.miniupnp.*;
/** /**
@ -27,7 +29,7 @@ public class JavaBridgeTest {
return; return;
} }
devlist = miniupnpc.upnpDiscover(UPNP_DELAY, (String) null, (String) null, 0, null); devlist = miniupnpc.upnpDiscover(UPNP_DELAY, (String) null, (String) null, 0, 0, IntBuffer.allocate(1));
if (devlist != null) { if (devlist != null) {
System.out.println("List of UPNP devices found on the network :"); System.out.println("List of UPNP devices found on the network :");
for (UPNPDev device = devlist; device != null; device = device.pNext) { for (UPNPDev device = devlist; device != null; device = device.pNext) {

View File

@ -1,8 +1,8 @@
#! /bin/sh #!/bin/bash
JAVA=java JAVA=java
JAVAC=javac JAVAC=javac
CP=$(for i in *.jar; do echo -n $i:; done).
$JAVAC -cp miniupnpc_Linux.jar JavaBridgeTest.java $JAVAC -cp $CP JavaBridgeTest.java || exit 1
$JAVA -cp miniupnpc_Linux.jar:. JavaBridgeTest 12345 UDP $JAVA -cp $CP JavaBridgeTest 12345 UDP || exit 1