This website works better with JavaScript.
Home
Help
Register
Sign In
mirrors
/
libowfat
mirror of
/home/gitosis/repositories/libowfat.git
Watch
1
Star
0
Fork
0
Code
Releases
1
Activity
Browse Source
half-hearted improvements to Windows compilability
master
Felix von Leitner
1 year ago
parent
62b1800438
commit
5945afed04
9 changed files
with
38 additions
and
26 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+3
-3
array/iarray_allocate.c
+4
-3
array/iarray_free.c
+6
-0
fmt/fmt_httpdate.c
+6
-0
fmt/fmt_iso8601.c
+4
-4
mmap/mmap_private.c
+4
-4
mmap/mmap_read.c
+3
-4
mmap/mmap_readat.c
+4
-4
mmap/mmap_shared.c
+4
-4
mmap/mmap_unmap.c
+ 3
- 3
array/iarray_allocate.c
View File
@ -1,6 +1,6 @@
#
include
"likely.h"
#
include
<stdlib.h>
#
ifndef _
_MINGW32__
#
ifndef _
WIN32
#
include
<fcntl.h>
#
include
<sys/mman.h>
#
include
<unistd.h>
@ -13,7 +13,7 @@
#
endif
static
iarray_page
*
new_page
(
size_t
pagesize
)
{
#
ifdef _
_MINGW32__
#
ifdef _
WIN32
void
*
x
=
malloc
(
pagesize
)
;
if
(
x
=
=
0
)
return
0
;
#
else
@ -49,7 +49,7 @@ void* iarray_allocate(iarray* ia,size_t pos) {
p
=
&
(
*
p
)
-
>
next
;
}
if
(
newpage
)
#
ifdef _
_MINGW32__
#
ifdef _
WIN32
free
(
newpage
)
;
#
else
munmap
(
newpage
,
ia
-
>
bytesperpage
)
;
+ 4
- 3
array/iarray_free.c
View File
@ -1,14 +1,15 @@
#
include
<stdlib.h>
#
ifndef _
_MINGW32__
#
ifndef _
WIN32
#
include
<sys/mman.h>
#
e
ndif
#
e
lse
#
include
<unistd.h>
#
endif
#
include
"iarray.h"
static
void
freechain
(
iarray_page
*
p
,
size_t
pagesize
)
{
while
(
p
)
{
iarray_page
*
n
=
p
-
>
next
;
#
ifdef _
_MINGW32__
#
ifdef _
WIN32
free
(
p
)
;
#
else
munmap
(
p
,
pagesize
)
;
+ 6
- 0
fmt/fmt_httpdate.c
View File
@ -11,7 +11,13 @@ static unsigned int fmt_2digits(char* dest,int i) {
size_t
fmt_httpdate
(
char
*
dest
,
time_t
t
)
{
static
const
char
days
[
]
=
"
SunMonTueWedThuFriSat
"
;
static
const
char
months
[
]
=
"
JanFebMarAprMayJunJulAugSepOctNovDec
"
;
#
ifdef _WIN32
struct
tm
tmp
;
struct
tm
*
x
=
&
tmp
;
gmtime_s
(
&
tmp
,
&
t
)
;
/
/
can
'
t
recover
from
when
this
fails
#
else
struct
tm
*
x
=
gmtime
(
&
t
)
;
#
endif
size_t
i
;
if
(
dest
=
=
0
)
return
29
;
+ 6
- 0
fmt/fmt_iso8601.c
View File
@ -9,7 +9,13 @@ static unsigned int fmt_2digits(char* dest,int i) {
}
size_t
fmt_iso8601
(
char
*
dest
,
time_t
t
)
{
#
ifdef _WIN32
struct
tm
tmp
;
struct
tm
*
x
=
&
tmp
;
gmtime_s
(
&
tmp
,
&
t
)
;
/
/
can
'
t
recover
from
when
this
fails
#
else
struct
tm
*
x
=
gmtime
(
&
t
)
;
#
endif
size_t
i
;
if
(
dest
=
=
0
)
return
sizeof
(
"
2014-05-27T19:22:16Z
"
)
-
1
;
+ 4
- 4
mmap/mmap_private.c
View File
@ -1,15 +1,15 @@
#
include
<sys/types.h>
#
include
<unistd.h>
#
ifdef __MINGW32__
#
ifdef _WIN32
#
include
<windows.h>
#
else
#
include
<unistd.h>
#
include
<sys/mman.h>
#
endif
#
include
"open.h"
#
endif
#
include
"mmap.h"
char
*
mmap_private
(
const
char
*
filename
,
size_t
*
filesize
)
{
#
ifdef _
_MINGW32__
#
ifdef _
WIN32
HANDLE
fd
,
m
;
char
*
map
;
fd
=
CreateFile
(
filename
,
GENERIC_WRITE
|
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
0
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
0
)
;
+ 4
- 4
mmap/mmap_read.c
View File
@ -1,15 +1,15 @@
#
include
<sys/types.h>
#
include
<unistd.h>
#
ifdef __MINGW32__
#
ifdef _WIN32
#
include
<windows.h>
#
else
#
include
<unistd.h>
#
include
<sys/mman.h>
#
endif
#
include
"open.h"
#
endif
#
include
"mmap.h"
extern
const
char
*
mmap_read
(
const
char
*
filename
,
size_t
*
filesize
)
{
#
ifdef _
_MINGW32__
#
ifdef _
WIN32
HANDLE
fd
,
m
;
char
*
map
;
fd
=
CreateFile
(
filename
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
0
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
0
)
;
+ 3
- 4
mmap/mmap_readat.c
View File
@ -2,18 +2,17 @@
#
define _ATFILE_SOURCE
#
include
<sys/types.h>
#
include
<unistd.h>
#
ifndef __MINGW32__
#
ifndef _WIN32
#
include
<sys/stat.h>
#
include
<unistd.h>
#
include
<fcntl.h>
#
include
<sys/mman.h>
#
endif
#
include
"open.h"
#
endif
#
include
"mmap.h"
extern
const
char
*
mmap_readat
(
const
char
*
filename
,
size_t
*
filesize
,
int
dirfd
)
{
#
ifdef _
_MINGW32__
#
ifdef _
WIN32
return
0
;
#
else
int
fd
=
openat
(
dirfd
,
filename
,
O_RDONLY
)
;
+ 4
- 4
mmap/mmap_shared.c
View File
@ -1,15 +1,15 @@
#
include
<sys/types.h>
#
include
<unistd.h>
#
ifdef __MINGW32__
#
ifdef _WIN32
#
include
<windows.h>
#
else
#
include
<unistd.h>
#
include
<sys/mman.h>
#
endif
#
include
"open.h"
#
endif
#
include
"mmap.h"
extern
char
*
mmap_shared
(
const
char
*
filename
,
size_t
*
filesize
)
{
#
ifdef _
_MINGW32__
#
ifdef _
WIN32
HANDLE
fd
,
m
;
char
*
map
;
fd
=
CreateFile
(
filename
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
0
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
0
)
;
+ 4
- 4
mmap/mmap_unmap.c
View File
@ -1,15 +1,15 @@
#
include
<sys/types.h>
#
include
<unistd.h>
#
ifdef __MINGW32__
#
ifdef _WIN32
#
include
<windows.h>
#
else
#
include
<unistd.h>
#
include
<sys/mman.h>
#
endif
#
include
"open.h"
#
endif
#
include
"mmap.h"
int
mmap_unmap
(
const
char
*
mapped
,
size_t
maplen
)
{
#
ifdef _
_MINGW32__
#
ifdef _
WIN32
(
void
)
maplen
;
return
UnmapViewOfFile
(
mapped
)
?
0
:
-
1
;
#
else
Write
Preview
Loading…
Cancel
Save