From b9bfa3a85704c705e7b628a28d9e34a32e210ceb Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 18 Feb 2014 02:34:26 +0100 Subject: TONY: Make GPL headers consistent in themselves. --- engines/tony/mpal/expr.cpp | 5 ++--- engines/tony/mpal/expr.h | 5 ++--- engines/tony/mpal/loadmpc.cpp | 5 ++--- engines/tony/mpal/loadmpc.h | 5 ++--- engines/tony/mpal/lzo.cpp | 5 ++--- engines/tony/mpal/lzo.h | 5 ++--- engines/tony/mpal/memory.cpp | 5 ++--- engines/tony/mpal/memory.h | 5 ++--- engines/tony/mpal/mpal.cpp | 5 ++--- engines/tony/mpal/mpal.h | 5 ++--- engines/tony/mpal/mpaldll.h | 5 ++--- engines/tony/mpal/mpalutils.cpp | 5 ++--- engines/tony/mpal/mpalutils.h | 5 ++--- 13 files changed, 26 insertions(+), 39 deletions(-) (limited to 'engines/tony/mpal') diff --git a/engines/tony/mpal/expr.cpp b/engines/tony/mpal/expr.cpp index 7dc640ba7c..1fdf637062 100644 --- a/engines/tony/mpal/expr.cpp +++ b/engines/tony/mpal/expr.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h index 256d09bb9b..6ac1963356 100644 --- a/engines/tony/mpal/expr.h +++ b/engines/tony/mpal/expr.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code diff --git a/engines/tony/mpal/loadmpc.cpp b/engines/tony/mpal/loadmpc.cpp index 4eb84d1406..8f63b07ca0 100644 --- a/engines/tony/mpal/loadmpc.cpp +++ b/engines/tony/mpal/loadmpc.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code diff --git a/engines/tony/mpal/loadmpc.h b/engines/tony/mpal/loadmpc.h index 20956288aa..479cf5f99b 100644 --- a/engines/tony/mpal/loadmpc.h +++ b/engines/tony/mpal/loadmpc.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code diff --git a/engines/tony/mpal/lzo.cpp b/engines/tony/mpal/lzo.cpp index a04a769528..d95efd0393 100644 --- a/engines/tony/mpal/lzo.cpp +++ b/engines/tony/mpal/lzo.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* minilzo.c -- mini subset of the LZO real-time data compression library diff --git a/engines/tony/mpal/lzo.h b/engines/tony/mpal/lzo.h index ebb1c4b516..4384e3fb33 100644 --- a/engines/tony/mpal/lzo.h +++ b/engines/tony/mpal/lzo.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* minilzo.c -- mini subset of the LZO real-time data compression library diff --git a/engines/tony/mpal/memory.cpp b/engines/tony/mpal/memory.cpp index 9737fe0abf..4076f710de 100644 --- a/engines/tony/mpal/memory.cpp +++ b/engines/tony/mpal/memory.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ #include "common/algorithm.h" diff --git a/engines/tony/mpal/memory.h b/engines/tony/mpal/memory.h index 9c21cc20e6..7739fdfa48 100644 --- a/engines/tony/mpal/memory.h +++ b/engines/tony/mpal/memory.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ #ifndef TONY_MPAL_MEMORY diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index 19e3d43df4..797c7dbae0 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code diff --git a/engines/tony/mpal/mpal.h b/engines/tony/mpal/mpal.h index 2d22ee8faf..e88fd36e2f 100644 --- a/engines/tony/mpal/mpal.h +++ b/engines/tony/mpal/mpal.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code diff --git a/engines/tony/mpal/mpaldll.h b/engines/tony/mpal/mpaldll.h index 92ddf8fc5a..68969497c1 100644 --- a/engines/tony/mpal/mpaldll.h +++ b/engines/tony/mpal/mpaldll.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code diff --git a/engines/tony/mpal/mpalutils.cpp b/engines/tony/mpal/mpalutils.cpp index 0919aed5ac..84c8a68919 100644 --- a/engines/tony/mpal/mpalutils.cpp +++ b/engines/tony/mpal/mpalutils.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ #include "tony/mpal/mpalutils.h" diff --git a/engines/tony/mpal/mpalutils.h b/engines/tony/mpal/mpalutils.h index f351f22196..9ef534c632 100644 --- a/engines/tony/mpal/mpalutils.h +++ b/engines/tony/mpal/mpalutils.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ #ifndef TONY_MPAL_MPALUTILS -- cgit v1.2.3 From d35f470bf6290eb9ab5a86321b223ae3f1cb48fa Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 28 Feb 2014 22:20:38 +0100 Subject: TONY: Reduce the scope of some variables, change the return type of findPath() --- engines/tony/mpal/mpal.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'engines/tony/mpal') diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index 797c7dbae0..3084fd89af 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -1524,7 +1524,6 @@ void mpalFree() { uint32 mpalQueryDWORD(uint16 wQueryType, ...) { Common::String buf; uint32 dwRet = 0; - char *n; va_list v; va_start(v, wQueryType); @@ -1625,7 +1624,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { */ lockVar(); int x = GETARG(uint32); - n = GETARG(char *); + char *n = GETARG(char *); buf = Common::String::format("Status.%u", x); if (varGetValue(buf.c_str()) <= 0) n[0]='\0'; -- cgit v1.2.3 From f358ec74f7ac4575e5450fd468a46aba2190da91 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 28 Feb 2014 22:47:36 +0100 Subject: TONY: Reduce the scope of some more variables --- engines/tony/mpal/loadmpc.cpp | 4 +--- engines/tony/mpal/mpal.cpp | 6 +----- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'engines/tony/mpal') diff --git a/engines/tony/mpal/loadmpc.cpp b/engines/tony/mpal/loadmpc.cpp index 8f63b07ca0..8d030f1e52 100644 --- a/engines/tony/mpal/loadmpc.cpp +++ b/engines/tony/mpal/loadmpc.cpp @@ -138,8 +138,6 @@ static void FreeScript(LpMpalScript lpmsScript) { * @returns Pointer to the buffer after the item, or NULL on failure. */ static const byte *parseDialog(const byte *lpBuf, LpMpalDialog lpmdDialog) { - byte *lpLock; - lpmdDialog->_nObj = READ_LE_UINT32(lpBuf); lpBuf += 4; @@ -155,7 +153,7 @@ static const byte *parseDialog(const byte *lpBuf, LpMpalDialog lpmdDialog) { lpmdDialog->_periodNums[i] = READ_LE_UINT16(lpBuf); lpBuf += 2; lpmdDialog->_periods[i] = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, *lpBuf + 1); - lpLock = (byte *)globalLock(lpmdDialog->_periods[i]); + byte *lpLock = (byte *)globalLock(lpmdDialog->_periods[i]); Common::copy(lpBuf + 1, lpBuf + 1 + *lpBuf, lpLock); globalUnlock(lpmdDialog->_periods[i]); lpBuf += (*lpBuf) + 1; diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index 3084fd89af..305f89765b 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -1718,7 +1718,6 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { * method that returns a pointer or handle. */ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) { - char *n; Common::String buf; va_list v; va_start(v, wQueryType); @@ -1796,12 +1795,9 @@ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) { error("mpalQuery(MPQ_ITEM_IS_ACTIVE, uint32 nItem) used incorrect variant"); } else if (wQueryType == MPQ_ITEM_NAME) { - /* - * uint32 mpalQuery(MPQ_ITEM_NAME, uint32 nItem, char *lpszName); - */ lockVar(); int x = GETARG(uint32); - n = GETARG(char *); + char *n = GETARG(char *); buf = Common::String::format("Status.%u", x); if (varGetValue(buf.c_str()) <= 0) n[0] = '\0'; -- cgit v1.2.3 From 81d733aec0c4422fa8c0b34b0c7f4d5b74c991c0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 28 Feb 2014 22:49:05 +0100 Subject: TONY: Fix some British comments --- engines/tony/mpal/mpal.cpp | 6 +++--- engines/tony/mpal/mpal.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'engines/tony/mpal') diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index 305f89765b..c813b354b0 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -1518,7 +1518,7 @@ void mpalFree() { * * @param wQueryType Type of query. The list is in the QueryTypes enum. * @returns 4 bytes depending on the type of query - * @remarks This is the specialised version of the original single mpalQuery + * @remarks This is the specialized version of the original single mpalQuery * method that returns numeric results. */ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { @@ -1714,7 +1714,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { * * @param wQueryType Type of query. The list is in the QueryTypes enum. * @returns 4 bytes depending on the type of query - * @remarks This is the specialised version of the original single mpalQuery + * @remarks This is the specialized version of the original single mpalQuery * method that returns a pointer or handle. */ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) { @@ -1867,7 +1867,7 @@ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) { * * @param wQueryType Type of query. The list is in the QueryTypes enum. * @returns 4 bytes depending on the type of query - * @remarks This is the specialised version of the original single mpalQuery + * @remarks This is the specialized version of the original single mpalQuery * method that needs to run within a co-routine context. */ void mpalQueryCORO(CORO_PARAM, uint16 wQueryType, uint32 *dwRet) { diff --git a/engines/tony/mpal/mpal.h b/engines/tony/mpal/mpal.h index e88fd36e2f..af24c46697 100644 --- a/engines/tony/mpal/mpal.h +++ b/engines/tony/mpal/mpal.h @@ -391,7 +391,7 @@ void mpalFree(); * * @param wQueryType Type of query. The list is in the QueryTypes enum. * @returns 4 bytes depending on the type of query - * @remarks This is the specialised version of the original single mpalQuery + * @remarks This is the specialized version of the original single mpalQuery * method that returns numeric results. */ uint32 mpalQueryDWORD(uint16 wQueryType, ...); @@ -402,7 +402,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...); * * @param wQueryType Type of query. The list is in the QueryTypes enum. * @returns 4 bytes depending on the type of query - * @remarks This is the specialised version of the original single mpalQuery + * @remarks This is the specialized version of the original single mpalQuery * method that returns a pointer or handle. */ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...); @@ -413,7 +413,7 @@ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...); * * @param wQueryType Type of query. The list is in the QueryTypes enum. * @returns 4 bytes depending on the type of query - * @remarks This is the specialised version of the original single mpalQuery + * @remarks This is the specialized version of the original single mpalQuery * method that needs to run within a co-routine context. */ void mpalQueryCORO(CORO_PARAM, uint16 wQueryType, uint32 *dwRet); -- cgit v1.2.3 From 3f6b51ce55b86d5a1a2f898371368b10a2862252 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 1 Mar 2014 16:25:07 +0100 Subject: TONY: Remove dead code in lzo --- engines/tony/mpal/lzo.cpp | 278 +--------------------------------------------- 1 file changed, 3 insertions(+), 275 deletions(-) (limited to 'engines/tony/mpal') diff --git a/engines/tony/mpal/lzo.cpp b/engines/tony/mpal/lzo.cpp index d95efd0393..5f564187f8 100644 --- a/engines/tony/mpal/lzo.cpp +++ b/engines/tony/mpal/lzo.cpp @@ -86,37 +86,9 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len) register byte *op; register const byte *ip; register uint32 t = 0; -#if defined(COPY_DICT) - uint32 m_off; - const byte *dict_end; -#else register const byte *m_pos; -#endif const byte * const ip_end = in + in_len; -#if defined(HAVE_ANY_OP) - byte * const op_end = out + *out_len; -#endif -#if defined(LZO1Z) - uint32 last_m_off = 0; -#endif - -#if defined(COPY_DICT) - if (dict) - { - if (dict_len > M4_MAX_OFFSET) - { - dict += dict_len - M4_MAX_OFFSET; - dict_len = M4_MAX_OFFSET; - } - dict_end = dict + dict_len; - } - else - { - dict_len = 0; - dict_end = NULL; - } -#endif *out_len = 0; @@ -150,138 +122,38 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len) t += 15 + *ip++; } assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); -#if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4) - t += 3; - if (t >= 8) do - { - UA_COPY64(op, ip); - op += 8; ip += 8; t -= 8; - } while (t >= 8); - if (t >= 4) - { - UA_COPY32(op, ip); - op += 4; ip += 4; t -= 4; - } - if (t > 0) - { - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } - } -#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (PTR_ALIGNED2_4(op, ip)) - { -#endif - UA_COPY32(op, ip); - op += 4; ip += 4; - if (--t > 0) - { - if (t >= 4) - { - do { - UA_COPY32(op, ip); - op += 4; ip += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *ip++; while (--t > 0); - } - else - do *op++ = *ip++; while (--t > 0); - } -#if !defined(LZO_UNALIGNED_OK_4) - } - else -#endif -#endif -#if !defined(LZO_UNALIGNED_OK_4) && !defined(LZO_UNALIGNED_OK_8) { *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; do *op++ = *ip++; while (--t > 0); } -#endif first_literal_run: t = *ip++; if (t >= 16) goto match; -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(3); - t = 3; COPY_DICT(t, m_off) -#else -#if defined(LZO1Z) - t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else + m_pos = op - (1 + M2_MAX_OFFSET); m_pos -= t >> 2; m_pos -= *ip++ << 2; -#endif + TEST_LB(m_pos); NEED_OP(3); *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; -#endif goto match_done; do { match: if (t >= 64) { -#if defined(COPY_DICT) -#if defined(LZO1X) - m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); - t = (t >> 4) - 3; -#elif defined(LZO1Z) - m_off = t & 0x1f; - if (m_off >= 0x1c) - m_off = last_m_off; - else - { - m_off = 1 + (m_off << 6) + (*ip++ >> 2); - last_m_off = m_off; - } - t = (t >> 5) - 1; -#endif -#else + #if defined(LZO1X) m_pos = op - 1; m_pos -= (t >> 2) & 7; m_pos -= *ip++ << 3; t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_pos = op - 1; - m_pos -= (t >> 2) & 3; - m_pos -= *ip++ << 2; - t = (t >> 4) - 3; -#elif defined(LZO1Z) - { - uint32 off = t & 0x1f; - m_pos = op; - if (off >= 0x1c) - { - assert(last_m_off > 0); - m_pos -= last_m_off; - } - else - { - off = 1 + (off << 6) + (*ip++ >> 2); - m_pos -= off; - last_m_off = off; - } - } - t = (t >> 5) - 1; #endif TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); goto copy_match; -#endif } else if (t >= 32) { @@ -297,38 +169,14 @@ match: } t += 31 + *ip++; } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); - last_m_off = m_off; -#else - m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); -#endif -#else -#if defined(LZO1Z) - { - uint32 off = 1 + (ip[0] << 6) + (ip[1] >> 2); - m_pos = op - off; - last_m_off = off; - } -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos = op - 1; - m_pos -= UA_GET16(ip) >> 2; -#else m_pos = op - 1; m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif -#endif ip += 2; } else if (t >= 16) { -#if defined(COPY_DICT) - m_off = (t & 8) << 11; -#else m_pos = op; m_pos -= (t & 8) << 11; -#endif t &= 7; if (t == 0) { @@ -341,168 +189,48 @@ match: } t += 7 + *ip++; } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off += (ip[0] << 6) + (ip[1] >> 2); -#else - m_off += (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_off == 0) - goto eof_found; - m_off += 0x4000; -#if defined(LZO1Z) - last_m_off = m_off; -#endif -#else -#if defined(LZO1Z) - m_pos -= (ip[0] << 6) + (ip[1] >> 2); -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos -= UA_GET16(ip) >> 2; -#else m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif ip += 2; if (m_pos == op) goto eof_found; m_pos -= 0x4000; -#if defined(LZO1Z) - last_m_off = pd((const byte *)op, m_pos); -#endif -#endif } else { -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = 1 + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(2); - t = 2; COPY_DICT(t, m_off) -#else -#if defined(LZO1Z) - t = 1 + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else m_pos = op - 1; m_pos -= t >> 2; m_pos -= *ip++ << 2; -#endif TEST_LB(m_pos); NEED_OP(2); *op++ = *m_pos++; *op++ = *m_pos; -#endif goto match_done; } -#if defined(COPY_DICT) - - NEED_OP(t+3-1); - t += 3-1; COPY_DICT(t, m_off) - -#else - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); -#if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4) - if (op - m_pos >= 8) - { - t += (3 - 1); - if (t >= 8) do - { - UA_COPY64(op, m_pos); - op += 8; m_pos += 8; t -= 8; - } while (t >= 8); - if (t >= 4) - { - UA_COPY32(op, m_pos); - op += 4; m_pos += 4; t -= 4; - } - if (t > 0) - { - *op++ = m_pos[0]; - if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } } - } - } - else -#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op, m_pos)) - { - assert((op - m_pos) >= 4); -#else - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) - { -#endif - UA_COPY32(op, m_pos); - op += 4; m_pos += 4; t -= 4 - (3 - 1); - do { - UA_COPY32(op, m_pos); - op += 4; m_pos += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *m_pos++; while (--t > 0); - } - else -#endif { copy_match: *op++ = *m_pos++; *op++ = *m_pos++; do *op++ = *m_pos++; while (--t > 0); } -#endif - match_done: -#if defined(LZO1Z) - t = ip[-1] & 3; -#else t = ip[-2] & 3; -#endif if (t == 0) break; match_next: assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); -#if 0 - do *op++ = *ip++; while (--t > 0); -#else *op++ = *ip++; if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } -#endif t = *ip++; } while (TEST_IP && TEST_OP); } -#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) - *out_len = pd(op, out); - return LZO_E_EOF_NOT_FOUND; -#endif - eof_found: assert(t == 1); *out_len = pd(op, out); return (ip == ip_end ? LZO_E_OK : (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); -#if defined(HAVE_NEED_IP) -input_overrun: - *out_len = pd(op, out); - return LZO_E_INPUT_OVERRUN; -#endif - -#if defined(HAVE_NEED_OP) -output_overrun: - *out_len = pd(op, out); - return LZO_E_OUTPUT_OVERRUN; -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -lookbehind_overrun: - *out_len = pd(op, out); - return LZO_E_LOOKBEHIND_OVERRUN; -#endif } } // end of namespace MPAL -- cgit v1.2.3 From 3ace56117823a61e46be5584b496cd81f2a3c91a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 1 Mar 2014 16:35:58 +0100 Subject: TONY: Indent code properly in lzo --- engines/tony/mpal/lzo.cpp | 89 ++++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 44 deletions(-) (limited to 'engines/tony/mpal') diff --git a/engines/tony/mpal/lzo.cpp b/engines/tony/mpal/lzo.cpp index 5f564187f8..62b882aa39 100644 --- a/engines/tony/mpal/lzo.cpp +++ b/engines/tony/mpal/lzo.cpp @@ -95,40 +95,44 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len) op = out; ip = in; - if (*ip > 17) - { + if (*ip > 17) { t = *ip++ - 17; if (t < 4) goto match_next; - assert(t > 0); NEED_OP(t); NEED_IP(t+1); - do *op++ = *ip++; while (--t > 0); + assert(t > 0); + NEED_OP(t); + NEED_IP(t + 1); + do + *op++ = *ip++; + while (--t > 0); goto first_literal_run; } - while (TEST_IP && TEST_OP) - { + while (TEST_IP && TEST_OP) { t = *ip++; if (t >= 16) goto match; - if (t == 0) - { + if (t == 0) { NEED_IP(1); - while (*ip == 0) - { + while (*ip == 0) { t += 255; ip++; NEED_IP(1); } t += 15 + *ip++; } - assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); - { - *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; - do *op++ = *ip++; while (--t > 0); - } + assert(t > 0); + NEED_OP(t + 3); + NEED_IP(t + 4); -first_literal_run: + *op++ = *ip++; + *op++ = *ip++; + *op++ = *ip++; + do + *op++ = *ip++; + while (--t > 0); +first_literal_run: t = *ip++; if (t >= 16) goto match; @@ -137,32 +141,31 @@ first_literal_run: m_pos -= t >> 2; m_pos -= *ip++ << 2; - TEST_LB(m_pos); NEED_OP(3); - *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; + TEST_LB(m_pos); + NEED_OP(3); + + *op++ = *m_pos++; + *op++ = *m_pos++; + *op++ = *m_pos; + goto match_done; do { match: - if (t >= 64) - { - -#if defined(LZO1X) + if (t >= 64) { m_pos = op - 1; m_pos -= (t >> 2) & 7; m_pos -= *ip++ << 3; t = (t >> 5) - 1; -#endif - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); + TEST_LB(m_pos); + assert(t > 0); + NEED_OP(t + 3 - 1); goto copy_match; - } - else if (t >= 32) - { + } else if (t >= 32) { t &= 31; - if (t == 0) - { + if (t == 0) { NEED_IP(1); - while (*ip == 0) - { + while (*ip == 0) { t += 255; ip++; NEED_IP(1); @@ -172,17 +175,13 @@ match: m_pos = op - 1; m_pos -= (ip[0] >> 2) + (ip[1] << 6); ip += 2; - } - else if (t >= 16) - { + } else if (t >= 16) { m_pos = op; m_pos -= (t & 8) << 11; t &= 7; - if (t == 0) - { + if (t == 0) { NEED_IP(1); - while (*ip == 0) - { + while (*ip == 0) { t += 255; ip++; NEED_IP(1); @@ -194,18 +193,20 @@ match: if (m_pos == op) goto eof_found; m_pos -= 0x4000; - } - else - { + } else { m_pos = op - 1; m_pos -= t >> 2; m_pos -= *ip++ << 2; - TEST_LB(m_pos); NEED_OP(2); - *op++ = *m_pos++; *op++ = *m_pos; + TEST_LB(m_pos); + NEED_OP(2); + *op++ = *m_pos++; + *op++ = *m_pos; goto match_done; } - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); + TEST_LB(m_pos); + assert(t > 0); + NEED_OP(t + 3 - 1); { copy_match: *op++ = *m_pos++; *op++ = *m_pos++; -- cgit v1.2.3 From 8d8bf74ad6412bc8d23673c8874f7ace22ac3995 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 1 Mar 2014 16:37:22 +0100 Subject: TONY: Remove unused function declaration in lzo --- engines/tony/mpal/lzo.cpp | 19 ++++++++++++++----- engines/tony/mpal/lzo.h | 13 ------------- 2 files changed, 14 insertions(+), 18 deletions(-) (limited to 'engines/tony/mpal') diff --git a/engines/tony/mpal/lzo.cpp b/engines/tony/mpal/lzo.cpp index 62b882aa39..b681cdbfc3 100644 --- a/engines/tony/mpal/lzo.cpp +++ b/engines/tony/mpal/lzo.cpp @@ -209,8 +209,11 @@ match: NEED_OP(t + 3 - 1); { copy_match: - *op++ = *m_pos++; *op++ = *m_pos++; - do *op++ = *m_pos++; while (--t > 0); + *op++ = *m_pos++; + *op++ = *m_pos++; + do + *op++ = *m_pos++; + while (--t > 0); } match_done: @@ -219,9 +222,16 @@ match_done: break; match_next: - assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); + assert(t > 0); + assert(t < 4); + NEED_OP(t); + NEED_IP(t + 1); *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } + if (t > 1) { + *op++ = *ip++; + if (t > 2) + *op++ = *ip++; + } t = *ip++; } while (TEST_IP && TEST_OP); } @@ -235,5 +245,4 @@ eof_found: } } // end of namespace MPAL - } // end of namespace Tony diff --git a/engines/tony/mpal/lzo.h b/engines/tony/mpal/lzo.h index 4384e3fb33..a95a14b267 100644 --- a/engines/tony/mpal/lzo.h +++ b/engines/tony/mpal/lzo.h @@ -86,25 +86,12 @@ namespace MPAL { #define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ #define LZO_E_INVALID_ARGUMENT (-10) -#define LZO1X_999_MEM_COMPRESS ((uint32) (14 * 16384L * sizeof(uint16))) - /** * Decompresses an LZO compressed resource */ int lzo1x_decompress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len); -/** - * Comrpess a data block into an LZO stream - */ -int lzo1x_1_compress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len, void *wrkmem); - -/** - * better compression ratio at the cost of more memory and time - */ -int lzo1x_999_compress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len, void *wrkmem); - } // end of namespace MPAL - } // end of namespace Tony #endif /* already included */ -- cgit v1.2.3 From 9d8477b87d3e0a968a9f85b2bf2f403f490b9988 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 1 Mar 2014 16:46:31 +0100 Subject: TONY: Remove dummy defines --- engines/tony/mpal/lzo.cpp | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) (limited to 'engines/tony/mpal') diff --git a/engines/tony/mpal/lzo.cpp b/engines/tony/mpal/lzo.cpp index b681cdbfc3..314d6f3ed5 100644 --- a/engines/tony/mpal/lzo.cpp +++ b/engines/tony/mpal/lzo.cpp @@ -69,15 +69,9 @@ namespace Tony { namespace MPAL { #define pd(a, b) ((uint32) ((a) - (b))) - #define TEST_IP (ip < ip_end) -#define TEST_OP 1 -#define NEED_IP(x) ((void) 0) -#define NEED_OP(x) ((void) 0) -#define TEST_LB(m_pos) ((void) 0) #define M2_MAX_OFFSET 0x0800 -#define LZO1X /** * Decompresses an LZO compressed resource @@ -100,36 +94,30 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len) if (t < 4) goto match_next; assert(t > 0); - NEED_OP(t); - NEED_IP(t + 1); do *op++ = *ip++; while (--t > 0); goto first_literal_run; } - while (TEST_IP && TEST_OP) { + while (TEST_IP) { t = *ip++; if (t >= 16) goto match; if (t == 0) { - NEED_IP(1); while (*ip == 0) { t += 255; ip++; - NEED_IP(1); } t += 15 + *ip++; } assert(t > 0); - NEED_OP(t + 3); - NEED_IP(t + 4); *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; do - *op++ = *ip++; + *op++ = *ip++; while (--t > 0); first_literal_run: @@ -141,9 +129,6 @@ first_literal_run: m_pos -= t >> 2; m_pos -= *ip++ << 2; - TEST_LB(m_pos); - NEED_OP(3); - *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; @@ -157,18 +142,14 @@ match: m_pos -= (t >> 2) & 7; m_pos -= *ip++ << 3; t = (t >> 5) - 1; - TEST_LB(m_pos); assert(t > 0); - NEED_OP(t + 3 - 1); goto copy_match; } else if (t >= 32) { t &= 31; if (t == 0) { - NEED_IP(1); while (*ip == 0) { t += 255; ip++; - NEED_IP(1); } t += 31 + *ip++; } @@ -180,11 +161,9 @@ match: m_pos -= (t & 8) << 11; t &= 7; if (t == 0) { - NEED_IP(1); while (*ip == 0) { t += 255; ip++; - NEED_IP(1); } t += 7 + *ip++; } @@ -197,16 +176,12 @@ match: m_pos = op - 1; m_pos -= t >> 2; m_pos -= *ip++ << 2; - TEST_LB(m_pos); - NEED_OP(2); *op++ = *m_pos++; *op++ = *m_pos; goto match_done; } - TEST_LB(m_pos); assert(t > 0); - NEED_OP(t + 3 - 1); { copy_match: *op++ = *m_pos++; @@ -224,8 +199,6 @@ match_done: match_next: assert(t > 0); assert(t < 4); - NEED_OP(t); - NEED_IP(t + 1); *op++ = *ip++; if (t > 1) { *op++ = *ip++; @@ -233,7 +206,7 @@ match_next: *op++ = *ip++; } t = *ip++; - } while (TEST_IP && TEST_OP); + } while (TEST_IP); } eof_found: -- cgit v1.2.3 From 2218d14fb5276724c757406d5ac1ec581160721b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 1 Mar 2014 16:50:02 +0100 Subject: TONY: Remove unused error defines --- engines/tony/mpal/lzo.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'engines/tony/mpal') diff --git a/engines/tony/mpal/lzo.h b/engines/tony/mpal/lzo.h index a95a14b267..172900f053 100644 --- a/engines/tony/mpal/lzo.h +++ b/engines/tony/mpal/lzo.h @@ -75,16 +75,8 @@ namespace MPAL { * normal events. */ #define LZO_E_OK 0 -#define LZO_E_ERROR (-1) -#define LZO_E_OUT_OF_MEMORY (-2) /* [lzo_alloc_func_t failure] */ -#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */ #define LZO_E_INPUT_OVERRUN (-4) -#define LZO_E_OUTPUT_OVERRUN (-5) -#define LZO_E_LOOKBEHIND_OVERRUN (-6) -#define LZO_E_EOF_NOT_FOUND (-7) #define LZO_E_INPUT_NOT_CONSUMED (-8) -#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ -#define LZO_E_INVALID_ARGUMENT (-10) /** * Decompresses an LZO compressed resource -- cgit v1.2.3