-- 
Best regards,
Guido
From da7da14097aedb7a825ef54fa061826f2d5996f0 Mon Sep 17 00:00:00 2001
From: Guido Lerch <[email protected]>
Date: Tue, 13 Oct 2015 11:16:48 +0200
Subject: [PATCH 5/5] Adding image management fixing stupid bug

This patch fixes a stupic bug I introduced not handling strings
appropriately.

Signed-off-by: Guido Lerch <[email protected]>
---
 dive.c           |  7 +++----
 qt-ui/maintab.ui | 18 +++++++++---------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/dive.c b/dive.c
index 4e6ef76..69b54c1 100644
--- a/dive.c
+++ b/dive.c
@@ -3297,12 +3297,12 @@ bool picture_check_valid(char *filename, int shift_time)
 
 void dive_create_picture(struct dive *dive, char *filename, int shift_time, 
bool match_all)
 {
-       char *new_filename;
+       char new_filename[256];
        if (prefs.manage_images && strcmp(prefs.image_location,"") && 
dir_exists(prefs.image_location)) {
                copy_image_and_overwrite(filename, prefs.image_location, 
get_file_name(filename));
-               new_filename = 
strdup(strcat(prefs.image_location,get_file_name(filename)));
+               sprintf(new_filename,"%s/%s", prefs.image_location, 
get_file_name(filename));
        } else {
-               new_filename = strdup(filename);
+               sprintf(new_filename, "%s", filename);
        }
        timestamp_t timestamp = picture_get_timestamp(filename);
        if (!new_picture_for_dive(dive, filename))
@@ -3317,7 +3317,6 @@ void dive_create_picture(struct dive *dive, char 
*filename, int shift_time, bool
 
        dive_add_picture(dive, picture);
        dive_set_geodata_from_picture(dive, picture);
-       free(new_filename);
 }
 
 void dive_add_picture(struct dive *dive, struct picture *newpic)
diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui
index 2c515a2..765f111 100644
--- a/qt-ui/maintab.ui
+++ b/qt-ui/maintab.ui
@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="currentIndex">
-   <number>0</number>
+   <number>4</number>
   </property>
   <widget class="QWidget" name="notesTab">
    <attribute name="title">
@@ -55,8 +55,8 @@
         <rect>
          <x>0</x>
          <y>0</y>
-         <width>445</width>
-         <height>726</height>
+         <width>447</width>
+         <height>766</height>
         </rect>
        </property>
        <layout class="QVBoxLayout" name="verticalLayout_3">
@@ -525,8 +525,8 @@
         <rect>
          <x>0</x>
          <y>0</y>
-         <width>70</width>
-         <height>16</height>
+         <width>447</width>
+         <height>756</height>
         </rect>
        </property>
        <layout class="QGridLayout" name="equipmentTabScrollAreaLayout">
@@ -620,8 +620,8 @@
         <rect>
          <x>0</x>
          <y>0</y>
-         <width>287</width>
-         <height>320</height>
+         <width>447</width>
+         <height>756</height>
         </rect>
        </property>
        <layout class="QGridLayout" name="diveInfoScrollAreaLayout">
@@ -961,8 +961,8 @@
         <rect>
          <x>0</x>
          <y>0</y>
-         <width>297</width>
-         <height>187</height>
+         <width>447</width>
+         <height>756</height>
         </rect>
        </property>
        <layout class="QHBoxLayout" name="horizontalLayout">
-- 
2.3.8 (Apple Git-58)

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to