Skip to content

Commit 573c3c7

Browse files
authored
Merge pull request #2145 from Exiv2/mainSizeT_n
More migration to size_t
2 parents 04ae6c2 + 4355d63 commit 573c3c7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+744
-863
lines changed

app/actions.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ namespace Action {
926926
if (num == 0) {
927927
// Write all previews
928928
for (num = 0; num < pvList.size(); ++num) {
929-
writePreviewFile(pvMgr.getPreviewImage(pvList[num]), static_cast<int>(num + 1));
929+
writePreviewFile(pvMgr.getPreviewImage(pvList[num]), num + 1);
930930
}
931931
break;
932932
}
@@ -936,7 +936,7 @@ namespace Action {
936936
<< " " << num + 1 << "\n";
937937
continue;
938938
}
939-
writePreviewFile(pvMgr.getPreviewImage(pvList[num]), static_cast<int>(num + 1));
939+
writePreviewFile(pvMgr.getPreviewImage(pvList[num]), num + 1);
940940
}
941941
return 0;
942942
} // Extract::writePreviews
@@ -977,7 +977,7 @@ namespace Action {
977977
} // Extract::writeIccProfile
978978

979979

980-
void Extract::writePreviewFile(const Exiv2::PreviewImage& pvImg, int num) const
980+
void Extract::writePreviewFile(const Exiv2::PreviewImage& pvImg, size_t num) const
981981
{
982982
std::string pvFile = newFilePath(path_, "-preview") + Exiv2::toString(num);
983983
std::string pvPath = pvFile + pvImg.extension();
@@ -997,7 +997,7 @@ namespace Action {
997997
std::cerr << path_ << ": " << _("Image does not have preview")
998998
<< " " << num << "\n";
999999
}
1000-
} // Extract::writePreviewFile
1000+
}
10011001

10021002
Task::UniquePtr Extract::clone() const
10031003
{

app/actions.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace Action {
5757
/// @param path Path of the file to process.
5858
/// @return 0 if successful.
5959
virtual int run(const std::string& path) =0;
60-
60+
6161
bool setBinary(bool b)
6262
{
6363
bool bResult = binary_;
@@ -240,7 +240,7 @@ namespace Action {
240240
/// @brief Write one preview image to a file. The filename is composed by removing the suffix from the image
241241
/// filename and appending "-preview<num>" and the appropriate suffix (".jpg" or ".tif"), depending on the
242242
/// format of the Exif thumbnail image.
243-
void writePreviewFile(const Exiv2::PreviewImage& pvImg, int num) const;
243+
void writePreviewFile(const Exiv2::PreviewImage& pvImg, size_t num) const;
244244

245245
/// @brief Write embedded iccProfile files.
246246
int writeIccProfile(const std::string& target) const;

include/exiv2/cr2image.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,15 @@ namespace Exiv2 {
9999
IptcData& iptcData,
100100
XmpData& xmpData,
101101
const byte* pData,
102-
uint32_t size
102+
size_t size
103103
);
104104
/*!
105105
@brief Encode metadata from the provided metadata to CR2 format.
106106
See TiffParser::encode().
107107
*/
108-
static WriteMethod encode(
109-
BasicIo& io,
108+
static WriteMethod encode(BasicIo& io,
110109
const byte* pData,
111-
uint32_t size,
110+
size_t size,
112111
ByteOrder byteOrder,
113112
const ExifData& exifData,
114113
const IptcData& iptcData,

include/exiv2/crwimage.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ namespace Exiv2 {
103103
104104
@throw Error If the data buffer cannot be parsed.
105105
*/
106-
static void decode(CrwImage* pCrwImage, const byte* pData, uint32_t size);
106+
static void decode(CrwImage* pCrwImage, const byte* pData, size_t size);
107107
/*!
108108
@brief Encode metadata from the CRW image into a data buffer (the
109109
binary CRW image).
@@ -118,10 +118,9 @@ namespace Exiv2 {
118118
119119
@throw Error If the metadata from the CRW image cannot be encoded.
120120
*/
121-
static void encode(
122-
Blob& blob,
121+
static void encode(Blob& blob,
123122
const byte* pData,
124-
uint32_t size,
123+
size_t size,
125124
const CrwImage* pCrwImage
126125
);
127126

include/exiv2/exif.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,24 +157,24 @@ namespace Exiv2 {
157157
@param byteOrder Applicable byte order (little or big endian).
158158
@return Number of characters written.
159159
*/
160-
long copy(byte* buf, ByteOrder byteOrder) const override;
160+
size_t copy(byte* buf, ByteOrder byteOrder) const override;
161161
std::ostream& write(std::ostream& os, const ExifData* pMetadata = nullptr) const override;
162162
//! Return the type id of the value
163163
TypeId typeId() const override;
164164
//! Return the name of the type
165165
const char* typeName() const override;
166166
//! Return the size in bytes of one component of this type
167-
long typeSize() const override;
167+
size_t typeSize() const override;
168168
//! Return the number of components in the value
169169
size_t count() const override;
170170
//! Return the size of the value in bytes
171-
long size() const override;
171+
size_t size() const override;
172172
//! Return the value as a string.
173173
std::string toString() const override;
174-
std::string toString(long n) const override;
175-
int64_t toInt64(long n = 0) const override;
176-
float toFloat(long n = 0) const override;
177-
Rational toRational(long n = 0) const override;
174+
std::string toString(size_t n) const override;
175+
int64_t toInt64(size_t n = 0) const override;
176+
float toFloat(size_t n = 0) const override;
177+
Rational toRational(size_t n = 0) const override;
178178
Value::UniquePtr getValue() const override;
179179
const Value& value() const override;
180180
//! Return the size of the data area.

include/exiv2/futils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ namespace Exiv2
7676
7777
@note Source: https://github.com/davidgaleano/libwebsockets/blob/master/lib/base64-decode.c
7878
*/
79-
EXIV2API long base64decode(const char* in, char* out, size_t out_size);
79+
EXIV2API size_t base64decode(const char* in, char* out, size_t out_size);
8080

8181
/*!
8282
@brief Return the protocol of the path.

include/exiv2/image.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ namespace Exiv2 {
2222

2323
//! Native preview information. This is meant to be used only by the PreviewManager.
2424
struct NativePreview {
25-
long position_; //!< Position
26-
uint32_t size_; //!< Size
27-
uint32_t width_; //!< Width
28-
uint32_t height_; //!< Height
25+
size_t position_; //!< Position
26+
size_t size_; //!< Size
27+
size_t width_; //!< Width
28+
size_t height_; //!< Height
2929
std::string filter_; //!< Filter
3030
std::string mimeType_; //!< MIME type
3131
};
@@ -298,7 +298,7 @@ namespace Exiv2 {
298298
/*!
299299
@brief Print out the structure of a TIFF IFD
300300
*/
301-
void printIFDStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption option,uint32_t start,bool bSwap,char c,int depth);
301+
void printIFDStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption option, size_t start, bool bSwap, char c, int depth);
302302

303303
/*!
304304
@brief is the host platform bigEndian

include/exiv2/iptc.hpp

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ namespace Exiv2 {
8787

8888
//! @name Accessors
8989
//@{
90-
long copy(byte* buf, ByteOrder byteOrder) const override;
90+
size_t copy(byte* buf, ByteOrder byteOrder) const override;
9191
std::ostream& write(std::ostream& os, const ExifData* pMetadata = nullptr) const override;
9292
/*!
9393
@brief Return the key of the Iptcdatum. The key is of the form
@@ -118,14 +118,14 @@ namespace Exiv2 {
118118
uint16_t tag() const override;
119119
TypeId typeId() const override;
120120
const char* typeName() const override;
121-
long typeSize() const override;
121+
size_t typeSize() const override;
122122
size_t count() const override;
123-
long size() const override;
123+
size_t size() const override;
124124
std::string toString() const override;
125-
std::string toString(long n) const override;
126-
int64_t toInt64(long n = 0) const override;
127-
float toFloat(long n = 0) const override;
128-
Rational toRational(long n = 0) const override;
125+
std::string toString(size_t n) const override;
126+
int64_t toInt64(size_t n = 0) const override;
127+
float toFloat(size_t n = 0) const override;
128+
Rational toRational(size_t n = 0) const override;
129129
Value::UniquePtr getValue() const override;
130130
const Value& value() const override;
131131
//@}
@@ -236,19 +236,17 @@ namespace Exiv2 {
236236
uint16_t record = IptcDataSets::application2) const;
237237
//! Return true if there is no IPTC metadata
238238
bool empty() const { return count() == 0; }
239+
239240
//! Get the number of metadata entries
240-
long count() const { return static_cast<long>(iptcMetadata_.size()); }
241-
/*!
242-
@brief Return the exact size of all contained IPTC metadata
243-
*/
244-
long size() const;
245-
/*!
246-
@brief Return the metadata charset name or 0
247-
*/
241+
size_t count() const { return iptcMetadata_.size(); }
242+
243+
//! @brief Return the exact size of all contained IPTC metadata
244+
size_t size() const;
245+
246+
//! @brief Return the metadata charset name or 0
248247
const char *detectCharset() const;
249-
/*!
250-
@brief dump iptc formatted binary data (used by printStructure kpsRecursive)
251-
*/
248+
249+
//! @brief dump iptc formatted binary data (used by printStructure kpsRecursive)
252250
static void printStructure(std::ostream& out, const Slice<byte*>& bytes,uint32_t depth);
253251
//@}
254252

@@ -274,7 +272,7 @@ namespace Exiv2 {
274272
@return 0 if successful;<BR>
275273
5 if the binary IPTC data is invalid or corrupt
276274
*/
277-
static int decode(IptcData& iptcData, const byte* pData, uint32_t size);
275+
static int decode(IptcData& iptcData, const byte* pData, size_t size);
278276

279277
/*!
280278
@brief Encode the IPTC datasets from \em iptcData to a binary representation in IPTC IIM4 format.

include/exiv2/metadatum.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ namespace Exiv2 {
142142
@param byteOrder Applicable byte order (little or big endian).
143143
@return Number of characters written.
144144
*/
145-
virtual long copy(byte* buf, ByteOrder byteOrder) const =0;
145+
virtual size_t copy(byte* buf, ByteOrder byteOrder) const =0;
146146
/*!
147147
@brief Write the interpreted value to an output stream, return
148148
the stream.
@@ -187,41 +187,41 @@ namespace Exiv2 {
187187
//! Return the name of the type
188188
virtual const char* typeName() const =0;
189189
//! Return the size in bytes of one component of this type
190-
virtual long typeSize() const =0;
190+
virtual size_t typeSize() const =0;
191191
//! Return the number of components in the value
192192
virtual size_t count() const =0;
193193
//! Return the size of the value in bytes
194-
virtual long size() const =0;
194+
virtual size_t size() const =0;
195195
//! Return the value as a string.
196196
virtual std::string toString() const =0;
197197
/*!
198198
@brief Return the <EM>n</EM>-th component of the value converted to
199199
a string. The behaviour of the method is undefined if there
200200
is no <EM>n</EM>-th component.
201201
*/
202-
virtual std::string toString(long n) const =0;
202+
virtual std::string toString(size_t n) const =0;
203203
/*!
204204
@brief Return the <EM>n</EM>-th component of the value converted to int64_t.
205205
The return value is -1 if the value is not set and the behaviour
206206
of the method is undefined if there is no <EM>n</EM>-th component.
207207
*/
208-
virtual int64_t toInt64(long n =0) const =0;
208+
virtual int64_t toInt64(size_t n =0) const =0;
209209
/*!
210210
@brief Return the <EM>n</EM>-th component of the value converted to uint32_t.
211211
*/
212-
uint32_t toUint32(long n =0) const;
212+
uint32_t toUint32(size_t n =0) const;
213213
/*!
214214
@brief Return the <EM>n</EM>-th component of the value converted to float.
215215
The return value is -1 if the value is not set and the behaviour
216216
of the method is undefined if there is no <EM>n</EM>-th component.
217217
*/
218-
virtual float toFloat(long n =0) const =0;
218+
virtual float toFloat(size_t n =0) const =0;
219219
/*!
220220
@brief Return the <EM>n</EM>-th component of the value converted to Rational.
221221
The return value is -1/1 if the value is not set and the behaviour
222222
of the method is undefined if there is no <EM>n</EM>-th component.
223223
*/
224-
virtual Rational toRational(long n =0) const =0;
224+
virtual Rational toRational(size_t n =0) const =0;
225225
/*!
226226
@brief Return an auto-pointer to a copy (clone) of the value. The
227227
caller owns this copy and the auto-poiner ensures that it will

include/exiv2/orfimage.hpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,15 @@ namespace Exiv2 {
8282
with data in ORF format to the provided metadata containers.
8383
See TiffParser::decode().
8484
*/
85-
static ByteOrder decode(
86-
ExifData& exifData,
87-
IptcData& iptcData,
88-
XmpData& xmpData,
89-
const byte* pData,
90-
uint32_t size
91-
);
85+
static ByteOrder decode(ExifData& exifData, IptcData& iptcData, XmpData& xmpData, const byte* pData,
86+
size_t size);
9287
/*!
9388
@brief Encode metadata from the provided metadata to ORF format.
9489
See TiffParser::encode().
9590
*/
96-
static WriteMethod encode(
97-
BasicIo& io,
91+
static WriteMethod encode(BasicIo& io,
9892
const byte* pData,
99-
uint32_t size,
93+
size_t size,
10094
ByteOrder byteOrder,
10195
const ExifData& exifData,
10296
const IptcData& iptcData,

0 commit comments

Comments
 (0)