Stopped printing some values as int in exif_entry_get_value
[platform/upstream/libexif.git] / libexif / exif-mnote-data.c
index 5b84d4e..248056e 100644 (file)
@@ -1,6 +1,6 @@
 /* exif-mnote-data.c
  *
- * Copyright (C) 2003 Lutz MΓΌller <lutz@users.sourceforge.net>
+ * Copyright (C) 2003 Lutz Mueller <lutz@users.sourceforge.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301  USA.
  */
 
 #include <config.h>
-#include "exif-mnote-data.h"
-#include "exif-mnote-data-priv.h"
+
+#include <libexif/exif-mnote-data.h>
+#include <libexif/exif-mnote-data-priv.h>
 
 #include <stdlib.h>
 #include <string.h>
@@ -31,14 +32,17 @@ struct _ExifMnoteDataPriv
 };
 
 void
-exif_mnote_data_construct (ExifMnoteData *d)
+exif_mnote_data_construct (ExifMnoteData *d, ExifMem *mem)
 {
-       if (!d) return;
+       if (!d || !mem) return;
        if (d->priv) return;
-       d->priv = malloc (sizeof (ExifMnoteDataPriv));
+       d->priv = exif_mem_alloc (mem, sizeof (ExifMnoteDataPriv));
        if (!d->priv) return;
-       memset (d->priv, 0, sizeof (ExifMnoteDataPriv));
+
        d->priv->ref_count = 1;
+
+       d->mem = mem;
+       exif_mem_ref (mem);
 }
 
 void
@@ -50,12 +54,17 @@ exif_mnote_data_ref (ExifMnoteData *d)
 static void
 exif_mnote_data_free (ExifMnoteData *d)
 {
+       ExifMem *mem = d ? d->mem : NULL;
+
        if (!d) return;
        if (d->priv) {
                if (d->methods.free) d->methods.free (d);
-               free (d->priv);
+               exif_mem_free (mem, d->priv);
                d->priv = NULL;
        }
+       exif_log_unref (d->log);
+       exif_mem_free (mem, d);
+       exif_mem_unref (mem);
 }
 
 void
@@ -104,6 +113,13 @@ exif_mnote_data_count (ExifMnoteData *d)
        return d->methods.count (d);
 }
 
+unsigned int
+exif_mnote_data_get_id (ExifMnoteData *d, unsigned int n)
+{
+       if (!d || !d->methods.get_id) return 0;
+       return d->methods.get_id (d, n);
+}
+
 const char *
 exif_mnote_data_get_name (ExifMnoteData *d, unsigned int n)
 {