Branch merge

--HG--
branch : trunk
This commit is contained in:
Tartalo
2010-06-09 15:14:20 +02:00
8 changed files with 102 additions and 32 deletions

View File

@@ -48,7 +48,7 @@ const LIBMPQ_ERROR_DECRYPT = -11; /* we don't know the decryption seed. */
const LIBMPQ_ERROR_UNPACK = -12; /* error on unpacking file. */
/** libmpq internal meta-data for an archive */
struct mpq_archive_s;
extern struct mpq_archive_s;
extern(C) {

View File

@@ -20,12 +20,10 @@
/* generic includes. */
#include <ctype.h>
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
/* libmpq main includes. */
#include "mpq.h"

View File

@@ -36,10 +36,7 @@
#define LIBMPQ_PKZIP_CMP_BAD_DATA 3
#define LIBMPQ_PKZIP_CMP_ABORT 4
#ifdef _MSC_VER
#pragma pack(push,1)
#endif
#include "pack_begin.h"
/* compression structure. */
typedef struct {
uint32_t offs0000; /* 0000 - start. */
@@ -68,12 +65,8 @@ typedef struct {
uint8_t slen_bits[0x10]; /* 30F4 - numbers of bits for skip copied block length. */
uint8_t clen_bits[0x10]; /* 3104 - number of valid bits for copied block. */
uint16_t len_base[0x10]; /* 3114 - buffer. */
#ifdef _MSC_VER
} pkzip_cmp_s;
#pragma pack(pop)
#else
} __attribute__ ((packed)) pkzip_cmp_s;
#endif
} PACK_STRUCT pkzip_cmp_s;
#include "pack_end.h"
/* data structure. */
typedef struct {

View File

@@ -62,13 +62,7 @@
#define TRUE 1
#endif
#ifdef _MSC_VER
#pragma pack(push,1)
#define PACK_STRUCT
#else
#define PACK_STRUCT __attribute__((packed))
#endif
#include "pack_begin.h"
/* mpq archive header. */
typedef struct {
uint32_t mpq_magic; /* the 0x1A51504D ('MPQ\x1A') signature. */
@@ -123,11 +117,7 @@ typedef struct {
uint32_t block_table_indices; /* real mapping for file number to block entry. */
uint32_t block_table_diff; /* block table difference between valid blocks and invalid blocks before. */
} PACK_STRUCT mpq_map_s;
#ifdef _MSC_VER
#pragma pack(pop)
#endif
#undef PACK_STRUCT
#include "pack_end.h"
/* archive structure used since diablo 1.00 by blizzard. */
struct mpq_archive {

View File

@@ -33,13 +33,9 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef _MSC_VER
#define fseeko _fseeki64
#endif
/* support for platform specific things */
#include "platform.h"
/* this function returns the library version information. */
const char *libmpq__version(void) {

34
externals/libmpq/libmpq/pack_begin.h vendored Normal file
View File

@@ -0,0 +1,34 @@
/*
* pack_begin.h -- header file for struct packing used by libmpq.
*
* Copyright (c) 2010 Georg Lukas <georg@op-co.de>
*
* This program is free software; you can redistribute it and/or 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _PACK_BEGIN
#define _PACK_BEGIN
#else
#error "pack_begin.h may not be included twice!"
#endif
#ifdef _MSC_VER
#pragma pack(push,1)
#define PACK_STRUCT
#else
/* we assume GNU here */
#define PACK_STRUCT __attribute__((packed))
#endif

31
externals/libmpq/libmpq/pack_end.h vendored Normal file
View File

@@ -0,0 +1,31 @@
/*
* pack_end.h -- header file for struct packing used by libmpq.
*
* Copyright (c) 2010 Georg Lukas <georg@op-co.de>
*
* This program is free software; you can redistribute it and/or 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef _PACK_BEGIN
#undef _PACK_BEGIN
#else
#error "pack_begin.h must be includede before pack_end.h"
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif
#undef PACK_STRUCT

28
externals/libmpq/libmpq/platform.h vendored Normal file
View File

@@ -0,0 +1,28 @@
/*
* platform.h -- header file for platform specific parts.
*
* Copyright (c) 2010 Georg Lukas <georg@op-co.de>
*
* This program is free software; you can redistribute it and/or 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _PLATFORM_H
#define _PLATFORM_H
#ifdef _MSC_VER
#define fseeko _fseeki64
#endif
#endif /* _PLATFORM_H */