dump_util: move into namespace ue2

This commit is contained in:
Justin Viiret 2017-03-29 15:08:16 +11:00 committed by Matthew Barr
parent 7d23a7e2d3
commit 1f3a000bfa
2 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016, Intel Corporation * Copyright (c) 2016-2017, Intel Corporation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
@ -33,6 +33,8 @@
using namespace std; using namespace std;
namespace ue2 {
FILE *fopen_or_throw(const char *path, const char *mode) { FILE *fopen_or_throw(const char *path, const char *mode) {
FILE *f = fopen(path, mode); FILE *f = fopen(path, mode);
if (!f) { if (!f) {
@ -40,3 +42,5 @@ FILE *fopen_or_throw(const char *path, const char *mode) {
} }
return f; return f;
} }
} // namespace ue2

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016, Intel Corporation * Copyright (c) 2016-2017, Intel Corporation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
@ -31,9 +31,13 @@
#include <cstdio> #include <cstdio>
namespace ue2 {
/** /**
* Same as fopen(), but on error throws an exception rather than returning NULL. * Same as fopen(), but on error throws an exception rather than returning NULL.
*/ */
FILE *fopen_or_throw(const char *path, const char *mode); FILE *fopen_or_throw(const char *path, const char *mode);
} // namespace ue2
#endif #endif