Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mullvad Browser
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
The Tor Project
Applications
Mullvad Browser
Commits
67367db8
Commit
67367db8
authored
25 years ago
by
waterson%netscape.com
Browse files
Options
Downloads
Patches
Plain Diff
Bug 4805. Re-wrote to be more paranoid. r=rjc,a=chofmann
parent
7ad66366
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rdf/datasource/src/nsHistoryDataSource.cpp
+76
-48
76 additions, 48 deletions
rdf/datasource/src/nsHistoryDataSource.cpp
with
76 additions
and
48 deletions
rdf/datasource/src/nsHistoryDataSource.cpp
+
76
−
48
View file @
67367db8
...
...
@@ -153,7 +153,7 @@ static nsIRDFResource* mResourceHistoryBySite;
static
nsIRDFResource
*
mResourceHistoryByDate
;
nsresult
ReadHistory
(
void
);
nsresult
ReadOneHistoryFile
(
nsInputFileStream
&
aStream
,
nsFileSpec
f
ileSpec
);
nsresult
ReadOneHistoryFile
(
nsInputFileStream
&
aStream
,
const
nsFileSpec
&
aF
ileSpec
);
nsresult
AddPageToGraph
(
const
char
*
url
,
const
PRUnichar
*
title
,
const
char
*
referer
,
PRUint32
visitCount
,
PRTime
date
);
nsresult
AddToDateHierarchy
(
PRTime
date
,
const
char
*
url
);
nsresult
getSiteOfURL
(
const
char
*
url
,
nsIRDFResource
**
resource
);
...
...
@@ -621,59 +621,87 @@ nsHistoryDataSource::ReadHistory(void)
nsresult
nsHistoryDataSource
::
ReadOneHistoryFile
(
nsInputFileStream
&
aStream
,
nsFileSpec
f
ileSpec
)
nsHistoryDataSource
::
ReadOneHistoryFile
(
nsInputFileStream
&
aStream
,
const
nsFileSpec
&
aF
ileSpec
)
{
nsresult
rv
=
NS_ERROR_FAILURE
;
nsAutoString
buffer
;
while
(
!
aStream
.
eof
()
&&
!
aStream
.
failed
())
{
nsresult
rv
=
NS_OK
;
char
c
=
aStream
.
get
();
if
((
c
!=
'\r'
)
&&
(
c
!=
'\n'
))
{
buffer
+=
c
;
}
else
{
int
n
=
0
;
char
*
title
,
*
url
,
*
referer
,
*
visitcount
,
*
date
;
PRTime
time
;
PRTime
fileTime
=
LL_ZERO
;
while
(
!
aStream
.
eof
()
&&
!
aStream
.
failed
())
{
nsresult
rv
;
char
*
aLine
=
buffer
.
ToNewCString
();
if
(
aLine
&&
PL_strlen
(
aLine
)
>
0
)
{
url
=
aLine
;
title
=
strchr
(
aLine
,
'\t'
)
+
1
;
*
(
title
-
1
)
=
'\0'
;
referer
=
strchr
(
title
,
'\t'
)
+
1
;
*
(
referer
-
1
)
=
'\0'
;
visitcount
=
strchr
(
referer
,
'\t'
)
+
1
;
*
(
visitcount
-
1
)
=
'\0'
;
date
=
strchr
(
visitcount
,
'\t'
)
+
1
;
*
(
date
-
1
)
=
'\0'
;
PR_ParseTimeString
(
date
,
0
,
&
time
);
if
(
LL_IS_ZERO
(
fileTime
))
{
PRExplodedTime
etime
;
fileTime
=
time
;
PR_ExplodeTime
(
time
,
PR_LocalTimeParameters
,
&
etime
);
if
(
etime
.
tm_yday
==
mSessionTime
.
tm_yday
)
{
mCurrentFileSpec
=
fileSpec
;
}
}
char
c
=
aStream
.
get
();
if
((
c
!=
'\r'
)
&&
(
c
!=
'\n'
))
{
buffer
+=
c
;
continue
;
}
AddPageToGraph
(
url
,
nsAutoString
(
title
).
GetUnicode
(),
referer
,
(
PRUint32
)
atol
(
visitcount
),
time
);
delete
[]
aLine
;
}
char
buf
[
256
];
char
*
p
=
buf
;
buffer
=
""
;
}
}
return
(
rv
);
if
(
buffer
.
Length
()
>=
sizeof
(
buf
))
p
=
new
char
[
buffer
.
Length
()
+
1
];
if
(
!
p
)
return
NS_ERROR_OUT_OF_MEMORY
;
buffer
.
ToCString
(
p
,
buffer
.
Length
()
+
1
);
if
(
PL_strlen
(
p
)
>
0
)
do
{
char
*
url
=
p
;
char
*
title
=
PL_strchr
(
p
,
'\t'
);
if
(
!
title
)
break
;
*
(
title
++
)
=
'\0'
;
char
*
referer
=
PL_strchr
(
title
,
'\t'
);
if
(
!
referer
)
break
;
*
(
referer
++
)
=
'\0'
;
char
*
visitcount
=
PL_strchr
(
referer
,
'\t'
);
if
(
!
visitcount
)
break
;
*
(
visitcount
++
)
=
'\0'
;
char
*
date
=
PL_strchr
(
visitcount
,
'\t'
);
if
(
!
date
)
break
;
*
(
date
++
)
=
'\0'
;
PRTime
time
;
PR_ParseTimeString
(
date
,
0
,
&
time
);
PRExplodedTime
etime
;
PR_ExplodeTime
(
time
,
PR_LocalTimeParameters
,
&
etime
);
// While we parse this file, check to see if it has any
// history elements in it from today. If it does, then
// we'll re-use it as the current history file.
//
// XXX Isn't this a little over-ambitious? I could see one
// file growing into a monstrous thing if somebody
// regularly stays up past midnight.
if
(
etime
.
tm_yday
==
mSessionTime
.
tm_yday
)
mCurrentFileSpec
=
aFileSpec
;
rv
=
AddPageToGraph
(
url
,
nsAutoString
(
title
).
GetUnicode
(),
referer
,
(
PRUint32
)
atol
(
visitcount
),
time
);
}
while
(
0
);
if
(
p
!=
buf
)
delete
[]
p
;
if
(
NS_FAILED
(
rv
))
return
rv
;
buffer
.
Truncate
();
}
return
NS_OK
;
}
...
...
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