Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
kehengzhong authored Jul 18, 2021
1 parent 1cf9825 commit f2b70c2
Show file tree
Hide file tree
Showing 7 changed files with 276 additions and 230 deletions.
8 changes: 1 addition & 7 deletions include/btype.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@


#ifdef _WIN32
#pragma comment(lib,"Ws2_32.lib")
#include <winsock2.h>
#include <ws2tcpip.h>
#pragma comment(lib,"Ws2_32.lib")
#include <windows.h>
#include <io.h>
#endif

#include <stdio.h>
Expand Down Expand Up @@ -161,10 +159,6 @@ struct iovec {
#define strtoull strtoul
#endif

#ifndef strcpy
#define strcpy winstrcpy
#endif

int gettimeofday(struct timeval *tv, struct timezone *tz);

#pragma warning(disable : 4996)
Expand Down
17 changes: 10 additions & 7 deletions include/chunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ typedef struct chunk_entity {
#endif
void * pbyte;
void * pmap;
size_t maplen;
off_t mapoff;
int64 maplen;
int64 mapoff;
int64 offset;
int64 fsize;
long inode;
Expand All @@ -74,8 +74,8 @@ typedef struct chunk_entity {
#endif
void * pbyte;
void * pmap;
size_t maplen;
off_t mapoff;
int64 maplen;
int64 mapoff;
int64 offset;
int64 fsize;
long inode;
Expand All @@ -89,8 +89,8 @@ typedef struct chunk_entity {
#endif
void * pbyte;
void * pmap;
size_t maplen;
off_t mapoff;
int64 maplen;
int64 mapoff;
int64 offset;
int64 fsize;
long inode;
Expand Down Expand Up @@ -216,7 +216,7 @@ int chunk_remove (void * vck, int64 pos, int httpchunk);


typedef struct {
uint8 vectype; //0-unknown 1-mem buffer 1-file
uint8 vectype; //0-unknown 1-mem buffer 2-file

int64 offset; //offset from the begining of the chunk
int64 size; //available size
Expand All @@ -225,6 +225,9 @@ typedef struct {
int iovcnt;

int filefd;
#ifdef _WIN32
HANDLE hfile;
#endif
int64 fpos; //file current offset
int64 filesize; //actual file size
} chunk_vec_t;
Expand Down
9 changes: 6 additions & 3 deletions include/fileop.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ int file_conv_charset (char * srcchst, char * dstchst, char * srcfile, char * ds

int WinPath2UnixPath (char * path, int len);
int UnixPath2WinPath (char * path, int len);
#ifdef _WIN32
char * realpath (char * path, char * resolvpath);
#endif

char * file_extname (char * file);
char * file_basename (char * file);
Expand All @@ -66,9 +69,9 @@ int file_get_absolute_path (char * relative, char * abs, int abslen);
int file_mime_type (void * mimemgmt, char * fname, char * pmime, uint32 * mimeid, uint32 * appid);

#ifdef UNIX
void * file_mmap (void * addr, int fd, off_t offset, size_t length, int prot, int flags,
void ** ppmap, size_t * pmaplen, off_t * pmapoff);
int file_munmap (void * pmap, size_t maplen);
void * file_mmap (void * addr, int fd, int64 offset, int64 length, int prot, int flags,
void ** ppmap, int64 * pmaplen, int64 * pmapoff);
int file_munmap (void * pmap, int64 maplen);
#endif

#ifdef _WIN32
Expand Down
4 changes: 2 additions & 2 deletions include/fragpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ int64 frag_pack_length (void * vfrag);
int64 frag_pack_rcvlen (void * vfrag, int * fragnum);
int64 frag_pack_curlen (void * vfrag);

int frag_pack_read (void * vfrag, int fd, int64 pos);
int frag_pack_write (void * vfrag, int fd, int64 pos);
int frag_pack_read (void * vfrag, void * hfile, int64 pos);
int frag_pack_write (void * vfrag, void * hfile, int64 pos);

int frag_pack_add (void * vfrag, int64 pos, int64 len);
int frag_pack_del (void * vfrag, int64 pos, int64 len);
Expand Down
3 changes: 3 additions & 0 deletions include/nativefile.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ int native_file_close (void * hfile);
int native_file_read (void * hfile, void * buf, int size);
int native_file_write (void * hfile, void * buf, int size);
int native_file_seek (void * hfile, int64 offset);
int native_file_copy (void * vsrc, int64 offset, int64 length, void * vdst, int64 * actnum);
int native_file_resize (void * hfile, int64 newsize);

char * native_file_name (void * vhfile);

#ifdef _WIN32
HANDLE native_file_handle (void * vhfile);
#endif
Expand Down
Loading

0 comments on commit f2b70c2

Please sign in to comment.