Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

partial fix for #148. #156

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions example/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ run iteration_macros.cpp ;
run iterator-property-map-eg.cpp ;
run johnson-eg.cpp ;
run kevin-bacon.cpp : $(TEST_DIR)/kevin-bacon.dat ;
run kevin-bacon2.cpp /boost/serialization//boost_serialization : $(TEST_DIR)/kevin-bacon2.dat ;
run king_ordering.cpp ;
run knights_tour.cpp ;
run kruskal-example.cpp ;
run kuratowski_subgraph.cpp ;
run last-mod-time.cpp /boost/filesystem//boost_filesystem : $(TEST_DIR)/makefile-dependencies.dat ;
run make_biconnected_planar.cpp ;
run make_connected.cpp ;
run make_maximal_planar.cpp ;
Expand Down Expand Up @@ -215,11 +217,6 @@ explicit girth ;
#
# run labeled_graph.cpp ;
#
# This one crashes at runtime:
#
# run kevin-bacon2.cpp /boost/serialization//boost_serialization : $(TEST_DIR)/kevin-bacon.dat ;
# Crashes with msvc-12.0:
# run last-mod-time.cpp : $(TEST_DIR)/makefile-dependencies.dat ;
#
# This one dereferences a null-iterator:
#
Expand Down
8 changes: 0 additions & 8 deletions example/kevin-bacon2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@
//=======================================================================


/*
IMPORTANT:
~~~~~~~~~~

This example appears to be broken and crashes at runtime, see https://github.com/boostorg/graph/issues/148

*/

#include <boost/config.hpp>
#include <iostream>
#include <fstream>
Expand Down
2 changes: 1 addition & 1 deletion example/kevin-bacon2.dat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22 serialization::archive 3 0 0 51 50 0 0 15 William Shatner 15 Denise Richards 11 Kevin Bacon 15 Patrick Stewart 12 Steve Martin 16 Gerard Depardieu 12 Clint Howard 10 Sean Astin 17 Theodore Hesburgh 12 Gerry Becker 11 Henry Fonda 13 Robert Wagner 11 Mark Hamill 11 Bill Paxton 13 Harrison Ford 11 Steve Altes 13 Alec Guinness 15 Theresa Russell 13 Carrie Fisher 14 Elisabeth Shue 12 Sean Connery 13 Peter Crombie 10 Dana Young 10 Bebe Drake 14 William Devane 11 A. Paliakov 16 Nikolai Brilling 14 Kathleen Byron 9 Tom Hanks 17 Zoya Barantsevich 13 Nikolai Panov 15 Zoia Karabanova 15 William Challee 11 P. Biryukov 16 Aleksandr Gromov 16 Yelena Maksimova 12 Lev Prygunov 13 Yelena Chaika 17 Viktor Tourjansky 14 Olga Baclanova 15 Angelo Rossitto 14 Christel Holch 12 Aage Schmidt 10 Valso Holm 13 Max von Sydow 10 Diane Lane 10 Val Kilmer 14 Marilyn Monroe 11 George Ives 14 Jacques Perrin 16 Vittorio Gassman 0 1 0 0 22 Loaded Weapon 1 (1993) 1 2 18 Wild Things (1998) 3 4 27 Prince of Egypt, The (1998) 4 2 16 Novocaine (2000) 5 6 23 Unhook the Stars (1996) 6 2 18 My Dog Skip (2000) 7 2 25 White Water Summer (1987) 8 9 11 Rudy (1993) 9 2 15 Sleepers (1996) 10 11 13 Midway (1976) 11 2 18 Wild Things (1998) 12 13 17 Slipstream (1989) 13 2 16 Apollo 13 (1995) 14 15 20 Random Hearts (1999) 15 2 17 Hollow Man (2000) 16 17 12 Kafka (1991) 17 2 18 Wild Things (1998) 18 19 15 Soapdish (1991) 19 2 17 Hollow Man (2000) 20 21 17 Rising Sun (1993) 21 2 18 My Dog Skip (2000) 22 23 23 Bersaglio mobile (1967) 23 24 33 Report to the Commissioner (1975) 25 26 14 Kutuzov (1944) 26 27 13 Otello (1955) 27 28 26 Saving Private Ryan (1998) 28 2 16 Apollo 13 (1995) 29 30 24 Slesar i kantzler (1923) 30 31 30 Zhenshchina s kinzhalom (1916) 31 32 26 Song to Remember, A (1945) 32 24 30 Irish Whiskey Rebellion (1972) 24 2 17 Hollow Man (2000) 33 34 20 Pikovaya dama (1910) 34 35 17 Tikhij Don (1930) 35 36 23 Bezottsovshchina (1976) 36 19 17 Saint, The (1997) 37 38 21 Ostrov zabenya (1917) 38 39 28 Zagrobnaya skitalitsa (1915) 39 40 13 Freaks (1932) 40 24 16 Dark, The (1979) 41 42 31 Hvide Slavehandel, Den (1910/I) 42 43 27 Begyndte ombord, Det (1937) 43 44 16 Spion 503 (1958) 44 45 18 Judge Dredd (1995) 45 2 18 My Dog Skip (2000) 46 19 17 Saint, The (1997) 47 48 14 Niagara (1953) 48 2 21 Stir of Echoes (1999) 49 50 30 Deserto dei tartari, Il (1976) 50 2 15 Sleepers (1996)
22 serialization::archive 3 0 0 51 50 0 0 15 William Shatner 15 Denise Richards 11 Kevin Bacon 15 Patrick Stewart 12 Steve Martin 16 Gerard Depardieu 12 Clint Howard 10 Sean Astin 17 Theodore Hesburgh 12 Gerry Becker 11 Henry Fonda 13 Robert Wagner 11 Mark Hamill 11 Bill Paxton 13 Harrison Ford 11 Steve Altes 13 Alec Guinness 15 Theresa Russell 13 Carrie Fisher 14 Elisabeth Shue 12 Sean Connery 13 Peter Crombie 10 Dana Young 10 Bebe Drake 14 William Devane 11 A. Paliakov 16 Nikolai Brilling 14 Kathleen Byron 9 Tom Hanks 17 Zoya Barantsevich 13 Nikolai Panov 15 Zoia Karabanova 15 William Challee 11 P. Biryukov 16 Aleksandr Gromov 16 Yelena Maksimova 12 Lev Prygunov 13 Yelena Chaika 17 Viktor Tourjansky 14 Olga Baclanova 15 Angelo Rossitto 14 Christel Holch 12 Aage Schmidt 10 Valso Holm 13 Max von Sydow 10 Diane Lane 10 Val Kilmer 14 Marilyn Monroe 11 George Ives 14 Jacques Perrin 16 Vittorio Gassman 0 1 0 0 22 Loaded Weapon 1 (1993) 1 2 18 Wild Things (1998) 3 4 27 Prince of Egypt, The (1998) 4 2 16 Novocaine (2000) 5 6 23 Unhook the Stars (1996) 6 2 18 My Dog Skip (2000) 7 2 25 White Water Summer (1987) 8 9 11 Rudy (1993) 9 2 15 Sleepers (1996) 10 11 13 Midway (1976) 11 2 18 Wild Things (1998) 12 13 17 Slipstream (1989) 13 2 16 Apollo 13 (1995) 14 15 20 Random Hearts (1999) 15 2 17 Hollow Man (2000) 16 17 12 Kafka (1991) 17 2 18 Wild Things (1998) 18 19 15 Soapdish (1991) 19 2 17 Hollow Man (2000) 20 21 17 Rising Sun (1993) 21 2 18 My Dog Skip (2000) 22 23 23 Bersaglio mobile (1967) 23 24 33 Report to the Commissioner (1975) 25 26 14 Kutuzov (1944) 26 27 13 Otello (1955) 27 28 26 Saving Private Ryan (1998) 28 2 16 Apollo 13 (1995) 29 30 24 Slesar i kantzler (1923) 30 31 30 Zhenshchina s kinzhalom (1916) 31 32 26 Song to Remember, A (1945) 32 24 30 Irish Whiskey Rebellion (1972) 24 2 17 Hollow Man (2000) 33 34 20 Pikovaya dama (1910) 34 35 17 Tikhij Don (1930) 35 36 23 Bezottsovshchina (1976) 36 19 17 Saint, The (1997) 37 38 21 Ostrov zabenya (1917) 38 39 28 Zagrobnaya skitalitsa (1915) 39 40 13 Freaks (1932) 40 24 16 Dark, The (1979) 41 42 31 Hvide Slavehandel, Den (1910/I) 42 43 27 Begyndte ombord, Det (1937) 43 44 16 Spion 503 (1958) 44 45 18 Judge Dredd (1995) 45 2 18 My Dog Skip (2000) 46 19 17 Saint, The (1997) 47 48 14 Niagara (1953) 48 2 21 Stir of Echoes (1999) 49 50 30 Deserto dei tartari, Il (1976) 50 2 15 Sleepers (1996) 0 0
22 changes: 7 additions & 15 deletions example/last-mod-time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
//=======================================================================


