Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
asapo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joao Alvim Oliveira Dias De Almeida
asapo
Commits
08076ad8
Commit
08076ad8
authored
7 years ago
by
Carsten Patzke
Browse files
Options
Downloads
Patches
Plain Diff
Fixed build on windows
parent
6c842a75
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/cpp/src/system_io/system_io_windows.cpp
+18
-20
18 additions, 20 deletions
common/cpp/src/system_io/system_io_windows.cpp
with
18 additions
and
20 deletions
common/cpp/src/system_io/system_io_windows.cpp
+
18
−
20
View file @
08076ad8
...
...
@@ -5,8 +5,9 @@
#include
<algorithm>
#include
<io.h>
#include
<windows.h>
#include
<fcntl.h>
#include
<iostream>
#include
<direct.h>
using
std
::
string
;
...
...
@@ -19,29 +20,30 @@ Error IOErrorFromGetLastError() {
DWORD
last_error
=
GetLastError
();
switch
(
last_error
)
{
case
ERROR_SUCCESS
:
return
IOErrors
::
kNoErro
r
;
return
nullpt
r
;
case
ERROR_PATH_NOT_FOUND
:
case
ERROR_FILE_NOT_FOUND
:
return
IOError
s
::
kFileNotFound
;
return
IOError
Template
::
kFileNotFound
.
Copy
()
;
case
ERROR_ACCESS_DENIED
:
return
IOError
s
::
kPermissionDenied
;
return
IOError
Template
::
kPermissionDenied
.
Copy
()
;
case
ERROR_CONNECTION_REFUSED
:
return
IOError
s
::
kConnectionRefused
;
return
IOError
Template
::
kConnectionRefused
.
Copy
()
;
case
WSAEFAULT
:
return
IOError
s
::
kInvalidMemoryAddress
;
return
IOError
Template
::
kInvalidMemoryAddress
.
Copy
()
;
case
WSAECONNRESET
:
return
IOError
s
::
kConnectionResetByPeer
;
return
IOError
Template
::
kConnectionResetByPeer
.
Copy
()
;
case
WSAENOTSOCK
:
return
IOError
s
::
kSocketOperationOnNonSocket
;
return
IOError
Template
::
kSocketOperationOnNonSocket
.
Copy
()
;
case
WSAEWOULDBLOCK
:
return
IOError
s
::
kResourceTemporarilyUnavailable
;
return
IOError
Template
::
kResourceTemporarilyUnavailable
.
Copy
()
;
case
WSAECONNREFUSED
:
return
IOError
s
::
kConnectionRefused
;
return
IOError
Template
::
kConnectionRefused
.
Copy
()
;
default:
std
::
cout
<<
"[IOErrorFromGetLastError] Unknown error code: "
<<
last_error
<<
std
::
endl
;
return
IOErrors
::
kUnknownError
;
Error
err
=
IOErrorTemplate
::
kUnknownError
.
Copy
();
(
*
err
).
Append
(
"Unknown error code: "
+
std
::
to_string
(
errno
));
return
err
;
}
return
err
;
}
Error
SystemIO
::
GetLastError
()
const
{
...
...
@@ -99,7 +101,7 @@ bool IsDirectory(const WIN32_FIND_DATA f) {
strstr
(
f
.
cFileName
,
"."
)
==
nullptr
;
}
FileInfo
GetFileInfo_win
(
const
WIN32_FIND_DATA
&
f
,
const
string
&
name
,
Error
*
err
)
{
FileInfo
GetFileInfo_win
(
const
WIN32_FIND_DATA
&
f
,
const
string
&
name
,
Error
*
err
)
{
FileInfo
file_info
;
file_info
.
modify_date
=
FileTime2TimePoint
(
f
.
ftLastWriteTime
,
err
);
...
...
@@ -119,7 +121,7 @@ FileInfo GetFileInfo_win(const WIN32_FIND_DATA& f, const string& name, Error* er
}
FileInfo
GetFileInfo
(
const
string
&
name
,
Error
*
err
)
{
FileInfo
SystemIO
::
GetFileInfo
(
const
std
::
string
&
name
,
Error
*
err
)
const
{
WIN32_FIND_DATA
f
;
auto
hFind
=
FindFirstFile
(
name
.
c_str
()
,
&
f
);
...
...
@@ -132,9 +134,8 @@ FileInfo GetFileInfo(const string& name, Error* err) {
return
GetFileInfo_win
(
f
,
name
,
err
);
}
void
ProcessFileEntity
(
const
WIN32_FIND_DATA
&
f
,
const
std
::
string
&
path
,
FileInfos
*
files
,
Error
*
err
)
{
FileInfos
*
files
,
Error
*
err
)
{
*
err
=
nullptr
;
if
(
f
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
{
...
...
@@ -146,12 +147,9 @@ void ProcessFileEntity(const WIN32_FIND_DATA& f, const std::string& path,
return
;
}
file_info
.
base_name
=
f
.
cFileName
;
file_info
.
relative_path
=
path
;
files
->
push_back
(
file_info
);
}
void
SystemIO
::
CollectFileInformationRecursivly
(
const
std
::
string
&
path
,
FileInfos
*
files
,
Error
*
err
)
const
{
WIN32_FIND_DATA
find_data
;
...
...
@@ -182,7 +180,7 @@ void SystemIO::CollectFileInformationRecursivly(const std::string& path,
}
void
hidra2
::
SystemIO
::
ApplyNetworkOptions
(
SocketDescriptor
socket_fd
,
IO
Error
s
*
err
)
const
{
void
hidra2
::
SystemIO
::
ApplyNetworkOptions
(
SocketDescriptor
socket_fd
,
Error
*
err
)
const
{
//TODO: Seeing issues when using these settings - need further investigation
//Event if NonBlockingIO is set, it seems that _recv is a blocking call :/
/*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment