Move the compile_commands database into build dir

This commit is contained in:
Kovid Goyal 2023-01-26 13:27:05 +05:30
parent 0ec5ae02e9
commit a92149c5b8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 4 additions and 6 deletions

2
.gitignore vendored
View File

@ -6,8 +6,6 @@
.bzrignore .bzrignore
.build-cache .build-cache
.cache .cache
/compile_commands.json
/link_commands.json
/src/calibre/plugins /src/calibre/plugins
/resources/images.qrc /resources/images.qrc
/resources/icons.rcc /resources/icons.rcc

View File

@ -301,7 +301,7 @@ class Build(Command):
def dump_db(self, name, db): def dump_db(self, name, db):
try: try:
with open(f'{name}_commands.json', 'w') as f: with open(f'build/{name}_commands.json', 'w') as f:
json.dump(db, f, indent=2) json.dump(db, f, indent=2)
except OSError as err: except OSError as err:
if err.errno != errno.EROFS: if err.errno != errno.EROFS:

View File

@ -164,7 +164,7 @@ speedup_create_texture(PyObject *self, PyObject *args, PyObject *kw) {
if (radius <= 0) { PyErr_SetString(PyExc_ValueError, "The radius must be positive"); return NULL; } if (radius <= 0) { PyErr_SetString(PyExc_ValueError, "The radius must be positive"); return NULL; }
if (width > 100000 || height > 10000) { PyErr_SetString(PyExc_ValueError, "The width or height is too large"); return NULL; } if (width > 100000 || height > 10000) { PyErr_SetString(PyExc_ValueError, "The width or height is too large"); return NULL; }
if (width < 1 || height < 1) { PyErr_SetString(PyExc_ValueError, "The width or height is too small"); return NULL; } if (width < 1 || height < 1) { PyErr_SetString(PyExc_ValueError, "The width or height is too small"); return NULL; }
snprintf(header, 99, "P6\n%d %d\n255\n", (int)width, (int)height); snprintf(header, sizeof(header)-1, "P6\n%d %d\n255\n", (int)width, (int)height); // NOLINT
kernel = (double*)calloc(weight * weight, sizeof(double)); kernel = (double*)calloc(weight * weight, sizeof(double));
if (kernel == NULL) { PyErr_NoMemory(); return NULL; } if (kernel == NULL) { PyErr_NoMemory(); return NULL; }
@ -177,7 +177,7 @@ speedup_create_texture(PyObject *self, PyObject *args, PyObject *kw) {
// Random noise, noisy pixels are blend_alpha, other pixels are 0 // Random noise, noisy pixels are blend_alpha, other pixels are 0
for (i = 0; i < width * height; i++) { for (i = 0; i < width * height; i++) {
if (((float)(rand()) / RAND_MAX) <= density) mask[i] = blend_alpha; if (((float)(rand()) / (float)RAND_MAX) <= density) mask[i] = blend_alpha;
} }
// Blur the noise using the gaussian kernel // Blur the noise using the gaussian kernel
@ -195,7 +195,7 @@ speedup_create_texture(PyObject *self, PyObject *args, PyObject *kw) {
} }
// Create the texture in PPM (P6) format // Create the texture in PPM (P6) format
memcpy(ppm, header, strlen(header)); memcpy(ppm, header, strlen(header)); // NOLINT
t = ppm + strlen(header); t = ppm + strlen(header);
for (i = 0, j = 0; j < width * height; i += 3, j += 1) { for (i = 0, j = 0; j < width * height; i += 3, j += 1) {
#define BLEND(src, dest) ( ((unsigned char)(src * mask[j])) + ((unsigned char)(dest * (1 - mask[j]))) ) #define BLEND(src, dest) ( ((unsigned char)(src * mask[j])) + ((unsigned char)(dest * (1 - mask[j]))) )