/*
IMPORTANT:
~~~~~~~~~~

This example appears to be broken and crashes at runtime, see https://github.com/boostorg/graph/issues/148

*/

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
Expand All @@ -24,11 +17,8 @@
#include <fstream>
#include <string>
#include <ctime>
#ifdef BOOST_HAS_UNISTD_H
#include <unistd.h>
#endif
#include <sys/stat.h>
#include <boost/graph/adjacency_list.hpp>
#include <boost/filesystem.hpp>

using namespace boost;

Expand Down Expand Up @@ -87,15 +77,17 @@ main(int argc, const char** argv)
iter_map_t mod_time_map(last_mod_vec.begin(), get(vertex_index, g));

property_map < graph_type, vertex_name_t >::type name = get(vertex_name, g);
struct stat stat_buf;
graph_traits < graph_type >::vertex_descriptor u;
typedef graph_traits < graph_type >::vertex_iterator vertex_iter_t;
std::pair < vertex_iter_t, vertex_iter_t > p;
for (p = vertices(g); p.first != p.second; ++p.first) {
u = *p.first;
if (stat(name[u].c_str(), &stat_buf) != 0)
std::cerr << "error in stat() for file " << name[u] << std::endl;
put(mod_time_map, u, stat_buf.st_mtime);
filesystem::path file_path(name[u]);
if (exists(file_path)) {
put(mod_time_map, u, filesystem::last_write_time(file_path));
} else {
put(mod_time_map, u, 0);
}
}

for (p = vertices(g); p.first != p.second; ++p.first) {
Expand Down