File tree Expand file tree Collapse file tree 7 files changed +33
-21
lines changed
src/main/java/ru/lionzxy/fastlogblock/io/mappers Expand file tree Collapse file tree 7 files changed +33
-21
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
1313// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
1414
1515
16- version = " 1.0.2 "
16+ version = " 1.0.3 "
1717group = " ru.lionzxy.fastlogblock" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
1818archivesBaseName = " FastLogBlock"
1919
Original file line number Diff line number Diff line change 1- # Sun Jan 21 21:37:17 MSK 2018
1+ # Sun Jan 26 20:15:46 MSK 2020
2+ distributionUrl =https\://services.gradle.org/distributions/gradle-4.8.1-all.zip
23distributionBase =GRADLE_USER_HOME
34distributionPath =wrapper/dists
4- zipStoreBase =GRADLE_USER_HOME
55zipStorePath =wrapper/dists
6- distributionUrl = https\://services.gradle.org/distributions/gradle-2.14-bin.zip
6+ zipStoreBase = GRADLE_USER_HOME
Original file line number Diff line number Diff line change 1- #! /usr/bin/env bash
1+ #! /usr/bin/env sh
22
33# #############################################################################
44# #
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
3333# Use the maximum available, or set MAX_FD != -1 to use that value.
3434MAX_FD=" maximum"
3535
36- warn ( ) {
36+ warn () {
3737 echo " $* "
3838}
3939
40- die ( ) {
40+ die () {
4141 echo
4242 echo " $* "
4343 echo
@@ -154,11 +154,19 @@ if $cygwin ; then
154154 esac
155155fi
156156
157- # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158- function splitJvmOpts() {
159- JVM_OPTS=(" $@ " )
157+ # Escape application args
158+ save () {
159+ for i do printf %s\\ n " $i " | sed " s/'/'\\\\ ''/g;1s/^/'/;\$ s/\$ /' \\\\ /" ; done
160+ echo " "
160161}
161- eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162- JVM_OPTS[${# JVM_OPTS[*]} ]=" -Dorg.gradle.appname=$APP_BASE_NAME "
162+ APP_ARGS=$( save " $@ " )
163163
164- exec " $JAVACMD " " ${JVM_OPTS[@]} " -classpath " $CLASSPATH " org.gradle.wrapper.GradleWrapperMain " $@ "
164+ # Collect all arguments for the java command, following the shell quoting and substitution rules
165+ eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS " \" -Dorg.gradle.appname=$APP_BASE_NAME \" " -classpath " \" $CLASSPATH \" " org.gradle.wrapper.GradleWrapperMain " $APP_ARGS "
166+
167+ # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168+ if [ " $( uname) " = " Darwin" ] && [ " $HOME " = " $PWD " ]; then
169+ cd " $( dirname " $0 " ) "
170+ fi
171+
172+ exec " $JAVACMD " " $@ "
Original file line number Diff line number Diff line change @@ -49,7 +49,6 @@ goto fail
4949@ rem Get command-line arguments, handling Windows variants
5050
5151if not " %OS% " == " Windows_NT" goto win9xME_args
52- if " %@eval[2+2]" == " 4" goto 4NT_args
5352
5453:win9xME_args
5554@ rem Slurp the command line arguments.
@@ -60,11 +59,6 @@ set _SKIP=2
6059if " x%~1 " == " x" goto execute
6160
6261set CMD_LINE_ARGS = %*
63- goto execute
64-
65- :4NT_args
66- @ rem Get arguments from the 4NT Shell from JP Software
67- set CMD_LINE_ARGS = %$
6862
6963:execute
7064@ rem Setup the command line
Original file line number Diff line number Diff line change @@ -57,8 +57,13 @@ protected void writeToFile(final OutputStream outputStream) throws IOException {
5757 private void putFromByte (final TByteArrayList byteArrayList ) {
5858 final ByteBuffer byteBuffer = ByteBuffer .wrap (byteArrayList .toArray ());
5959 final long blockid = byteBuffer .getLong ();
60+ int nameSize = byteArrayList .size () - Long .BYTES - 1 ;
6061
61- final byte [] tmpbuffer = new byte [byteArrayList .size () - Long .BYTES - 1 ];
62+ if (nameSize <= 0 ) {
63+ return ;
64+ }
65+
66+ final byte [] tmpbuffer = new byte [nameSize ];
6267 byteBuffer .get (tmpbuffer );
6368 final ASCIString asciString = new ASCIString (tmpbuffer );
6469 blockToId .put (asciString , blockid );
Original file line number Diff line number Diff line change @@ -34,8 +34,13 @@ public NickMapper(final File mapFile) throws IOException {
3434 private void putFromByte (final TByteArrayList byteArrayList ) {
3535 final ByteBuffer byteBuffer = ByteBuffer .wrap (byteArrayList .toArray ());
3636 final int userid = byteBuffer .getInt ();
37+ int nameSize = byteArrayList .size () - Integer .BYTES - 1 ;
3738
38- final byte [] tmpbuffer = new byte [byteArrayList .size () - 5 ];
39+ if (nameSize <= 0 ) {
40+ return ;
41+ }
42+
43+ final byte [] tmpbuffer = new byte [nameSize ];
3944 byteBuffer .get (tmpbuffer );
4045 final ASCIString asciString = new ASCIString (tmpbuffer );
4146 uuidToId .put (asciString , userid );
You can’t perform that action at this time.
0 commit comments