mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-11-05 12:03:03 -05:00
Make CodeQL happy
This commit is contained in:
parent
1acde49ce5
commit
57dc9a0bcb
@ -587,7 +587,7 @@ void PictureFlowPrivate::resetSlides()
|
|||||||
{
|
{
|
||||||
SlideInfo& si = leftSlides[i];
|
SlideInfo& si = leftSlides[i];
|
||||||
si.angle = itilt;
|
si.angle = itilt;
|
||||||
si.cx = -(offsetX + spacing*i*PFREAL_ONE);
|
si.cx = -(offsetX + (long)spacing*i*PFREAL_ONE);
|
||||||
si.cy = offsetY;
|
si.cy = offsetY;
|
||||||
si.slideIndex = centerIndex-1-i;
|
si.slideIndex = centerIndex-1-i;
|
||||||
//qDebug() << "Left[" << i << "] x=" << fixedToFloat(si.cx) << ", y=" << fixedToFloat(si.cy) ;
|
//qDebug() << "Left[" << i << "] x=" << fixedToFloat(si.cx) << ", y=" << fixedToFloat(si.cy) ;
|
||||||
@ -599,7 +599,7 @@ void PictureFlowPrivate::resetSlides()
|
|||||||
{
|
{
|
||||||
SlideInfo& si = rightSlides[i];
|
SlideInfo& si = rightSlides[i];
|
||||||
si.angle = -itilt;
|
si.angle = -itilt;
|
||||||
si.cx = offsetX + spacing*i*PFREAL_ONE;
|
si.cx = offsetX + (long)spacing*i*PFREAL_ONE;
|
||||||
si.cy = offsetY;
|
si.cy = offsetY;
|
||||||
si.slideIndex = centerIndex+1+i;
|
si.slideIndex = centerIndex+1+i;
|
||||||
//qDebug() << "Right[" << i << "] x=" << fixedToFloat(si.cx) << ", y=" << fixedToFloat(si.cy) ;
|
//qDebug() << "Right[" << i << "] x=" << fixedToFloat(si.cx) << ", y=" << fixedToFloat(si.cy) ;
|
||||||
@ -1118,7 +1118,7 @@ void PictureFlowPrivate::updateAnimation()
|
|||||||
speed = 512 + 16384 * (PFREAL_ONE+fsin(ia))/PFREAL_ONE;
|
speed = 512 + 16384 * (PFREAL_ONE+fsin(ia))/PFREAL_ONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
slideFrame += speed*step;
|
slideFrame += (long long)speed*step;
|
||||||
|
|
||||||
int index = slideFrame >> 16;
|
int index = slideFrame >> 16;
|
||||||
int pos = slideFrame & 0xffff;
|
int pos = slideFrame & 0xffff;
|
||||||
@ -1161,7 +1161,7 @@ void PictureFlowPrivate::updateAnimation()
|
|||||||
{
|
{
|
||||||
SlideInfo& si = leftSlides[i];
|
SlideInfo& si = leftSlides[i];
|
||||||
si.angle = itilt;
|
si.angle = itilt;
|
||||||
si.cx = -(offsetX + spacing*i*PFREAL_ONE + step*spacing*ftick);
|
si.cx = -(offsetX + (long)spacing*i*PFREAL_ONE + (long)step*spacing*ftick);
|
||||||
si.cy = offsetY;
|
si.cy = offsetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1169,7 +1169,7 @@ void PictureFlowPrivate::updateAnimation()
|
|||||||
{
|
{
|
||||||
SlideInfo& si = rightSlides[i];
|
SlideInfo& si = rightSlides[i];
|
||||||
si.angle = -itilt;
|
si.angle = -itilt;
|
||||||
si.cx = offsetX + spacing*i*PFREAL_ONE - step*spacing*ftick;
|
si.cx = offsetX + (long)spacing*i*PFREAL_ONE - (long)step*spacing*ftick;
|
||||||
si.cy = offsetY;
|
si.cy = offsetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -510,7 +510,7 @@ resample_raw_audio_16bit(PyObject *self, PyObject *args) {
|
|||||||
);
|
);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
if (ret < 0) { free_resources; return averror_as_python_with_gil_held(ret, __LINE__); }
|
if (ret < 0) { free_resources; return averror_as_python_with_gil_held(ret, __LINE__); }
|
||||||
output_size = ret * output_num_channels * bytes_per_sample;
|
output_size = (int64_t)ret * (int64_t)output_num_channels * bytes_per_sample;
|
||||||
PyObject *ans = PyBytes_FromStringAndSize((char*)output, output_size);
|
PyObject *ans = PyBytes_FromStringAndSize((char*)output, output_size);
|
||||||
free_resources;
|
free_resources;
|
||||||
#undef free_resources
|
#undef free_resources
|
||||||
|
|||||||
@ -174,7 +174,7 @@ static QImage convolve(const QImage &image, int matrix_size, float *matrix) {
|
|||||||
if (buffer.isNull()) throw std::bad_alloc();
|
if (buffer.isNull()) throw std::bad_alloc();
|
||||||
buf1.resize(matrix_size);
|
buf1.resize(matrix_size);
|
||||||
scanblock = buf1.data();
|
scanblock = buf1.data();
|
||||||
buf2.resize(matrix_size * matrix_size);
|
buf2.resize((qsizetype)matrix_size * matrix_size);
|
||||||
normalize_matrix = buf2.data();
|
normalize_matrix = buf2.data();
|
||||||
|
|
||||||
// create normalized matrix
|
// create normalized matrix
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
#define LZ_ONEBUFFER 1
|
#define LZ_ONEBUFFER 1
|
||||||
#define LAZY 1
|
#define LAZY 1
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h> /* for memset on Linux */
|
#include <string.h> /* for memset on Linux */
|
||||||
@ -1143,7 +1142,7 @@ int lzxc_compress_block(lzxc_data *lzxd, int block_size, int subdivide)
|
|||||||
build_huffman_tree(LZX_ALIGNED_SIZE, 7, lzxd->aligned_freq_table, lzxd->aligned_tree);
|
build_huffman_tree(LZX_ALIGNED_SIZE, 7, lzxd->aligned_freq_table, lzxd->aligned_tree);
|
||||||
for (i = 0; i < LZX_ALIGNED_SIZE; i++) {
|
for (i = 0; i < LZX_ALIGNED_SIZE; i++) {
|
||||||
uncomp_bits += lzxd->aligned_freq_table[i]* 3;
|
uncomp_bits += lzxd->aligned_freq_table[i]* 3;
|
||||||
comp_bits += lzxd->aligned_freq_table[i]* lzxd->aligned_tree[i].codelength;
|
comp_bits += (long)lzxd->aligned_freq_table[i]* lzxd->aligned_tree[i].codelength;
|
||||||
}
|
}
|
||||||
comp_bits_ovh = comp_bits + LZX_ALIGNED_SIZE * 3;
|
comp_bits_ovh = comp_bits + LZX_ALIGNED_SIZE * 3;
|
||||||
if (comp_bits_ovh < uncomp_bits)
|
if (comp_bits_ovh < uncomp_bits)
|
||||||
|
|||||||
@ -224,8 +224,8 @@ static int make_decode_table(unsigned int nsyms, unsigned int nbits,
|
|||||||
unsigned int next_symbol = bit_mask; /* base of allocation for long codes */
|
unsigned int next_symbol = bit_mask; /* base of allocation for long codes */
|
||||||
|
|
||||||
/* fill entries for codes short enough for a direct mapping */
|
/* fill entries for codes short enough for a direct mapping */
|
||||||
for (bit_num = 1; bit_num <= nbits; bit_num++) {
|
for (bit_num = 1; (unsigned)bit_num <= nbits; bit_num++) {
|
||||||
for (sym = 0; sym < nsyms; sym++) {
|
for (sym = 0; (unsigned)sym < nsyms; sym++) {
|
||||||
if (length[sym] != bit_num) continue;
|
if (length[sym] != bit_num) continue;
|
||||||
leaf = pos;
|
leaf = pos;
|
||||||
if((pos += bit_mask) > table_mask) return 1; /* table overrun */
|
if((pos += bit_mask) > table_mask) return 1; /* table overrun */
|
||||||
@ -239,7 +239,7 @@ static int make_decode_table(unsigned int nsyms, unsigned int nbits,
|
|||||||
if (pos == table_mask) return 0;
|
if (pos == table_mask) return 0;
|
||||||
|
|
||||||
/* clear the remainder of the table */
|
/* clear the remainder of the table */
|
||||||
for (sym = pos; sym < table_mask; sym++) table[sym] = 0xFFFF;
|
for (sym = pos; (unsigned)sym < table_mask; sym++) table[sym] = 0xFFFF;
|
||||||
|
|
||||||
/* allow codes to be up to nbits+16 long, instead of nbits */
|
/* allow codes to be up to nbits+16 long, instead of nbits */
|
||||||
pos <<= 16;
|
pos <<= 16;
|
||||||
@ -247,7 +247,7 @@ static int make_decode_table(unsigned int nsyms, unsigned int nbits,
|
|||||||
bit_mask = 1 << 15;
|
bit_mask = 1 << 15;
|
||||||
|
|
||||||
for (bit_num = nbits+1; bit_num <= 16; bit_num++) {
|
for (bit_num = nbits+1; bit_num <= 16; bit_num++) {
|
||||||
for (sym = 0; sym < nsyms; sym++) {
|
for (sym = 0; (unsigned)sym < nsyms; sym++) {
|
||||||
if (length[sym] != bit_num) continue;
|
if (length[sym] != bit_num) continue;
|
||||||
|
|
||||||
leaf = pos >> 16;
|
leaf = pos >> 16;
|
||||||
@ -273,7 +273,7 @@ static int make_decode_table(unsigned int nsyms, unsigned int nbits,
|
|||||||
if (pos == table_mask) return 0;
|
if (pos == table_mask) return 0;
|
||||||
|
|
||||||
/* either erroneous table, or all elements are 0 - let's find out. */
|
/* either erroneous table, or all elements are 0 - let's find out. */
|
||||||
for (sym = 0; sym < nsyms; sym++) if (length[sym]) return 1;
|
for (sym = 0; (unsigned)sym < nsyms; sym++) if (length[sym]) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ typedef struct {
|
|||||||
|
|
||||||
static MemoryItem*** alloc_memory(int32_t needle_len, int32_t max_haystack_len) {
|
static MemoryItem*** alloc_memory(int32_t needle_len, int32_t max_haystack_len) {
|
||||||
MemoryItem ***ans = NULL, **d1 = NULL, *d2 = NULL;
|
MemoryItem ***ans = NULL, **d1 = NULL, *d2 = NULL;
|
||||||
size_t num = max_haystack_len * max_haystack_len * needle_len;
|
size_t num = (size_t)max_haystack_len * (size_t)max_haystack_len * needle_len;
|
||||||
size_t position_sz = needle_len * sizeof(int32_t);
|
size_t position_sz = needle_len * sizeof(int32_t);
|
||||||
size_t sz = (num * (sizeof(MemoryItem) + position_sz)) + (max_haystack_len * sizeof(MemoryItem**)) + (needle_len * sizeof(MemoryItem*));
|
size_t sz = (num * (sizeof(MemoryItem) + position_sz)) + (max_haystack_len * sizeof(MemoryItem**)) + (needle_len * sizeof(MemoryItem*));
|
||||||
int32_t hidx, nidx, last_idx, i, j;
|
int32_t hidx, nidx, last_idx, i, j;
|
||||||
@ -85,7 +85,7 @@ typedef struct {
|
|||||||
static void alloc_stack(Stack *stack, int32_t needle_len, int32_t max_haystack_len) {
|
static void alloc_stack(Stack *stack, int32_t needle_len, int32_t max_haystack_len) {
|
||||||
StackItem *ans = NULL;
|
StackItem *ans = NULL;
|
||||||
char *base = NULL;
|
char *base = NULL;
|
||||||
size_t num = max_haystack_len * needle_len;
|
size_t num = (size_t)max_haystack_len * needle_len;
|
||||||
size_t position_sz = needle_len * sizeof(int32_t);
|
size_t position_sz = needle_len * sizeof(int32_t);
|
||||||
size_t sz = sizeof(StackItem) + position_sz;
|
size_t sz = sizeof(StackItem) + position_sz;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
@ -416,7 +416,7 @@ Matcher_calculate_scores(Matcher *self, PyObject *args) {
|
|||||||
items = PyTuple_New(self->item_count);
|
items = PyTuple_New(self->item_count);
|
||||||
positions = PyTuple_New(self->item_count);
|
positions = PyTuple_New(self->item_count);
|
||||||
matches = (Match*)calloc(self->item_count, sizeof(Match));
|
matches = (Match*)calloc(self->item_count, sizeof(Match));
|
||||||
final_positions = (int32_t*) calloc(needle_char_len * self->item_count, sizeof(int32_t));
|
final_positions = (int32_t*) calloc((size_t)needle_char_len * self->item_count, sizeof(int32_t));
|
||||||
if (items == NULL || matches == NULL || final_positions == NULL || positions == NULL) {PyErr_NoMemory(); goto end;}
|
if (items == NULL || matches == NULL || final_positions == NULL || positions == NULL) {PyErr_NoMemory(); goto end;}
|
||||||
|
|
||||||
for (i = 0; i < self->item_count; i++) {
|
for (i = 0; i < self->item_count; i++) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user