Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
fcddf194
Commit
fcddf194
authored
Nov 27, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 29, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cabarc: Use CRT allocation functions.
parent
240e4387
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
17 deletions
+16
-17
cabarc.c
programs/cabarc/cabarc.c
+16
-17
No files found.
programs/cabarc/cabarc.c
View file @
fcddf194
...
...
@@ -47,12 +47,12 @@ static WCHAR **opt_files;
static
void
*
CDECL
cab_alloc
(
ULONG
size
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
return
malloc
(
size
);
}
static
void
CDECL
cab_free
(
void
*
ptr
)
{
HeapFree
(
GetProcessHeap
(),
0
,
ptr
);
free
(
ptr
);
}
static
WCHAR
*
strdupAtoW
(
UINT
cp
,
const
char
*
str
)
...
...
@@ -61,7 +61,7 @@ static WCHAR *strdupAtoW( UINT cp, const char *str )
if
(
str
)
{
DWORD
len
=
MultiByteToWideChar
(
cp
,
0
,
str
,
-
1
,
NULL
,
0
);
if
((
ret
=
cab_
alloc
(
len
*
sizeof
(
WCHAR
)
)))
if
((
ret
=
m
alloc
(
len
*
sizeof
(
WCHAR
)
)))
MultiByteToWideChar
(
cp
,
0
,
str
,
-
1
,
ret
,
len
);
}
return
ret
;
...
...
@@ -73,7 +73,7 @@ static char *strdupWtoA( UINT cp, const WCHAR *str )
if
(
str
)
{
DWORD
len
=
WideCharToMultiByte
(
cp
,
0
,
str
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
((
ret
=
cab_
alloc
(
len
)))
if
((
ret
=
m
alloc
(
len
)))
WideCharToMultiByte
(
cp
,
0
,
str
,
-
1
,
ret
,
len
,
NULL
,
NULL
);
}
return
ret
;
...
...
@@ -236,21 +236,21 @@ static INT_PTR CDECL fci_get_open_info( char *name, USHORT *date, USHORT *time,
{
*
err
=
GetLastError
();
WINE_ERR
(
"failed to open %s: error %u
\n
"
,
wine_dbgstr_w
(
nameW
),
*
err
);
cab_
free
(
nameW
);
free
(
nameW
);
return
-
1
;
}
if
(
!
GetFileInformationByHandle
(
handle
,
&
info
))
{
*
err
=
GetLastError
();
CloseHandle
(
handle
);
cab_
free
(
nameW
);
free
(
nameW
);
return
-
1
;
}
FileTimeToDosDateTime
(
&
info
.
ftLastWriteTime
,
date
,
time
);
*
attribs
=
info
.
dwFileAttributes
&
(
_A_RDONLY
|
_A_HIDDEN
|
_A_SYSTEM
|
_A_ARCH
);
for
(
p
=
nameW
;
*
p
;
p
++
)
if
(
*
p
>=
0x80
)
break
;
if
(
*
p
)
*
attribs
|=
_A_NAME_IS_UTF
;
cab_
free
(
nameW
);
free
(
nameW
);
return
(
INT_PTR
)
handle
;
}
...
...
@@ -291,8 +291,7 @@ static void create_directories( const WCHAR *name )
WCHAR
*
path
,
*
p
;
/* create the directory/directories */
path
=
cab_alloc
(
(
lstrlenW
(
name
)
+
1
)
*
sizeof
(
WCHAR
)
);
lstrcpyW
(
path
,
name
);
path
=
wcsdup
(
name
);
p
=
wcschr
(
path
,
'\\'
);
while
(
p
!=
NULL
)
...
...
@@ -303,7 +302,7 @@ static void create_directories( const WCHAR *name )
*
p
=
'\\'
;
p
=
wcschr
(
p
+
1
,
'\\'
);
}
cab_
free
(
path
);
free
(
path
);
}
/* check if file name matches against one of the files specification */
...
...
@@ -349,7 +348,7 @@ static INT_PTR CDECL list_notify( FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pf
}
wprintf
(
L"%s
\n
"
,
nameW
);
}
cab_
free
(
nameW
);
free
(
nameW
);
return
0
;
default:
WINE_FIXME
(
"Unexpected notification type %d.
\n
"
,
fdint
);
...
...
@@ -394,7 +393,7 @@ static INT_PTR CDECL extract_notify( FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION
if
(
opt_dest_dir
)
{
path
=
cab_alloc
(
(
lstrlenW
(
opt_dest_dir
)
+
lstrlenW
(
file
)
+
1
)
*
sizeof
(
WCHAR
)
);
path
=
malloc
(
(
wcslen
(
opt_dest_dir
)
+
wcslen
(
file
)
+
1
)
*
sizeof
(
WCHAR
)
);
lstrcpyW
(
path
,
opt_dest_dir
);
lstrcatW
(
path
,
file
);
}
...
...
@@ -410,8 +409,8 @@ static INT_PTR CDECL extract_notify( FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION
}
else
ret
=
0
;
cab_
free
(
nameW
);
if
(
path
!=
file
)
cab_
free
(
path
);
free
(
nameW
);
if
(
path
!=
file
)
free
(
path
);
return
ret
;
case
fdintCLOSE_FILE_INFO
:
...
...
@@ -464,7 +463,7 @@ static BOOL add_file( HFCI fci, WCHAR *name )
}
ret
=
FCIAddFile
(
fci
,
path
,
filename
,
FALSE
,
fci_get_next_cab
,
fci_status
,
fci_get_open_info
,
opt_compression
);
cab_
free
(
path
);
free
(
path
);
return
ret
;
}
...
...
@@ -475,7 +474,7 @@ static BOOL add_directory( HFCI fci, WCHAR *dir )
WIN32_FIND_DATAW
data
;
BOOL
ret
=
TRUE
;
if
(
!
(
buffer
=
cab_alloc
(
(
lstrlenW
(
dir
)
+
MAX_PATH
+
2
)
*
sizeof
(
WCHAR
)
)))
return
FALSE
;
if
(
!
(
buffer
=
malloc
(
(
wcslen
(
dir
)
+
MAX_PATH
+
2
)
*
sizeof
(
WCHAR
)
)))
return
FALSE
;
lstrcpyW
(
buffer
,
dir
);
p
=
buffer
+
lstrlenW
(
buffer
);
if
(
p
>
buffer
&&
p
[
-
1
]
!=
'\\'
)
*
p
++
=
'\\'
;
...
...
@@ -498,7 +497,7 @@ static BOOL add_directory( HFCI fci, WCHAR *dir )
}
while
(
FindNextFileW
(
handle
,
&
data
));
FindClose
(
handle
);
}
cab_
free
(
buffer
);
free
(
buffer
);
return
TRUE
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment