libreoffice/shell/inc/thumbviewer.hxx
Mike Kaganski f4b72c08f9 Refactor shell thumbnail extension code
1. Drop obsolete #ifndef DONT_HAVE_GDIPLUS, introduced in commit
06c8108fe5c196aec2888d9b236f595f2bcb1c46 (Attempt to make this
build with MinGW, 2011-06-24).

2. Improve API methods implementations.

2.1. In IUnknown::Release, make sure to check the value returned
from decrement, not the member (that could potentially be modified
in the meantime again).

2.2. In ISequentialStream::Read, don't return S_OK for too large
read; and make sure to set pcbRead even on zero-byte read.

2.3. In IStream::Seek, check dwOrigin value; handle STREAM_SEEK_END
correctly, without subtracting an extra 1; don't fail on too large
positive offset (that is explicitly documented as OK); and don't
ignore the plibNewPosition argument (callers expect the new offset
there).

2.4. In IStream::Stat, check grfStatFlag value; handle OOM; don't
limit the returned offset to 32 bits.

3. Make StreamOnZipBuffer own the buffer. It user a reference to
temporaries; but the object is refcounted, and when passed to an
API, it could potentially outlive the temporaries it depended on.

4. Move CThumbviewer definition to CXX, and simplify the HXX.

Change-Id: I5b31a8bf66651862d730cc346948dc04f984fddb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184807
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2025-05-01 05:54:04 +02:00

27 lines
1022 B
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include <shlobj.h>
IExtractImage* CreateThumbviewer();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */