(State s)
| 1035 | } |
| 1036 | |
| 1037 | private static int copyUncompressedData(State s) { |
| 1038 | final byte[] ringBuffer = s.ringBuffer; |
| 1039 | int result; |
| 1040 | |
| 1041 | // Could happen if block ends at ring buffer end. |
| 1042 | if (s.metaBlockLength <= 0) { |
| 1043 | result = BitReader.reload(s); |
| 1044 | if (result < BROTLI_OK) { |
| 1045 | return result; |
| 1046 | } |
| 1047 | s.runningState = BLOCK_START; |
| 1048 | return BROTLI_OK; |
| 1049 | } |
| 1050 | |
| 1051 | final int chunkLength = Utils.min(s.ringBufferSize - s.pos, s.metaBlockLength); |
| 1052 | result = BitReader.copyRawBytes(s, ringBuffer, s.pos, chunkLength); |
| 1053 | if (result < BROTLI_OK) { |
| 1054 | return result; |
| 1055 | } |
| 1056 | s.metaBlockLength -= chunkLength; |
| 1057 | s.pos += chunkLength; |
| 1058 | if (s.pos == s.ringBufferSize) { |
| 1059 | s.nextRunningState = COPY_UNCOMPRESSED; |
| 1060 | s.runningState = INIT_WRITE; |
| 1061 | return BROTLI_OK; |
| 1062 | } |
| 1063 | |
| 1064 | result = BitReader.reload(s); |
| 1065 | if (result < BROTLI_OK) { |
| 1066 | return result; |
| 1067 | } |
| 1068 | s.runningState = BLOCK_START; |
| 1069 | return BROTLI_OK; |
| 1070 | } |
| 1071 | |
| 1072 | private static int writeRingBuffer(State s) { |
| 1073 | final int toWrite = Utils.min(s.outputLength - s.outputUsed, |
no test coverage detected