Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
f3f49533
Commit
f3f49533
authored
12 years ago
by
Oz Linden
Browse files
Options
Downloads
Plain Diff
merge fixes for linux version numbers
parents
49ed1a4e
b3338955
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llcommon/llsys.cpp
+40
-39
40 additions, 39 deletions
indra/llcommon/llsys.cpp
with
40 additions
and
39 deletions
indra/llcommon/llsys.cpp
+
40
−
39
View file @
f3f49533
...
@@ -176,6 +176,39 @@ bool get_shell32_dll_version(DWORD& major, DWORD& minor, DWORD& build_number)
...
@@ -176,6 +176,39 @@ bool get_shell32_dll_version(DWORD& major, DWORD& minor, DWORD& build_number)
}
}
#endif // LL_WINDOWS
#endif // LL_WINDOWS
// Wrap boost::regex_match() with a function that doesn't throw.
template
<
typename
S
,
typename
M
,
typename
R
>
static
bool
regex_match_no_exc
(
const
S
&
string
,
M
&
match
,
const
R
&
regex
)
{
try
{
return
boost
::
regex_match
(
string
,
match
,
regex
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
LL_WARNS
(
"LLMemoryInfo"
)
<<
"error matching with '"
<<
regex
.
str
()
<<
"': "
<<
e
.
what
()
<<
":
\n
'"
<<
string
<<
"'"
<<
LL_ENDL
;
return
false
;
}
}
// Wrap boost::regex_search() with a function that doesn't throw.
template
<
typename
S
,
typename
M
,
typename
R
>
static
bool
regex_search_no_exc
(
const
S
&
string
,
M
&
match
,
const
R
&
regex
)
{
try
{
return
boost
::
regex_search
(
string
,
match
,
regex
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
LL_WARNS
(
"LLMemoryInfo"
)
<<
"error searching with '"
<<
regex
.
str
()
<<
"': "
<<
e
.
what
()
<<
":
\n
'"
<<
string
<<
"'"
<<
LL_ENDL
;
return
false
;
}
}
LLOSInfo
::
LLOSInfo
()
:
LLOSInfo
::
LLOSInfo
()
:
mMajorVer
(
0
),
mMinorVer
(
0
),
mBuild
(
0
),
mOSVersionString
(
""
)
mMajorVer
(
0
),
mMinorVer
(
0
),
mBuild
(
0
),
mOSVersionString
(
""
)
{
{
...
@@ -446,7 +479,7 @@ LLOSInfo::LLOSInfo() :
...
@@ -446,7 +479,7 @@ LLOSInfo::LLOSInfo() :
mOSString
=
mOSStringSimple
;
mOSString
=
mOSStringSimple
;
}
}
const
char
*
OS_VERSION_MATCH_EXPRESSION
[]
=
"([0-9]+)\.([0-9]+)(\.([0-9]+))?"
;
const
char
OS_VERSION_MATCH_EXPRESSION
[]
=
"([0-9]+)
\
\
.([0-9]+)(
\
\
.([0-9]+))?"
;
boost
::
regex
os_version_parse
(
OS_VERSION_MATCH_EXPRESSION
);
boost
::
regex
os_version_parse
(
OS_VERSION_MATCH_EXPRESSION
);
boost
::
smatch
matched
;
boost
::
smatch
matched
;
...
@@ -460,9 +493,9 @@ LLOSInfo::LLOSInfo() :
...
@@ -460,9 +493,9 @@ LLOSInfo::LLOSInfo() :
if
(
matched
[
1
].
matched
)
// Major version
if
(
matched
[
1
].
matched
)
// Major version
{
{
version_value
.
assign
(
matched
[
1
].
first
,
matched
[
1
].
second
);
version_value
.
assign
(
matched
[
1
].
first
,
matched
[
1
].
second
);
if
(
sscanf
(
"%d"
,
&
mMajorVer
)
!=
1
)
if
(
sscanf
(
version_value
.
c_str
(),
"%d"
,
&
mMajorVer
)
!=
1
)
{
{
LL_WARNS
(
"AppInit"
)
<<
"failed to parse major version '"
<<
version_value
"' as a number"
<<
LL_ENDL
;
LL_WARNS
(
"AppInit"
)
<<
"failed to parse major version '"
<<
version_value
<<
"' as a number"
<<
LL_ENDL
;
}
}
}
}
else
else
...
@@ -476,9 +509,9 @@ LLOSInfo::LLOSInfo() :
...
@@ -476,9 +509,9 @@ LLOSInfo::LLOSInfo() :
if
(
matched
[
2
].
matched
)
// Minor version
if
(
matched
[
2
].
matched
)
// Minor version
{
{
version_value
.
assign
(
matched
[
2
].
first
,
matched
[
2
].
second
);
version_value
.
assign
(
matched
[
2
].
first
,
matched
[
2
].
second
);
if
(
sscanf
(
"%d"
,
&
mMinorVer
)
!=
1
)
if
(
sscanf
(
version_value
.
c_str
(),
"%d"
,
&
mMinorVer
)
!=
1
)
{
{
LL_ERRS
(
"AppInit"
)
<<
"failed to parse minor version '"
<<
version_value
"' as a number"
<<
LL_ENDL
;
LL_ERRS
(
"AppInit"
)
<<
"failed to parse minor version '"
<<
version_value
<<
"' as a number"
<<
LL_ENDL
;
}
}
}
}
else
else
...
@@ -492,9 +525,9 @@ LLOSInfo::LLOSInfo() :
...
@@ -492,9 +525,9 @@ LLOSInfo::LLOSInfo() :
if
(
matched
[
4
].
matched
)
// Build version (optional) - note that [3] includes the '.'
if
(
matched
[
4
].
matched
)
// Build version (optional) - note that [3] includes the '.'
{
{
version_value
.
assign
(
matched
[
4
].
first
,
matched
[
4
].
second
);
version_value
.
assign
(
matched
[
4
].
first
,
matched
[
4
].
second
);
if
(
sscanf
(
"%d"
,
&
mBuild
)
!=
1
)
if
(
sscanf
(
version_value
.
c_str
(),
"%d"
,
&
mBuild
)
!=
1
)
{
{
LL_ERRS
(
"AppInit"
)
<<
"failed to parse build version '"
<<
version_value
"' as a number"
<<
LL_ENDL
;
LL_ERRS
(
"AppInit"
)
<<
"failed to parse build version '"
<<
version_value
<<
"' as a number"
<<
LL_ENDL
;
}
}
}
}
else
else
...
@@ -794,38 +827,6 @@ class Stats
...
@@ -794,38 +827,6 @@ class Stats
LLSD
mStats
;
LLSD
mStats
;
};
};
// Wrap boost::regex_match() with a function that doesn't throw.
template
<
typename
S
,
typename
M
,
typename
R
>
static
bool
regex_match_no_exc
(
const
S
&
string
,
M
&
match
,
const
R
&
regex
)
{
try
{
return
boost
::
regex_match
(
string
,
match
,
regex
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
LL_WARNS
(
"LLMemoryInfo"
)
<<
"error matching with '"
<<
regex
.
str
()
<<
"': "
<<
e
.
what
()
<<
":
\n
'"
<<
string
<<
"'"
<<
LL_ENDL
;
return
false
;
}
}
// Wrap boost::regex_search() with a function that doesn't throw.
template
<
typename
S
,
typename
M
,
typename
R
>
static
bool
regex_search_no_exc
(
const
S
&
string
,
M
&
match
,
const
R
&
regex
)
{
try
{
return
boost
::
regex_search
(
string
,
match
,
regex
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
LL_WARNS
(
"LLMemoryInfo"
)
<<
"error searching with '"
<<
regex
.
str
()
<<
"': "
<<
e
.
what
()
<<
":
\n
'"
<<
string
<<
"'"
<<
LL_ENDL
;
return
false
;
}
}
LLMemoryInfo
::
LLMemoryInfo
()
LLMemoryInfo
::
LLMemoryInfo
()
{
{
refresh
();
refresh
();
...
...
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