Compare commits

..

1 Commits

Author SHA1 Message Date
raxod502 a83d7d70e5 Use -fmacro-prefix-map for utils
The __FILE__ macro is used in the EXCEPTION macro to report the file
name alongside error messages. This macro reports the file name
exactly as it is passed to the compiler. For most source files in
libgourou this is a nice relative path such as "src/libgourou.cpp".
However, for EXCEPTION instances in libgourou_common.h, the compiler
flag is "-I$(ROOT)/include", where $(ROOT) is an absolute path passed
from the higher Makefile. This results in an absolute path to the
build directory being hardcoded into the utils shared library and
binaries, and reported in error messages. Besides being less readable
than the more common relative paths, this triggers warnings from
packaging tools that detect inadvertent references to temporary build
directories that end up in compiled binaries and might indicate a bug.

There is a GCC feature -fmacro-prefix-map which allows to perform
substition on the values that are used for __FILE__. Use that option
to strip out the absolute path component, without changing any
functionality.

The feature was added to GCC on 2018-01-18 and released in GCC 8.1.0.

https://github.com/gcc-mirror/gcc/commit/7365279fca30371b07e49bfa83a23ddc44cc3860
2026-03-08 14:28:37 -07:00
4 changed files with 8 additions and 19 deletions
+2 -2
View File
@@ -34,10 +34,10 @@
#endif
#ifndef ACS_SERVER
#define ACS_SERVER "https://adeactivate.adobe.com/adept"
#define ACS_SERVER "http://adeactivate.adobe.com/adept"
#endif
#define LIBGOUROU_VERSION "0.8.9"
#define LIBGOUROU_VERSION "0.8.8"
namespace gourou
{
+3 -10
View File
@@ -1513,8 +1513,7 @@ namespace gourou
}
}
/* Delete objects that reference EBX objects,
except in trailer and objects that references Info */
/* Delete objects that reference EBX objects, except in trailer */
for(it = objects.begin(); it != objects.end(); it++)
{
uPDFParser::Object* object = *it;
@@ -1523,18 +1522,12 @@ namespace gourou
{
uPDFParser::Reference* encrypt = (uPDFParser::Reference*)(*object)["Encrypt"];
if (object->hasKey("Info"))
{
object->deleteKey("Encrypt");
continue;
}
/* Delete EBX objects */
for(ebxIt = ebxObjects.begin(); ebxIt != ebxObjects.end(); ebxIt++)
{
if (encrypt->value() == (*ebxIt)->objectId())
{
GOUROU_LOG(DEBUG, "Delete stream id " << object->objectId());
GOUROU_LOG(ERROR, "Delete stream id " << object->objectId());
parser.removeObject(object);
break;
@@ -1547,7 +1540,7 @@ namespace gourou
for(it = ebxObjects.begin(); it != ebxObjects.end(); it++)
parser.removeObject(*it);
uPDFParser::Object& trailer = parser.getTrailer();
uPDFParser::Object& trailer = parser.getTrailer();
trailer.deleteKey("Encrypt");
parser.write(filenameOut);
+2 -2
View File
@@ -355,7 +355,7 @@ static void usage(const char* cmd)
std::cout << " " << "-l|--list" << "\t\t" << "List all loaned books" << std::endl;
std::cout << " " << "-r|--return" << "\t\t" << "Return a loaned book" << std::endl;
std::cout << " " << "-d|--delete" << "\t\t" << "Delete a loan entry without returning it" << std::endl;
std::cout << " " << "-N|--no-notify" << "\t" << "Don't notify server, even if requested" << std::endl;
std::cout << " " << "-N|--no-notify" << "\t\t" << "Don't notify server, even if requested" << std::endl;
std::cout << " " << "-v|--verbose" << "\t\t" << "Increase verbosity, can be set multiple times" << std::endl;
std::cout << " " << "-V|--version" << "\t\t" << "Display libgourou version" << std::endl;
std::cout << " " << "-h|--help" << "\t\t" << "This help" << std::endl;
@@ -396,7 +396,7 @@ int main(int argc, char** argv)
{0, 0, 0, 0 }
};
c = getopt_long(argc, argv, "d:lr:D:NvVh",
c = getopt_long(argc, argv, "d:lr:D:vVh",
long_options, &option_index);
if (c == -1)
break;
+1 -5
View File
@@ -88,11 +88,7 @@ public:
filename = std::string(inputFile);
if (outputDir)
{
char* basepath = strdup(inputFile);
filename = std::string(outputDir) + "/" + basename(basepath);
free(basepath);
}
filename = std::string(outputDir) + "/" + filename;
}
if (endsWith(filename, ".epub"))