Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7c9fe8e
Mac build and run instructions
farhadabed Jun 21, 2018
3d5dedd
Merge pull request #3 from tcullum-gpsw/fix-memory-leaks
dnewman-gpsw Jun 29, 2018
ff4667f
Merge pull request #4 from tcullum-gpsw/fix-file-handle-leaks
dnewman-gpsw Jun 29, 2018
9dd9a2f
Merge pull request #5 from farhadabed/patch-1
dnewman-gpsw Jun 29, 2018
2ce660f
Update gpr_buffer.c
dnewman-gpsw Jun 29, 2018
4036a81
Update table17.inc
dnewman-gpsw Sep 25, 2018
e39052b
GoPro HERO7 GPR sample
dnewman-gpsw Sep 26, 2018
66dc53a
Add Linux instructions ('make' vs 'make .')
KonradIT Dec 21, 2018
91dfb47
Merge pull request #10 from KonradIT/master
dnewman-gpsw Dec 21, 2018
c73d955
Add Hero5 Black GPR Sample Raw Photo
KonradIT Dec 22, 2018
7a3a1cb
Add <install> flag for CMakeList.txt, allows running'su -c make insta…
KonradIT Dec 23, 2018
cbf4df3
Revert "Add <install> flag for CMakeList.txt, allows running'su -c ma…
KonradIT Dec 23, 2018
fd95136
Merge pull request #11 from KonradIT/master
dnewman-gpsw Jan 1, 2019
17ef7cb
clean unused var and made for loop more readable
EliGitHub1 Feb 22, 2019
a60f4e1
Merge pull request #15 from EliGitHub1/argument-parser-cpp
dnewman-gpsw Mar 3, 2019
27df491
HERO9 example
dnewman-gpsw Oct 4, 2020
4d61a3b
WARNINGS: fix against set of -W options (#38)
echasseur-gpfw Apr 19, 2022
88561c0
build: update to C++20
ldomenzain-gpfw Sep 19, 2023
bcc520c
Include strings.h (#47)
noelbautista91 Jun 30, 2025
4f09b6e
Fix Windows build: strings.h and stricmp compatibility
hh-decr May 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ $ cmake ../

For Xcode, use command line switch `-G Xcode`. On Windows, CMake should automatically figure out installed version of Visual Studio and generate corresponding project files.

Mac build instructions, after running the above:
```
$ make .
$ ./source/app/gpr_tools/gpr_tools
```

Linux build instructions, after running the above:
```
$ make
$ ./source/app/gpr_tools/gpr_tools
```

## Using gpr_tools

Some example commands are shown below:
Expand Down
Binary file added data/samples/HERO7/GOPR9231.GPR
Binary file not shown.
Binary file added data/samples/HERO9/GOPR0002.GPR
Binary file not shown.
Binary file added data/samples/Hero5/GOPR2657.GPR
Binary file not shown.
3 changes: 1 addition & 2 deletions source/app/common/argument_parser/argument_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ void argument_parser::set_options()

int argument_parser::parse(int argc, char *argv [], const char* application_text, const char* prefix_text)
{
application_path = argv[0];
argument_count = argc;

for (int i = 0; i < argc; i++)
for (int i = 0; i < argument_count; i++)
arguments[i] = argv[i];

set_options();
Expand Down
7 changes: 7 additions & 0 deletions source/app/gpr_tools/main_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@
*/

#include <stdio.h>
#ifndef _WIN32
#include <strings.h>
#endif
#include <string.h>
#include <stdbool.h>

#include "gpr.h"

#if defined __GNUC__
#define stricmp strcasecmp
#elif defined _WIN32
#define stricmp _stricmp
#else
#endif // if defined __GNUC__

Expand Down Expand Up @@ -297,6 +302,8 @@ int dng_convert_main(const char* input_file_path, unsigned int input_width, uns
write_buffer_to_file = false;
#if GPR_JPEG_AVAILABLE
tje_encode_to_file( output_file_path, rgb_buffer.width, rgb_buffer.height, 3, rgb_buffer.buffer );
#elif defined _WIN32
#define stricmp _stricmp
#else
printf("JPG writing capability is disabled. You could still write to a PPM file");
#endif
Expand Down
8 changes: 5 additions & 3 deletions source/lib/common/private/gpr_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,23 @@ int read_from_file(gpr_buffer* buffer, const char* file_path, gpr_malloc malloc_
}

fseek (fIN, 0, SEEK_END);
buffer->size = (int32_t) ftell(fIN);
buffer->size = (size_t) ftell(fIN);
rewind (fIN);

buffer->buffer = malloc_function(buffer->size);

if ( buffer->buffer == NULL)
{
fputs ("Memory error", stderr);
fclose(fIN);
return -1;
}

long result = fread(buffer->buffer, 1, buffer->size, fIN);
if (result != buffer->size)
if (fread(buffer->buffer, 1, buffer->size, fIN) != buffer->size)
{
free_function(buffer->buffer);
fputs ("Reading error", stderr);
fclose(fIN);
return -1;
}

Expand All @@ -73,6 +74,7 @@ int write_to_file(const gpr_buffer* buffer, const char* file_path)
if( bytes_written != buffer->size ) {
fputs("Could not write bytes \n", stderr);
perror("fwrite()");
fclose(fOUT);
return -2;
}

Expand Down
4 changes: 2 additions & 2 deletions source/lib/common/private/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

TIMER LogTimer;

bool LogInit()
bool LogInit(void)
{
InitTimer(&LogTimer);

Expand Down Expand Up @@ -54,7 +54,7 @@ int LogPrint(const char* format, ... )
}
#endif // LogPrint

bool LogUninit()
bool LogUninit(void)
{
return true;
}
4 changes: 2 additions & 2 deletions source/lib/common/private/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
extern "C" {
#endif

bool LogInit();
bool LogInit(void);

#ifndef LogPrint
int LogPrint(const char* format, ... );
#endif

bool LogUninit();
bool LogUninit(void);

#define TIMESTAMP(x, y) TIMESTAMP_##y(x)

Expand Down
2 changes: 1 addition & 1 deletion source/lib/dng_sdk/dng_lossless_jpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,7 @@ inline void dng_lossless_decoder::HuffExtend (int32 &x, int32 s)

if (x < (0x08000 >> (16 - s)))
{
x += (-1 << s) + 1;
x += -(1 << s) + 1;
}

}
Expand Down
8 changes: 4 additions & 4 deletions source/lib/dng_sdk/dng_misc_opcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,28 @@ class dng_area_spec

/// The first plane.

const uint32 Plane () const
uint32 Plane () const
{
return fPlane;
}

/// The total number of planes.

const uint32 Planes () const
uint32 Planes () const
{
return fPlanes;
}

/// The row pitch (i.e., stride). A pitch of 1 means all rows.

const uint32 RowPitch () const
uint32 RowPitch () const
{
return fRowPitch;
}

/// The column pitch (i.e., stride). A pitch of 1 means all columns.

const uint32 ColPitch () const
uint32 ColPitch () const
{
return fColPitch;
}
Expand Down
2 changes: 1 addition & 1 deletion source/lib/dng_sdk/dng_negative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2716,7 +2716,7 @@ void dng_negative::SetFujiMosaic6x6 (uint32 phase)
info.fCFAPattern [5] [4] = color2;
info.fCFAPattern [5] [5] = color1;

DNG_REQUIRE (phase >= 0 && phase < patSize * patSize,
DNG_REQUIRE (phase < patSize * patSize,
"Bad phase in SetFujiMosaic6x6.");

if (phase > 0)
Expand Down
2 changes: 1 addition & 1 deletion source/lib/dng_sdk/dng_resample.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class dng_resample_coords
return fCoords->Buffer_int32 () + (index - fOrigin);
}

const int32 Pixel (int32 index) const
int32 Pixel (int32 index) const
{
return Coords (index) [0] >> kResampleSubsampleBits;
}
Expand Down
6 changes: 6 additions & 0 deletions source/lib/expat_lib/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
#define PTRFASTCALL __attribute__((regparm(3)))
#endif

#if defined(__GNUC__) && __GNUC__ >= 7 || defined(__clang__) && __clang_major__ >= 10
#define FALL_THROUGH __attribute__ ((fallthrough))
#else
#define FALL_THROUGH ((void)0)
#endif

/* Using __fastcall seems to have an unexpected negative effect under
MS VC++, especially for function pointers, so we won't use it for
now on that platform. It may be reconsidered for a future release
Expand Down
12 changes: 9 additions & 3 deletions source/lib/expat_lib/xmlparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
errorCode = XML_ERROR_NO_MEMORY;
return XML_STATUS_ERROR;
}
FALL_THROUGH;
default:
ps_parsing = XML_PARSING;
}
Expand All @@ -1528,6 +1529,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
case XML_INITIALIZED:
case XML_PARSING:
ps_parsing = XML_FINISHED;
FALL_THROUGH;
/* fall through */
default:
return XML_STATUS_OK;
Expand Down Expand Up @@ -1564,7 +1566,8 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
ps_parsing = XML_FINISHED;
return XML_STATUS_OK;
}
/* fall through */
FALL_THROUGH;
/* fall through */
default:
result = XML_STATUS_OK;
}
Expand Down Expand Up @@ -1628,6 +1631,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
errorCode = XML_ERROR_NO_MEMORY;
return XML_STATUS_ERROR;
}
FALL_THROUGH;
default:
ps_parsing = XML_PARSING;
}
Expand Down Expand Up @@ -2370,7 +2374,6 @@ doContent(XML_Parser parser,
break;
}
case XML_TOK_START_TAG_NO_ATTS:
/* fall through */
case XML_TOK_START_TAG_WITH_ATTS:
{
TAG *tag;
Expand Down Expand Up @@ -2439,7 +2442,6 @@ doContent(XML_Parser parser,
break;
}
case XML_TOK_EMPTY_ELEMENT_NO_ATTS:
/* fall through */
case XML_TOK_EMPTY_ELEMENT_WITH_ATTS:
{
const char *rawName = s + enc->minBytesPerChar;
Expand Down Expand Up @@ -3895,6 +3897,7 @@ doProlog(XML_Parser parser,
handleDefault = XML_FALSE;
goto alreadyChecked;
}
FALL_THROUGH;
/* fall through */
case XML_ROLE_ENTITY_PUBLIC_ID:
if (!XmlIsPublicId(enc, s, next, eventPP))
Expand Down Expand Up @@ -4197,6 +4200,7 @@ doProlog(XML_Parser parser,
return XML_ERROR_NO_MEMORY;
declEntity->publicId = NULL;
}
FALL_THROUGH;
/* fall through */
#endif /* XML_DTD */
case XML_ROLE_ENTITY_SYSTEM_ID:
Expand Down Expand Up @@ -4977,6 +4981,7 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,
break;
case XML_TOK_TRAILING_CR:
next = ptr + enc->minBytesPerChar;
FALL_THROUGH;
/* fall through */
case XML_TOK_ATTRIBUTE_VALUE_S:
case XML_TOK_DATA_NEWLINE:
Expand Down Expand Up @@ -5181,6 +5186,7 @@ storeEntityValue(XML_Parser parser,
break;
case XML_TOK_TRAILING_CR:
next = entityTextPtr + enc->minBytesPerChar;
FALL_THROUGH;
/* fall through */
case XML_TOK_DATA_NEWLINE:
if (pool->end == pool->ptr && !poolGrow(pool)) {
Expand Down
Loading