gentoo/dev-games/bncsutil/files/bncsutil-ghost.patch

796 lines
23 KiB
Diff
Raw Normal View History

2013-05-22 16:29:30 +02:00
Index: src/bncsutil/bsha1.cpp
===================================================================
--- src/bncsutil/bsha1.cpp (revision 5)
+++ src/bncsutil/bsha1.cpp (working copy)
@@ -141,7 +141,7 @@
MEXP(void) calcHashBuf(const char* input, size_t length, char* result) {
int i;
- unsigned long a, b, c, d, e, g;
+ uint32_t a, b, c, d, e, g;
uint32_t* ldata;
char data[1024];
memset(data, 0, 1024);
2013-05-22 16:29:30 +02:00
Index: src/bncsutil/cdkeydecoder.cpp
===================================================================
--- src/bncsutil/cdkeydecoder.cpp (revision 5)
+++ src/bncsutil/cdkeydecoder.cpp (working copy)
@@ -31,7 +31,8 @@
#include <cctype> // for isdigit(), isalnum(), and toupper()
#include <cstring> // for memcpy()
#include <cstdio> // for sscanf()
-
+// #include <bncsutil/debug.h>
+
/**
* Implementation-specific CD-key hash structure.
*/
2013-05-22 16:29:30 +02:00
@@ -329,7 +330,7 @@
}
if ((accum % 10) != (cdkey[12] - '0')) {
- bncsutil_debug_message_a("error: %s is not a valid StarCraft key", cdkey);
+ // bncsutil_debug_message_a("error: %s is not a valid StarCraft key", cdkey);
return 0;
}
2013-05-22 16:29:30 +02:00
@@ -452,7 +453,7 @@
cdkey[i] = toupper(cdkey[i]);
a = (b + 0x07B5) % W3_BUFLEN;
b = (a + 0x07B5) % W3_BUFLEN;
- decode = w3KeyMap[cdkey[i]];
+ decode = w3KeyMap[(int)cdkey[i]];
table[a] = (decode / 5);
table[b] = (decode % 5);
}
2013-05-22 16:29:30 +02:00
Index: src/bncsutil/checkrevision.cpp
===================================================================
--- src/bncsutil/checkrevision.cpp (revision 5)
+++ src/bncsutil/checkrevision.cpp (working copy)
@@ -83,13 +83,14 @@
checkrevision_seeds.push_back(0x11BF6A18);
checkrevision_seeds.push_back(0xC57292E6);
checkrevision_seeds.push_back(0x7927D27E);
+ checkrevision_seeds.push_back(0x2FEC8733);
}
MEXP(long) get_mpq_seed(int mpq_number)
{
if (((size_t) mpq_number) >= checkrevision_seeds.size()) {
- bncsutil_debug_message_a("error: no known revision check seed for "
- "MPQ#%u", mpq_number);
+ //bncsutil_debug_message_a("error: no known revision check seed for "
+ // "MPQ#%u", mpq_number);
return 0;
}
2013-05-22 16:29:30 +02:00
@@ -124,7 +125,7 @@
return mpqNum;
}
-const char* basename(const char* file_name)
+const char* get_basename(const char* file_name)
{
const char* base;
2013-05-22 16:29:30 +02:00
@@ -139,7 +140,8 @@
MEXP(int) checkRevision(const char* formula, const char* files[], int numFiles,
int mpqNumber, unsigned long* checksum)
{
- long values[4], ovd[4], ovs1[4], ovs2[4];
+ uint64_t values[4];
+ long ovd[4], ovs1[4], ovs2[4];
char ops[4];
const char* token;
int curFormula = 0;
2013-05-22 16:29:30 +02:00
@@ -158,9 +160,9 @@
bncsutil_debug_message_a("}, %d, %d, %p);", numFiles, mpqNumber, checksum);
#endif
- if (!formula || !files || numFiles == 0 || mpqNumber <= 0 || !checksum) {
- bncsutil_debug_message("error: checkRevision() parameter sanity check "
- "failed");
+ if (!formula || !files || numFiles == 0 || mpqNumber < 0 || !checksum) {
+ //bncsutil_debug_message("error: checkRevision() parameter sanity check "
+ // "failed");
return 0;
}
2013-05-22 16:29:30 +02:00
@@ -171,8 +173,8 @@
}
if (seed_count <= (size_t) mpqNumber) {
- bncsutil_debug_message_a("error: no revision check seed value defined "
- "for MPQ number %d", mpqNumber);
+ //bncsutil_debug_message_a("error: no revision check seed value defined "
+ // "for MPQ number %d", mpqNumber);
return 0;
}
2013-05-22 16:29:30 +02:00
@@ -181,19 +183,19 @@
if (*(token + 1) == '=') {
int variable = BUCR_GETNUM(*token);
if (variable < 0 || variable > 3) {
- bncsutil_debug_message_a("error: Unknown revision check formula"
- " variable %c", *token);
+ //bncsutil_debug_message_a("error: Unknown revision check formula"
+ // " variable %c", *token);
return 0;
}
token += 2; // skip over equals sign
if (BUCR_ISNUM(*token)) {
- values[variable] = atol(token);
+ values[variable] = ATOL64(token);
} else {
if (curFormula > 3) {
// more than 4 operations? bloody hell.
- bncsutil_debug_message("error: Revision check formula"
- " contains more than 4 operations; unsupported.");
+ //bncsutil_debug_message("error: Revision check formula"
+ // " contains more than 4 operations; unsupported.");
return 0;
}
ovd[curFormula] = variable;
2013-05-22 16:29:30 +02:00
@@ -221,8 +223,8 @@
f = file_open(files[i], FILE_READ);
if (!f) {
- bncsutil_debug_message_a("error: Failed to open file %s",
- files[i]);
+ //bncsutil_debug_message_a("error: Failed to open file %s",
+ // files[i]);
return 0;
}
2013-05-22 16:29:30 +02:00
@@ -233,8 +235,8 @@
file_buffer = (uint8_t*) file_map(f, file_len, 0);
if (!file_buffer) {
file_close(f);
- bncsutil_debug_message_a("error: Failed to map file %s into memory",
- files[i]);
+ //bncsutil_debug_message_a("error: Failed to map file %s into memory",
+ // files[i]);
return 0;
}
2013-05-22 16:29:30 +02:00
@@ -251,8 +253,8 @@
buffer_size = file_len + extra;
dwBuf = (uint32_t*) malloc(buffer_size);
if (!dwBuf) {
- bncsutil_debug_message_a("error: Failed to allocate %d bytes "
- "of memory as a temporary buffer", buffer_size);
+ //bncsutil_debug_message_a("error: Failed to allocate %d bytes "
+ // "of memory as a temporary buffer", buffer_size);
file_unmap(f, file_buffer);
file_close(f);
return 0;
2013-05-22 16:29:30 +02:00
@@ -351,7 +353,7 @@
if (!file_name || !exe_info || !exe_info_size || !version)
return 0;
- base = basename(file_name);
+ base = get_basename(file_name);
switch (platform) {
case BNCSUTIL_PLATFORM_X86:
2013-05-22 16:29:30 +02:00
Index: src/bncsutil/debug.c
===================================================================
--- src/bncsutil/debug.c (revision 5)
+++ src/bncsutil/debug.c (working copy)
@@ -18,7 +18,7 @@
#include <time.h>
#endif
-struct _bncsutil_debug_env
+typedef struct _bncsutil_debug_env
{
int enabled;
#ifdef MOS_WINDOWS
2013-05-22 16:29:30 +02:00
@@ -29,36 +29,36 @@
#else
FILE* output;
#endif
-};
+} debug_env_t;
const char default_err_msg[] = "[unknown error]";
#ifdef MOS_WINDOWS
BOOL debug_set_color(debug_env_t env, WORD color)
{
- return SetConsoleTextAttribute(env->output, color | env->sans_foreground);
+ return SetConsoleTextAttribute(env.output, color | env.sans_foreground);
}
BOOL debug_restore_color(debug_env_t env)
{
- return SetConsoleTextAttribute(env->output, env->orig_attributes);
+ return SetConsoleTextAttribute(env.output, env.orig_attributes);
}
BOOL debug_intense_color(debug_env_t env)
{
CONSOLE_SCREEN_BUFFER_INFO info;
- if (!GetConsoleScreenBufferInfo(env->output, &info))
+ if (!GetConsoleScreenBufferInfo(env.output, &info))
return FALSE;
- return SetConsoleTextAttribute(env->output, info.wAttributes |
+ return SetConsoleTextAttribute(env.output, info.wAttributes |
FOREGROUND_INTENSITY);
}
BOOL debug_mellow_color(debug_env_t env)
{
CONSOLE_SCREEN_BUFFER_INFO info;
- if (!GetConsoleScreenBufferInfo(env->output, &info))
+ if (!GetConsoleScreenBufferInfo(env.output, &info))
return FALSE;
- return SetConsoleTextAttribute(env->output, info.wAttributes |
+ return SetConsoleTextAttribute(env.output, info.wAttributes |
~FOREGROUND_INTENSITY);
}
2013-05-22 16:29:30 +02:00
@@ -69,14 +69,14 @@
if (AllocConsole()) {
// only set title if new console was created
SetConsoleTitle("BNCSutil Debug Console");
- env->console_was_created = TRUE;
+ env.console_was_created = TRUE;
} else {
- env->console_was_created = FALSE;
+ env.console_was_created = FALSE;
}
- env->output = GetStdHandle(STD_OUTPUT_HANDLE);
- GetConsoleScreenBufferInfo(env->output, &info);
- env->orig_attributes = info.wAttributes;
- env->sans_foreground = info.wAttributes &
+ env.output = GetStdHandle(STD_OUTPUT_HANDLE);
+ GetConsoleScreenBufferInfo(env.output, &info);
+ env.orig_attributes = info.wAttributes;
+ env.sans_foreground = info.wAttributes &
~(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE |
FOREGROUND_INTENSITY);
}
2013-05-22 16:29:30 +02:00
@@ -87,9 +87,9 @@
#ifdef MOS_WINDOWS
DWORD chars_written;
BOOL res;
- if (!env->output)
+ if (!env.output)
debug_setup_console(env);
- res = WriteConsole(env->output, message, (DWORD) strlen(message),
+ res = WriteConsole(env.output, message, (DWORD) strlen(message),
&chars_written, (LPVOID) 0);
return (res) ? (size_t) chars_written : (size_t) -1;
#else
2013-05-22 16:29:30 +02:00
@@ -101,7 +101,7 @@
{
#ifdef MOS_WINDOWS
CONSOLE_SCREEN_BUFFER_INFO info;
- if (!GetConsoleScreenBufferInfo(env->output, &info))
+ if (!GetConsoleScreenBufferInfo(env.output, &info))
return (size_t) 0;
return (size_t) info.dwSize.X;
#else
2013-05-22 16:29:30 +02:00
Index: src/bncsutil/debug.h
===================================================================
--- src/bncsutil/debug.h (revision 5)
+++ src/bncsutil/debug.h (working copy)
@@ -6,86 +6,99 @@
* April 1, 2006
*/
-#ifndef _DEBUG_H_INCLUDED_
-#define _DEBUG_H_INCLUDED_ 1
+/* #ifndef _DEBUG_H_INCLUDED_ */
+/* #define _DEBUG_H_INCLUDED_ 1 */
-#undef DEBUG
-#if defined(BNCSUTIL_DEBUG_MESSAGES) && BNCSUTIL_DEBUG_MESSAGES
-# define INTERNAL_DEBUG(msg) bncsutil_debug_message(msg)
-# define INTERNAL_DUMP(data, length) bncsutil_debug_dump((data), (length))
-# define DEBUG 1
-#else
-# define INTERNAL_DEBUG(msg)
-# define INTERNAL_DUMP(data, length)
-# define DEBUG 0
-#endif
+/* #undef DEBUG */
+/* #if defined(BNCSUTIL_DEBUG_MESSAGES) && BNCSUTIL_DEBUG_MESSAGES */
+/* # define INTERNAL_DEBUG(msg) bncsutil_debug_message(msg) */
+/* # define INTERNAL_DUMP(data, length) bncsutil_debug_dump((data), (length)) */
+/* # define DEBUG 1 */
+/* #else */
+/* # define INTERNAL_DEBUG(msg) */
+/* # define INTERNAL_DUMP(data, length) */
+/* # define DEBUG 0 */
+/* #endif */
+/* #undef DEBUG */
-#ifdef __cplusplus
-extern "C" {
-#endif
+/* #ifdef __cplusplus */
+/* extern "C" { */
+/* #endif */
-#ifdef MOS_WINDOWS
-#include <windows.h>
-#endif
+/* #ifdef MOS_WINDOWS */
+/* #include <windows.h> */
+/* #endif */
-#include <bncsutil/mutil.h>
-#include <stdio.h>
+/* #include <bncsutil/mutil.h> */
+/* #include <stdio.h> */
-typedef struct _bncsutil_debug_env* debug_env_t;
+/* typedef struct _bncsutil_debug_env* debug_env_t; */
-debug_env_t get_debug_environment();
+/* debug_env_t get_debug_environment(); */
-/**
- * Returns nonzero if debugging messages are enabled or zero if disabled.
- */
-MEXP(int) bncsutil_debug_status(void);
-/**
- * Set new_status to zero to turn debugging messages off or nonzero to turn
- * them on. Returns nonzero on success and zero on failure.
- */
-MEXP(int) bncsutil_set_debug_status(int new_status);
+/* /\** */
+/* * Returns nonzero if debugging messages are enabled or zero if disabled. */
+/* *\/ */
+/* MEXP(int) bncsutil_debug_status(void); */
+/* /\** */
+/* * Set new_status to zero to turn debugging messages off or nonzero to turn */
+/* * them on. Returns nonzero on success and zero on failure. */
+/* *\/ */
+/* MEXP(int) bncsutil_set_debug_status(int new_status); */
-/**
- * Returns nonzero if internal debug messages were compiled in or zero if
- * they were not.
- */
-MEXP(int) bncsutil_internal_debug_messages();
+/* /\** */
+/* * Returns nonzero if internal debug messages were compiled in or zero if */
+/* * they were not. */
+/* *\/ */
+/* MEXP(int) bncsutil_internal_debug_messages(); */
-/**
- * Prints a debug message.
- */
-MEXP(void) bncsutil_debug_message(const char* message);
+/* /\** */
+/* * Prints a debug message. */
+/* *\/ */
+/* MEXP(void) bncsutil_debug_message(const char* message); */
-/**
- * Prints a debug message using a printf-style format string.
- */
-MEXP(void) bncsutil_debug_message_a(const char* message, ...);
+/* /\** */
+/* * Prints a debug message using a printf-style format string. */
+/* *\/ */
+/* MEXP(void) bncsutil_debug_message_a(const char* message, ...); */
-/**
- * Prints a hex dump of data to the debug console.
- */
-MEXP(void) bncsutil_debug_dump(const void* data, size_t data_length);
+/* /\** */
+/* * Prints a hex dump of data to the debug console. */
+/* *\/ */
+/* MEXP(void) bncsutil_debug_dump(const void* data, size_t data_length); */
-/**
- * Returns a pointer to a message describing the last system error event.
- */
-const char* sys_error_msg();
+/* /\** */
+/* * Returns a pointer to a message describing the last system error event. */
+/* *\/ */
+/* const char* sys_error_msg(); */
-/**
- * Frees the pointer provided by sys_error_msg().
- */
-void free_sys_err_msg(const char* message_pointer);
+/* /\** */
+/* * Frees the pointer provided by sys_error_msg(). */
+/* *\/ */
+/* void free_sys_err_msg(const char* message_pointer); */
-/* Not implemented! */
-MEXP(void) bncsutil_print_dump(FILE* stream, const void* data, size_t length);
-#ifdef MOS_WINDOWS
-//MEXP(void) bncsutil_print_dump_win(HANDLE stream, const void* data,
-// size_t length);
-#endif
+/* /\* Not implemented! *\/ */
+/* MEXP(void) bncsutil_print_dump(FILE* stream, const void* data, size_t length); */
+/* #ifdef MOS_WINDOWS */
+/* //MEXP(void) bncsutil_print_dump_win(HANDLE stream, const void* data, */
+/* // size_t length); */
+/* #endif */
-#ifdef __cplusplus
-} // extern "C"
+/* #ifdef __cplusplus */
+/* } // extern "C" */
+/* #endif */
+
+/* #endif /\* DEBUG *\/ */
+
+
+#ifndef __DEBUG_H__
+#define __DEBUG_H__
+
+#define bncsutil_debug_message(x)
+#define free_sys_err_msg(x)
+#define bncsutil_debug_message_a(x, y)
+#define sys_error_msg(x)
+
+
#endif
-
2013-05-22 16:29:30 +02:00
-#endif /* DEBUG */
\ No newline at end of file
Index: src/bncsutil/file.cpp
===================================================================
--- src/bncsutil/file.cpp (revision 5)
+++ src/bncsutil/file.cpp (working copy)
@@ -44,7 +44,7 @@
DWORD access;
DWORD share_mode;
DWORD open_mode;
- const char* sys_err;
+ //const char* sys_err;
size_t filename_buf_len;
if (mode & FILE_READ) {
2013-05-22 16:29:30 +02:00
@@ -61,18 +61,16 @@
FILE_ATTRIBUTE_NORMAL, NULL);
if (file == INVALID_HANDLE_VALUE) {
- sys_err = sys_error_msg();
- bncsutil_debug_message_a("Cannot open file \"%s\"; %s", filename,
- sys_err);
- free_sys_err_msg(sys_err);
+ //sys_err = sys_error_msg();
+ //bncsutil_debug_message_a("Cannot open file \"%s\"; %s", filename, sys_err);
+ //free_sys_err_msg(sys_err);
return ((file_t) 0);
}
try {
data = new _file;
} catch (std::bad_alloc) {
- bncsutil_debug_message_a("Failed to allocate %u bytes to hold"
- "file structure.", sizeof(struct _file));
+ //bncsutil_debug_message_a("Failed to allocate %u bytes to hold file structure.", sizeof(struct _file));
CloseHandle(file);
return (file_t) 0;
}
2013-05-22 16:29:30 +02:00
@@ -80,8 +78,7 @@
filename_buf_len = strlen(filename) + 1;
data->filename = (const char*) malloc(filename_buf_len);
if (!data->filename) {
- bncsutil_debug_message_a("Failed to allocate %u bytes to hold"
- "filename.", filename_buf_len);
+ //bncsutil_debug_message_a("Failed to allocate %u bytes to hold filename.", filename_buf_len);
CloseHandle(file);
delete data;
return (file_t) 0;
2013-05-22 16:29:30 +02:00
@@ -98,7 +95,7 @@
mapping_map::iterator it;
if (!file) {
- bncsutil_debug_message_a("error: null pointer given to file_close");
+ //bncsutil_debug_message_a("error: null pointer given to file_close");
return;
}
2013-05-22 16:29:30 +02:00
@@ -144,24 +141,21 @@
HANDLE mapping =
CreateFileMapping((HANDLE) file->f, NULL, PAGE_READONLY, 0, 0, NULL);
void* base;
- const char* err;
+ //const char* err;
if (!mapping) {
- err = sys_error_msg();
- bncsutil_debug_message_a("Failed to create file mapping for \"%s\": %s",
- file->filename, err);
- free_sys_err_msg(err);
+ //err = sys_error_msg();
+ //bncsutil_debug_message_a("Failed to create file mapping for \"%s\": %s", file->filename, err);
+ //free_sys_err_msg(err);
return (void*) 0;
}
base = MapViewOfFile(mapping, FILE_MAP_READ, 0, (DWORD) offset, len);
if (!base) {
CloseHandle(mapping);
- err = sys_error_msg();
- bncsutil_debug_message_a("Failed to map %u bytes of \"%s\" starting at "
- "%u: %s",
- len, file->filename, offset, err);
- free_sys_err_msg(err);
+ //err = sys_error_msg();
+ //bncsutil_debug_message_a("Failed to map %u bytes of \"%s\" starting at %u: %s", len, file->filename, offset, err);
+ //free_sys_err_msg(err);
return (void*) 0;
}
2013-05-22 16:29:30 +02:00
@@ -176,8 +170,7 @@
HANDLE mapping;
if (item == file->mappings.end()) {
- bncsutil_debug_message_a("warning: failed to unmap the block starting "
- "at %p from %s; unknown block.", base, file->filename);
+ //bncsutil_debug_message_a("warning: failed to unmap the block starting at %p from %s; unknown block.", base, file->filename);
return;
}
2013-05-22 16:29:30 +02:00
@@ -197,7 +190,7 @@
file_t data;
FILE* f;
size_t filename_buf_len;
- const char* err;
+ //const char* err;
if (mode_flags & FILE_WRITE)
mode[0] = 'w';
2013-05-22 16:29:30 +02:00
@@ -210,8 +203,7 @@
try {
data = new _file;
} catch (std::bad_alloc) {
- bncsutil_debug_message_a("Failed to allocate %u bytes to hold"
- "file structure."), sizeof(struct _file));
+ //bncsutil_debug_message_a("Failed to allocate %u bytes to hold file structure.", sizeof(struct _file));
fclose(f);
return (file_t) 0;
}
2013-05-22 16:29:30 +02:00
@@ -219,10 +211,9 @@
filename_buf_len = strlen(filename) + 1;
data->filename = (const char*) malloc(filename_buf_len);
if (!data->filename) {
- err = sys_error_msg();
- bncsutil_debug_message_a("Failed to allocate %u bytes to hold"
- "filename; %s"), filename_buf_len);
- free_sys_error_msg(err);
+ //err = sys_error_msg();
+ //bncsutil_debug_message_a("Failed to allocate %u bytes to hold filename; %s", filename_buf_len);
+ //free_sys_err_msg(err);
fclose(f);
delete data;
return (file_t) 0;
2013-05-22 16:29:30 +02:00
@@ -236,9 +227,10 @@
void file_close(file_t file)
{
-
+ mapping_map::iterator it;
+
if (!file) {
- bncsutil_debug_message("error: null pointer given to file_close");
+ //bncsutil_debug_message("error: null pointer given to file_close");
return;
}
2013-05-22 16:29:30 +02:00
@@ -277,14 +269,12 @@
{
int fd = fileno(file->f);
void* base = mmap((void*) 0, len, PROT_READ, MAP_SHARED, fd, offset);
- const char* err;
+ //const char* err;
if (!base) {
- err = sys_error_msg();
- bncsutil_debug_message_a("error: failed to map %u bytes of %s "
- "starting at %u into memory; %s", len, file->filename, offset,
- err);
- free_sys_error_msg(err);
+ //err = sys_error_msg();
+ //bncsutil_debug_message_a("error: failed to map %u bytes of %s starting at %u into memory; %s", len, file->filename, offset, err);
+ //free_sys_err_msg(err);
return (void*) 0;
}
2013-05-22 16:29:30 +02:00
@@ -299,8 +289,7 @@
size_t len;
if (item == file->mappings.end()) {
- bncsutil_debug_message_a("warning: failed to unmap the block starting "
- "at %p from %s; unknown block.", base, file->filename);
+ //bncsutil_debug_message_a("warning: failed to unmap the block starting at %p from %s; unknown block.", base, file->filename);
return;
}
2013-05-22 16:29:30 +02:00
Index: src/bncsutil/keytables.h
===================================================================
--- src/bncsutil/keytables.h (revision 5)
+++ src/bncsutil/keytables.h (working copy)
@@ -128,4 +128,4 @@
} // extern "C"
#endif
2013-05-22 16:29:30 +02:00
-#endif /* BNCSUTIL_KEYTABLES_H */
\ No newline at end of file
+#endif /* BNCSUTIL_KEYTABLES_H */
2013-05-22 16:29:30 +02:00
Index: src/bncsutil/libinfo.cpp
===================================================================
--- src/bncsutil/libinfo.cpp (revision 5)
+++ src/bncsutil/libinfo.cpp (working copy)
@@ -49,9 +49,8 @@
rev = ver;
if (rev > 99 || rev < 0) return 0;
- printed = std::sprintf(outBuf, "%u.%u.%u", major, minor, rev);
+ printed = std::sprintf(outBuf, "%lu.%lu.%lu", major, minor, rev);
if (printed < 0) return 0;
outBuf[8] = '\0';
return printed;
}
2013-05-22 16:29:30 +02:00
-
\ No newline at end of file
Index: src/bncsutil/mutil.h
===================================================================
--- src/bncsutil/mutil.h (revision 5)
+++ src/bncsutil/mutil.h (working copy)
@@ -27,6 +27,9 @@
#ifndef MUTIL_H
#define MUTIL_H
+#define LITTLEENDIAN 1
+
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
2013-05-22 16:29:30 +02:00
@@ -35,6 +38,13 @@
#include "mutil_types.h"
#include <stdlib.h>
+// functions for converting a string to a 64-bit number.
+#if defined(_MSC_VER)
+#define ATOL64(x) _atoi64(x)
+#else
+#define ATOL64(x) atoll(x)
+#endif
+
#ifdef _MSC_VER
#pragma intrinsic(_lrotl,_lrotr) /* use intrinsic compiler rotations */
#define ROL(x,n) _lrotl((x),(n))
2013-05-22 16:29:30 +02:00
@@ -163,6 +173,6 @@
#define NULL 0
#endif /* NULL */
-#include <bncsutil/debug.h>
+// #include <bncsutil/debug.h>
#endif /* MUTIL_H */
2013-05-22 16:29:30 +02:00
Index: src/bncsutil/mutil_types.h
===================================================================
--- src/bncsutil/mutil_types.h (revision 5)
+++ src/bncsutil/mutil_types.h (working copy)
@@ -26,6 +26,10 @@
#ifndef BNCSUTIL_MUTIL_TYPES_H_INCLUDED
#define BNCSUTIL_MUTIL_TYPES_H_INCLUDED
+#ifdef WIN32
+ #include "ms_stdint.h"
+#else
+
#if defined(_MSC_VER) || (defined(HAVE_STDINT_H) && !HAVE_STDINT_H)
// no stdint.h available
// so just wing it
2013-05-22 16:29:30 +02:00
@@ -136,4 +140,6 @@
#include <stdint.h>
#endif
+#endif /* WIN32 */
+
#endif /* BNCSUTIL_MUTIL_TYPES_H_INCLUDED */
2013-05-22 16:29:30 +02:00
Index: src/bncsutil/oldauth.cpp
===================================================================
--- src/bncsutil/oldauth.cpp (revision 5)
+++ src/bncsutil/oldauth.cpp (working copy)
@@ -64,4 +64,4 @@
bncsutil_debug_message_a("hashPassword(\"%s\") =", password);
bncsutil_debug_dump(outBuffer, 20);
#endif
2013-05-22 16:29:30 +02:00
-}
\ No newline at end of file
+}
2013-05-22 16:29:30 +02:00
Index: src/bncsutil/oldauth.h
===================================================================
--- src/bncsutil/oldauth.h (revision 5)
+++ src/bncsutil/oldauth.h (working copy)
@@ -46,4 +46,4 @@
} // extern "C"
#endif
2013-05-22 16:29:30 +02:00
-#endif /* BNCSUTIL_OLDAUTH_H */
\ No newline at end of file
+#endif /* BNCSUTIL_OLDAUTH_H */
2013-05-22 16:29:30 +02:00
Index: src/bncsutil/pe.c
===================================================================
--- src/bncsutil/pe.c (revision 5)
+++ src/bncsutil/pe.c (working copy)
@@ -37,7 +37,7 @@
cm_pe_optional_header_t* opt_header;
cm_pe_windows_header_t* win_header;
long pe_offset = 0;
- size_t i;
+ //size_t i;
size_t count;
pe = (cm_pe_t) malloc(sizeof(struct cm_pe));
2013-05-22 16:29:30 +02:00
@@ -296,7 +296,7 @@
cm_stack_push(stack, root);
- while (dir = (cm_pe_resdir_t*) cm_stack_pop(stack)) {
+ while ( (dir = (cm_pe_resdir_t*) cm_stack_pop(stack)) ) {
while (dir->subdir_count + dir->resource_count <
dir->named_entry_count + dir->id_entry_count)
{
2013-05-22 16:29:30 +02:00
@@ -376,7 +376,7 @@
cm_stack_push(stack, root);
- while (dir = cm_stack_pop(stack)) {
+ while ( (dir = cm_stack_pop(stack)) ) {
if (dir->subdir_count) {
dir->subdir_count--;
cm_stack_push(stack, dir);
2013-05-22 16:29:30 +02:00
@@ -481,4 +481,4 @@
dir->offset = (uint32_t) ftell(f);
return 1;
2013-05-22 16:29:30 +02:00
-}
\ No newline at end of file
+}
2013-05-22 16:29:30 +02:00
Index: src/bncsutil/stack.c
===================================================================
--- src/bncsutil/stack.c (revision 5)
+++ src/bncsutil/stack.c (working copy)
@@ -20,7 +20,8 @@
* A copy of the GNU Lesser General Public License is included in the BNCSutil
* distribution in the file COPYING. If you did not receive this copy,
* write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston,
+ * Boston, MA 02111-1307 USA
+ */
/*
* Mule Server
2013-05-22 16:29:30 +02:00
@@ -109,4 +110,4 @@
return 0;
return stack->size;
2013-05-22 16:29:30 +02:00
-}
\ No newline at end of file
+}
2013-05-22 16:29:30 +02:00
Index: src/bncsutil/stack.h
===================================================================
--- src/bncsutil/stack.h (revision 5)
+++ src/bncsutil/stack.h (working copy)
@@ -51,4 +51,4 @@
void* cm_stack_peek(cm_stack_t stack);
unsigned int cm_stack_size(cm_stack_t stack);
2013-05-22 16:29:30 +02:00
-#endif
\ No newline at end of file
+#endif