Rizin
unix-like reverse engineering framework and cli tools
zip_source_file_win32_utf8.c File Reference

Go to the source code of this file.

Functions

ZIP_EXTERN zip_source_tzip_source_file (zip_t *za, const char *fname, zip_uint64_t start, zip_int64_t len)
 
ZIP_EXTERN zip_source_tzip_source_file_create (const char *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error)
 

Function Documentation

◆ zip_source_file()

ZIP_EXTERN zip_source_t* zip_source_file ( zip_t za,
const char *  fname,
zip_uint64_t  start,
zip_int64_t  len 
)

Definition at line 37 of file zip_source_file_win32_utf8.c.

37  {
38  if (za == NULL) {
39  return NULL;
40  }
41 
43 }
size_t len
Definition: 6502dis.c:15
#define NULL
Definition: cris-opc.c:27
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
Definition: sflib.h:133
zip_error_t error
Definition: zipint.h:281
ZIP_EXTERN zip_source_t * zip_source_file_create(const char *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error)
zip_t * za
Definition: ziptool.c:79

References zip::error, create_tags_rz::fname, len, NULL, start, za, and zip_source_file_create().

Referenced by add_file().

◆ zip_source_file_create()

ZIP_EXTERN zip_source_t* zip_source_file_create ( const char *  fname,
zip_uint64_t  start,
zip_int64_t  length,
zip_error_t error 
)

Definition at line 47 of file zip_source_file_win32_utf8.c.

47  {
48  int size;
49  wchar_t *wfname;
51 
52  if (fname == NULL || length < -1) {
54  return NULL;
55  }
56 
57  /* Convert fname from UTF-8 to Windows-friendly UTF-16. */
58  size = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, fname, -1, NULL, 0);
59  if (size == 0) {
61  return NULL;
62  }
63  if ((wfname = (wchar_t *)malloc(sizeof(wchar_t) * size)) == NULL) {
65  return NULL;
66  }
67  MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, fname, -1, wfname, size);
68 
70 
71  free(wfname);
72  return source;
73 }
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
Definition: sflib.h:133
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void uLong size
Definition: ioapi.h:138
ZIP_EXTERN void zip_error_set(zip_error_t *_Nullable, int, int)
Definition: zip_error.c:126
#define ZIP_ER_MEMORY
Definition: zip.h:119
#define ZIP_ER_INVAL
Definition: zip.h:123
void * malloc(size_t size)
Definition: malloc.c:123
const char * source
Definition: lz4.h:699
void error(const char *msg)
Definition: untgz.c:593
ZIP_EXTERN zip_source_t * zip_source_win32w_create(const wchar_t *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error)

References error(), create_tags_rz::fname, free(), length, malloc(), NULL, source, start, ZIP_ER_INVAL, ZIP_ER_MEMORY, zip_error_set(), and zip_source_win32w_create().

Referenced by zip_source_file().