Skip to content

Commit f96ce00

Browse files
committed
Fix export and remove strlcpy usage
1 parent c1f3fcc commit f96ce00

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

win32/glob.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
#include "readdir.h"
6767

6868
#include <errno.h>
69-
#include <string.h> /* For strcmp() */
69+
#include <string.h>
7070

7171
#define DOLLAR '$'
7272
#define DOT '.'
@@ -139,7 +139,7 @@ static bool match(Char *, Char *, Char *);
139139
static void qprintf(const char *, Char *);
140140
#endif
141141

142-
PW32IO int glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)
142+
PHP_WIN_GLOB int glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)
143143
{
144144
const uint8_t *patnext;
145145
int c;
@@ -726,7 +726,7 @@ static bool match(Char *name, Char *pat, Char *patend)
726726
}
727727

728728
/* Free allocated data belonging to a glob_t structure. */
729-
PW32IO void globfree(glob_t *pglob)
729+
PHP_WIN_GLOB void globfree(glob_t *pglob)
730730
{
731731
register int i;
732732
register char **pp;
@@ -746,7 +746,7 @@ static DIR * g_opendir(Char *str, glob_t *pglob)
746746
char buf[MAXPATHLEN];
747747

748748
if (!*str)
749-
strlcpy(buf, ".", sizeof(buf));
749+
memcpy(buf, ".", strlen("."));
750750
else {
751751
if (g_Ctoc(str, buf, sizeof(buf)))
752752
return(NULL);

win32/glob.h

+8-3
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,13 @@
4242
#ifndef _GLOB_H_
4343
#define _GLOB_H_
4444

45+
#ifdef PHP_EXPORTS
46+
# define PHP_WIN_GLOB __declspec(dllexport)
47+
#else
48+
# define PHP_WIN_GLOB __declspec(dllimport)
49+
#endif
50+
4551
#include <stddef.h>
46-
#include "ioutil.h"
4752

4853
typedef struct {
4954
size_t gl_pathc; /* Count of total paths so far. */
@@ -77,7 +82,7 @@ typedef struct {
7782
#define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK not set. */
7883

7984
BEGIN_EXTERN_C()
80-
PW32IO int glob(const char *, int, int (*)(const char *, int), glob_t *);
81-
PW32IO void globfree(glob_t *);
85+
PHP_WIN_GLOB int glob(const char *, int, int (*)(const char *, int), glob_t *);
86+
PHP_WIN_GLOB void globfree(glob_t *);
8287
END_EXTERN_C()
8388
#endif /* !_GLOB_H_ */

0 commit comments

Comments
 (0)