fixed the SPACE_LEFT macro to not underflow, suggested by Axel

https://github.com/gphoto/libgphoto2/pull/113
This commit is contained in:
Marcus Meissner
2016-12-23 18:44:19 +01:00
parent 4652791d91
commit c6826e39b4

View File

@@ -5173,7 +5173,7 @@ camera_summary (Camera* camera, CameraText* summary, GPContext *context)
txt = summary->text;
#define SPACE_LEFT (summary->text + sizeof (summary->text) - txt)
#define SPACE_LEFT max(0, summary->text + sizeof (summary->text) - txt)
#define APPEND_TXT( ... ) txt += snprintf (txt, SPACE_LEFT, __VA_ARGS__)
APPEND_TXT (_("Manufacturer: %s\n"),params->deviceinfo.Manufacturer);