Merge pull request #380 from RichardHitt/pull350
Closes issue 350. Fix stat64 and malloc.h problems
This commit is contained in:
commit
de4b4afe9d
|
@ -23,9 +23,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -33,9 +33,7 @@
|
||||||
#ifndef snprintf
|
#ifndef snprintf
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
#ifndef stat64
|
#define stat _stat64
|
||||||
#define stat64 _stat64
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
/* for INT_MAX */
|
/* for INT_MAX */
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -44,8 +42,6 @@
|
||||||
#define _LARGEFILE64_SOURCE
|
#define _LARGEFILE64_SOURCE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#include "hexchat-plugin.h"
|
#include "hexchat-plugin.h"
|
||||||
|
|
||||||
#define BUFSIZE 32768
|
#define BUFSIZE 32768
|
||||||
|
@ -172,7 +168,7 @@ static int
|
||||||
dccrecv_cb (char *word[], void *userdata)
|
dccrecv_cb (char *word[], void *userdata)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
struct stat64 buffer; /* buffer for storing file info */
|
struct stat buffer; /* buffer for storing file info */
|
||||||
char sum[65]; /* buffer for checksum */
|
char sum[65]; /* buffer for checksum */
|
||||||
char *file;
|
char *file;
|
||||||
if (hexchat_get_prefs (ph, "dcc_completed_dir", &file, NULL) == 1 && file[0] != 0)
|
if (hexchat_get_prefs (ph, "dcc_completed_dir", &file, NULL) == 1 && file[0] != 0)
|
||||||
|
@ -184,7 +180,7 @@ dccrecv_cb (char *word[], void *userdata)
|
||||||
file = g_strdup(word[2]);
|
file = g_strdup(word[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = stat64 (file, &buffer);
|
result = stat (file, &buffer);
|
||||||
if (result == 0) /* stat returns 0 on success */
|
if (result == 0) /* stat returns 0 on success */
|
||||||
{
|
{
|
||||||
if (buffer.st_size <= (unsigned long long) get_limit () * 1048576)
|
if (buffer.st_size <= (unsigned long long) get_limit () * 1048576)
|
||||||
|
@ -213,10 +209,10 @@ static int
|
||||||
dccoffer_cb (char *word[], void *userdata)
|
dccoffer_cb (char *word[], void *userdata)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
struct stat64 buffer; /* buffer for storing file info */
|
struct stat buffer; /* buffer for storing file info */
|
||||||
char sum[65]; /* buffer for checksum */
|
char sum[65]; /* buffer for checksum */
|
||||||
|
|
||||||
result = stat64 (word[3], &buffer);
|
result = stat (word[3], &buffer);
|
||||||
if (result == 0) /* stat returns 0 on success */
|
if (result == 0) /* stat returns 0 on success */
|
||||||
{
|
{
|
||||||
if (buffer.st_size <= (unsigned long long) get_limit () * 1048576)
|
if (buffer.st_size <= (unsigned long long) get_limit () * 1048576)
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
|
||||||
#include "../../config-win32.h"
|
#include "../../config-win32.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
Loading…
Reference in New Issue