Stream_Seek(s, 3); /* bPad */
start = Stream_GetPosition(s);
src = context->priv->out_buffer;
- length = context->priv->out_pending_frames * context->priv->src_bytes_per_frame;
+ length = context->priv->out_pending_frames * context->priv->src_bytes_per_frame * 1ULL;
if (!freerdp_dsp_encode(context->priv->dsp_context, context->src_format, src, length, s))
return ERROR_INTERNAL_ERROR;
for (x = 0; x < config->bNumInterfaces; x++)
{
- uint8_t y;
+ int y;
const struct libusb_interface* ifc = &config->interface[x];
for (y = 0; y < ifc->num_altsetting; y++)
{
presentation = frame->presentation;
priv->publishedFrames++;
- memcpy(presentation->surfaceData, frame->surfaceData, frame->w * frame->h * 4);
+ memcpy(presentation->surfaceData, frame->surfaceData, frame->w * frame->h * 4ULL);
video->showSurface(video, presentation->surface);
frame->w = presentation->SourceWidth;
frame->h = presentation->SourceHeight;
- frame->surfaceData = BufferPool_Take(priv->surfacePool, frame->w * frame->h * 4);
+ frame->surfaceData = BufferPool_Take(priv->surfacePool, frame->w * frame->h * 4ULL);
if (!frame->surfaceData)
{
WLog_ERR(TAG, "unable to allocate frame data");
if (!ptr)
return FALSE;
- ptr->size = pointer->width * pointer->height * 4;
+ ptr->size = pointer->width * pointer->height * 4ULL;
ptr->data = _aligned_malloc(ptr->size, 16);
if (!ptr->data)
!wlf_scale_coordinates(context, &w, &h, FALSE))
return FALSE;
- size = w * h * 4;
+ size = w * h * 4ULL;
data = malloc(size);
if (!data)
if (data)
{
brushFormat = gdi_get_pixel_format(bpp);
- cdata = (BYTE*)_aligned_malloc(width * height * 4, 16);
+ cdata = (BYTE*)_aligned_malloc(width * height * 4ULL, 16);
freerdp_image_copy(cdata, gdi->dstFormat, 0, 0, 0, width, height, data, brushFormat, 0, 0,
0, &xfc->context.gdi->palette, FREERDP_FLIP_NONE);
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0, (char*)cdata, width,
case RDP_CODEC_ID_NONE:
pSrcData = cmd->bmp.bitmapData;
format = gdi_get_pixel_format(cmd->bmp.bpp);
- size = cmd->bmp.width * cmd->bmp.height * GetBytesPerPixel(format);
+ size = cmd->bmp.width * cmd->bmp.height * GetBytesPerPixel(format) * 1ULL;
if (size > cmd->bmp.bitmapDataLength)
{
WLog_ERR(TAG, "Short nocodec message: got %" PRIu32 " bytes, require %" PRIuz,
surface->gdi.scanline = surface->gdi.width * GetBytesPerPixel(surface->gdi.format);
surface->gdi.scanline = x11_pad_scanline(surface->gdi.scanline, xfc->scanline_pad);
- size = surface->gdi.scanline * surface->gdi.height;
+ size = surface->gdi.scanline * surface->gdi.height * 1ULL;
surface->gdi.data = (BYTE*)_aligned_malloc(size, 16);
if (!surface->gdi.data)
UINT32 bytes = GetBytesPerPixel(gdi->dstFormat);
surface->stageScanline = width * bytes;
surface->stageScanline = x11_pad_scanline(surface->stageScanline, xfc->scanline_pad);
- size = surface->stageScanline * surface->gdi.height;
+ size = surface->stageScanline * surface->gdi.height * 1ULL;
surface->stage = (BYTE*)_aligned_malloc(size, 16);
if (!surface->stage)
if ((INT64)depth != xfc->depth)
{
- if (!(data = _aligned_malloc(bitmap->width * bitmap->height * 4, 16)))
+ if (!(data = _aligned_malloc(bitmap->width * bitmap->height * 4ULL, 16)))
goto unlock;
if (!freerdp_image_copy(data, gdi->dstFormat, 0, 0, 0, bitmap->width, bitmap->height,
ci.height = yTargetSize;
ci.xhot = pointer->xPos * xscale;
ci.yhot = pointer->yPos * yscale;
- size = ci.height * ci.width * GetBytesPerPixel(CursorFormat);
+ size = ci.height * ci.width * GetBytesPerPixel(CursorFormat) * 1ULL;
if (xscale != 1 || yscale != 1)
{
xpointer->nCursors = 0;
xpointer->mCursors = 0;
- size = pointer->height * pointer->width * GetBytesPerPixel(CursorFormat);
+ size = pointer->height * pointer->width * GetBytesPerPixel(CursorFormat) * 1ULL;
if (!(xpointer->cursorPixels = (XcursorPixel*)_aligned_malloc(size, 16)))
return FALSE;
cache->numCaches = settings->RemoteAppNumIconCaches;
cache->numCacheEntries = settings->RemoteAppNumIconCacheEntries;
- cache->entries = calloc(cache->numCaches * cache->numCacheEntries, sizeof(xfRailIcon));
+ cache->entries = calloc(cache->numCaches * cache->numCacheEntries * 1ULL, sizeof(xfRailIcon));
if (!cache->entries)
{
long* pixels;
int i;
int nelements;
- argbPixels = calloc(iconInfo->width * iconInfo->height, 4);
+ argbPixels = calloc(iconInfo->width * iconInfo->height * 1ULL, 4);
if (!argbPixels)
goto error;
const UINT32 diffSize = (vBarEntry->count - vBarEntry->size) * bpp;
BYTE* tmp;
vBarEntry->size = vBarEntry->count;
- tmp = (BYTE*)realloc(vBarEntry->pixels, vBarEntry->count * bpp);
+ tmp = (BYTE*)realloc(vBarEntry->pixels, vBarEntry->count * bpp * 1ULL);
if (!tmp)
{
if (glyphEntry->count > glyphEntry->size)
{
BYTE* tmp;
- tmp = realloc(glyphEntry->pixels, glyphEntry->count * bpp);
+ tmp = realloc(glyphEntry->pixels, glyphEntry->count * bpp * 1ULL);
if (!tmp)
{
* means of accessing individual pixels in blitting operations
*/
scanline = (width + 7) / 8;
- dstData = (BYTE*)_aligned_malloc(width * height, 16);
+ dstData = (BYTE*)_aligned_malloc(width * height * 1ULL, 16);
if (!dstData)
return NULL;
for (y = nYDst; y < nHeight; y++)
{
BYTE* pDstLine = &pDstData[y * nDstStep + nXDst * dstBytesPerPixel];
- memset(pDstLine, 0, dstBytesPerPixel * (nWidth - nXDst));
+ memset(pDstLine, 0, dstBytesPerPixel * (nWidth - nXDst) * 1ULL);
}
switch (xorBpp)
for (y = 1; y < nHeight; y++)
{
BYTE* pDstLine = &pDstData[(y + nYDst) * nDstStep + nXDst * bpp];
- memcpy(pDstLine, pFirstDstLineXOffset, nWidth * bpp);
+ memcpy(pDstLine, pFirstDstLineXOffset, nWidth * bpp * 1ULL);
}
return TRUE;
_aligned_free(h264->pYUVData[0]);
_aligned_free(h264->pYUVData[1]);
_aligned_free(h264->pYUVData[2]);
- h264->pYUVData[0] = _aligned_malloc(h264->iStride[0] * height, 16);
- h264->pYUVData[1] = _aligned_malloc(h264->iStride[1] * height, 16);
- h264->pYUVData[2] = _aligned_malloc(h264->iStride[2] * height, 16);
+ h264->pYUVData[0] = _aligned_malloc(h264->iStride[0] * height * 1ULL, 16);
+ h264->pYUVData[1] = _aligned_malloc(h264->iStride[1] * height * 1ULL, 16);
+ h264->pYUVData[2] = _aligned_malloc(h264->iStride[2] * height * 1ULL, 16);
if (!h264->pYUVData[0] || !h264->pYUVData[1] || !h264->pYUVData[2])
return FALSE;
static BOOL nsc_encode_subsampling(NSC_CONTEXT* context)
{
- UINT16 x;
- UINT16 y;
+ UINT32 y;
UINT32 tempWidth;
UINT32 tempHeight;
for (y = 0; y<tempHeight>> 1; y++)
{
+ UINT32 x;
BYTE* co_dst = context->priv->PlaneBuffers[1] + y * (tempWidth >> 1);
BYTE* cg_dst = context->priv->PlaneBuffers[2] + y * (tempWidth >> 1);
const INT8* co_src0 = (INT8*)context->priv->PlaneBuffers[1] + (y << 1) * tempWidth;
static void nsc_encode_subsampling_sse2(NSC_CONTEXT* context)
{
- UINT16 x;
- UINT16 y;
+ UINT32 y;
BYTE* co_dst;
BYTE* cg_dst;
INT8* co_src0;
for (y = 0; y<tempHeight>> 1; y++)
{
+ UINT32 x;
co_dst = context->priv->PlaneBuffers[1] + y * (tempWidth >> 1);
cg_dst = context->priv->PlaneBuffers[2] + y * (tempWidth >> 1);
co_src0 = (INT8*)context->priv->PlaneBuffers[1] + (y << 1) * tempWidth;
tile->stride = 4 * tile->width;
{
- size_t dataLen = tile->stride * tile->height;
+ size_t dataLen = tile->stride * tile->height * 1ULL;
tile->data = (BYTE*)_aligned_malloc(dataLen, 16);
}
for (i = 0; i < surface->numUpdatedTiles; i++)
{
- UINT32 nbUpdateRects;
+ UINT32 nbUpdateRects, j;
const RECTANGLE_16* updateRects;
RECTANGLE_16 updateRect;
RFX_PROGRESSIVE_TILE* tile = &surface->tiles[surface->updatedTileIndices[i]];
static BOOL gcc_read_client_cluster_data(wStream* s, rdpMcs* mcs, UINT16 blockLength);
static BOOL gcc_read_client_core_data(wStream* s, rdpMcs* mcs, UINT16 blockLength);
-static BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, int length);
-static BOOL gcc_read_server_data_blocks(wStream* s, rdpMcs* mcs, int length);
+static BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, UINT16 length);
+static BOOL gcc_read_server_data_blocks(wStream* s, rdpMcs* mcs, UINT16 length);
static BOOL gcc_read_user_data_header(wStream* s, UINT16* type, UINT16* length);
static void gcc_write_user_data_header(wStream* s, UINT16 type, UINT16 length);
0); /* array of server data blocks */
}
-BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, int length)
+BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, UINT16 length)
{
UINT16 type;
UINT16 blockLength;
return TRUE;
}
-BOOL gcc_read_server_data_blocks(wStream* s, rdpMcs* mcs, int length)
+BOOL gcc_read_server_data_blocks(wStream* s, rdpMcs* mcs, UINT16 length)
{
UINT16 type;
UINT16 offset = 0;
hBitmap->format = hdc->format;
hBitmap->width = nWidth;
hBitmap->height = nHeight;
- hBitmap->data = _aligned_malloc(nWidth * nHeight * GetBytesPerPixel(hBitmap->format), 16);
+ hBitmap->data =
+ _aligned_malloc(nWidth * nHeight * GetBytesPerPixel(hBitmap->format) * 1ULL, 16);
hBitmap->free = _aligned_free;
if (!hBitmap->data)
case RDP_CODEC_ID_NONE:
format = gdi_get_pixel_format(cmd->bmp.bpp);
- size = cmd->bmp.width * cmd->bmp.height * GetBytesPerPixel(format);
+ size = cmd->bmp.width * cmd->bmp.height * GetBytesPerPixel(format) * 1ULL;
if (size > cmd->bmp.bitmapDataLength)
{
WLog_ERR(TAG, "Short nocodec message: got %" PRIu32 " bytes, require %" PRIuz,
{
UINT32 x, y;
- if (Stream_GetRemainingLength(&s) < cmd->height * cmd->width)
+ if (Stream_GetRemainingLength(&s) < cmd->height * cmd->width * 1ULL)
return ERROR_INVALID_DATA;
for (y = cmd->top; y < cmd->top + cmd->height; y++)
goto fail;
}
- surface->scanline = gfx_align_scanline(surface->width * 4, 16);
- surface->data = (BYTE*)_aligned_malloc(surface->scanline * surface->height, 16);
+ surface->scanline = gfx_align_scanline(surface->width * 4UL, 16);
+ surface->data = (BYTE*)_aligned_malloc(surface->scanline * surface->height * 1ULL, 16);
if (!surface->data)
{
return NULL;
nDstStep = nWidth * GetBytesPerPixel(gdi->dstFormat);
- pDstData = _aligned_malloc(nHeight * nDstStep, 16);
+ pDstData = _aligned_malloc(nHeight * nDstStep * 1ULL, 16);
if (!pDstData)
return NULL;
for (y = 1; y < nHeight; y++)
{
BYTE* dstp = gdi_get_bitmap_pointer(hdc, nXDest, nYDest + y);
- memcpy(dstp, srcp, nWidth * formatSize);
+ memcpy(dstp, srcp, nWidth * formatSize * 1ULL);
}
break;
ret->base.w = width;
ret->base.h = height;
ret->scanline = width * bpp;
- ret->image = _aligned_malloc(ret->scanline * height, 16);
+ ret->image = _aligned_malloc(ret->scanline * height * 1ULL, 16);
if (!ret->image)
{
if (p1m <= p2m)
{
- ULONG_PTR p1mEnd = p1m + (height - 1) * p1Step + width * p1Size;
+ ULONG_PTR p1mEnd = p1m + (height - 1) * p1Step * 1ULL + width * p1Size * 1ULL;
if (p1mEnd > p2m)
return TRUE;
}
else
{
- ULONG_PTR p2mEnd = p2m + (height - 1) * p2Step + width * p2Size;
+ ULONG_PTR p2mEnd = p2m + (height - 1) * p2Step * 1ULL + width * p2Size * 1ULL;
if (p2mEnd > p1m)
return TRUE;
if (!buf)
goto fail;
- winpr_RAND(buf, roi->width * roi->height);
+ winpr_RAND(buf, roi->width * roi->height * 1ULL);
ret->steps[i] = roi->width;
}
w->buffers = newBuffers;
memset(w->buffers + w->nbuffers, 0, sizeof(UwacBuffer) * nbuffers);
- fd = uwac_create_anonymous_file(allocSize * nbuffers);
+ fd = uwac_create_anonymous_file(allocSize * nbuffers * 1ULL);
if (fd < 0)
{
return UWAC_ERROR_INTERNAL;
}
- data = mmap(NULL, allocSize * nbuffers, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ data = mmap(NULL, allocSize * nbuffers * 1ULL, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED)
{
if (!pool)
{
- munmap(data, allocSize * nbuffers);
+ munmap(data, allocSize * nbuffers * 1ULL);
ret = UWAC_ERROR_NOMEMORY;
goto error_mmap;
}
return UWAC_ERROR_NOMEMORY;
if (copyContentForNextFrame)
- memcpy(nextDrawingBuffer->data, pendingBuffer->data, window->stride * window->height);
+ memcpy(nextDrawingBuffer->data, pendingBuffer->data,
+ window->stride * window->height * 1ULL);
UwacSubmitBufferPtr(window, pendingBuffer);
return UWAC_SUCCESS;
WINPR_API void winpr_CArrayDump(const char* tag, UINT32 lvl, const BYTE* data, int length,
int width);
- WINPR_API char* winpr_BinToHexString(const BYTE* data, int length, BOOL space);
+ WINPR_API char* winpr_BinToHexString(const BYTE* data, size_t length, BOOL space);
WINPR_API int wprintfx(const char* fmt, ...);
WINPR_API int wvprintfx(const char* fmt, va_list args);
/*in an idat chunk, each scanline is a multiple of 8 bits, unlike the lodepng output buffer*/
static size_t lodepng_get_raw_size_idat(unsigned w, unsigned h, const LodePNGColorMode* color)
{
- return h * ((w * lodepng_get_bpp(color) + 7) / 8);
+ return h * ((w * lodepng_get_bpp(color) + 7ULL) / 8ULL);
}
#endif /*LODEPNG_COMPILE_DECODER*/
#endif /*LODEPNG_COMPILE_PNG*/
{
size_t i;
ColorTree tree;
- size_t numpixels = w * h;
+ size_t numpixels = w * h * 1ULL;
if (lodepng_color_mode_equal(mode_out, mode_in))
{
unsigned error = 0;
size_t i;
ColorTree tree;
- size_t numpixels = w * h;
+ size_t numpixels = w * h * 1ULL;
unsigned colored_done = lodepng_is_greyscale_type(mode) ? 1 : 0;
unsigned alpha_done = lodepng_can_have_alpha(mode) ? 0 : 1;
/*if passw[i] is 0, it's 0 bytes, not 1 (no filtertype-byte)*/
filter_passstart[i + 1] =
filter_passstart[i] +
- ((passw[i] && passh[i]) ? passh[i] * (1 + (passw[i] * bpp + 7) / 8) : 0);
+ ((passw[i] && passh[i]) ? passh[i] * (1ULL + (passw[i] * bpp + 7ULL) / 8ULL) : 0);
/*bits padded if needed to fill full byte at end of each scanline*/
- padded_passstart[i + 1] = padded_passstart[i] + passh[i] * ((passw[i] * bpp + 7) / 8);
+ padded_passstart[i + 1] = padded_passstart[i] + passh[i] * ((passw[i] * bpp + 7ULL) / 8ULL);
/*only padded at end of reduced image*/
- passstart[i + 1] = passstart[i] + (passh[i] * passw[i] * bpp + 7) / 8;
+ passstart[i + 1] = passstart[i] + (passh[i] * passw[i] * bpp + 7ULL) / 8ULL;
}
}
if (bpp < 8 && w * bpp != ((w * bpp + 7) / 8) * 8)
{
CERROR_TRY_RETURN(unfilter(in, in, w, h, bpp));
- removePaddingBits(out, in, w * bpp, ((w * bpp + 7) / 8) * 8, h);
+ removePaddingBits(out, in, w * bpp * 1ULL, ((w * bpp + 7ULL) / 8ULL) * 8ULL, h);
}
/*we can immediatly filter into the out buffer, no other steps needed*/
else
/*remove padding bits in scanlines; after this there still may be padding
bits between the different reduced images: each reduced image still starts nicely at
a byte*/
- removePaddingBits(&in[passstart[i]], &in[padded_passstart[i]], passw[i] * bpp,
- ((passw[i] * bpp + 7) / 8) * 8, passh[i]);
+ removePaddingBits(&in[passstart[i]], &in[padded_passstart[i]],
+ passw[i] * bpp * 1ULL, ((passw[i] * bpp + 7ULL) / 8ULL) * 8ULL,
+ passh[i]);
}
}
/*non multiple of 8 bits per scanline, padding bits needed per scanline*/
if (bpp < 8 && w * bpp != ((w * bpp + 7) / 8) * 8)
{
- unsigned char* padded = (unsigned char*)calloc(h * ((w * bpp + 7) / 8), 1);
+ unsigned char* padded = (unsigned char*)calloc(h * ((w * bpp + 7ULL) / 8ULL), 1);
if (!padded)
error = 83; /*alloc fail*/
if (!error)
{
- addPaddingBits(padded, in, ((w * bpp + 7) / 8) * 8, w * bpp, h);
+ addPaddingBits(padded, in, ((w * bpp + 7ULL) / 8ULL) * 8ULL, w * bpp * 1ULL, h);
error = filter(*out, padded, w, h, &info_png->color, settings);
}
free(padded);
padded_passstart[i + 1] - padded_passstart[i], sizeof(unsigned char));
if (!padded)
ERROR_BREAK(83); /*alloc fail*/
- addPaddingBits(padded, &adam7[passstart[i]], ((passw[i] * bpp + 7) / 8) * 8,
- passw[i] * bpp, passh[i]);
+ addPaddingBits(padded, &adam7[passstart[i]],
+ ((passw[i] * bpp + 7ULL) / 8ULL) * 8ULL, passw[i] * bpp * 1ULL,
+ passh[i] * 1ULL);
error = filter(&(*out)[filter_passstart[i]], padded, passw[i], passh[i],
&info_png->color, settings);
free(padded);
free(buffer);
}
-char* winpr_BinToHexString(const BYTE* data, int length, BOOL space)
+char* winpr_BinToHexString(const BYTE* data, size_t length, BOOL space)
{
- int i;
+ size_t i;
int n;
char* p;
- int ln, hn;
- char bin2hex[] = "0123456789ABCDEF";
+ const char bin2hex[] = "0123456789ABCDEF";
n = space ? 3 : 2;
- p = (char*)malloc((length + 1) * n);
+ p = (char*)malloc((length + 1ULL) * n);
if (!p)
return NULL;
for (i = 0; i < length; i++)
{
- ln = data[i] & 0xF;
- hn = (data[i] >> 4) & 0xF;
+ int ln = data[i] & 0xF;
+ int hn = (data[i] >> 4) & 0xF;
p[i * n] = bin2hex[hn];
p[(i * n) + 1] = bin2hex[ln];