curl: Fix indention

This commit is contained in:
Sebastian Dröge 2013-12-17 12:17:51 +01:00
parent 23ab7d8c49
commit d111f37f74
2 changed files with 33 additions and 29 deletions

View file

@ -135,21 +135,19 @@ gst_curl_ftp_sink_class_init (GstCurlFtpSinkClass * klass)
"Enable the use of the EPSV command when doing passive FTP transfers", "Enable the use of the EPSV command when doing passive FTP transfers",
TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CREATE_TEMP_FILE, g_object_class_install_property (gobject_class, PROP_CREATE_TEMP_FILE,
g_param_spec_boolean ("create-tmp-file", "Enable or disable temporary file transfer", g_param_spec_boolean ("create-tmp-file", "Enable or disable temporary file transfer", "Use a temporary file name when uploading a a file. When the transfer is complete, \
"Use a temporary file name when uploading a a file. When the transfer is complete, \
this temporary file is renamed to the final file name. This is useful for ensuring \ this temporary file is renamed to the final file name. This is useful for ensuring \
that remote systems do not read a partially uploaded file", that remote systems do not read a partially uploaded file", FALSE, G_PARAM_READWRITE |
FALSE, G_PARAM_STATIC_STRINGS));
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CREATE_TEMP_FILE_NAME, g_object_class_install_property (gobject_class, PROP_CREATE_TEMP_FILE_NAME,
g_param_spec_string ("temp-file-name", "Creates a temporary file name with date and time", g_param_spec_string ("temp-file-name",
"Creates a temporary file name with date and time",
"Filename pattern to use when generating a temporary filename for uploads", "Filename pattern to use when generating a temporary filename for uploads",
NULL, NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CREATE_DIRS, g_object_class_install_property (gobject_class, PROP_CREATE_DIRS,
g_param_spec_boolean ("create-dirs", "Create missing directories", g_param_spec_boolean ("create-dirs", "Create missing directories",
"Attempt to create missing directory included in the path", "Attempt to create missing directory included in the path", FALSE,
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
} }
static void static void
@ -179,8 +177,8 @@ set_ftp_dynamic_options_unlocked (GstCurlBaseSink * basesink)
{ {
gchar *tmp = NULL; gchar *tmp = NULL;
GstCurlFtpSink *sink = GST_CURL_FTP_SINK (basesink); GstCurlFtpSink *sink = GST_CURL_FTP_SINK (basesink);
if(sink->tmpfile_create) { if (sink->tmpfile_create) {
gchar *rename_from = NULL; gchar *rename_from = NULL;
gchar *rename_to = NULL; gchar *rename_to = NULL;
gchar *uploadfile_as = NULL; gchar *uploadfile_as = NULL;
@ -189,26 +187,28 @@ set_ftp_dynamic_options_unlocked (GstCurlBaseSink * basesink)
gchar *tmpfile_name = NULL; gchar *tmpfile_name = NULL;
if (sink->headerlist != NULL) { if (sink->headerlist != NULL) {
curl_slist_free_all (sink->headerlist); curl_slist_free_all (sink->headerlist);
sink->headerlist = NULL; sink->headerlist = NULL;
} }
if (sink->tmpfile_name != NULL) { if (sink->tmpfile_name != NULL) {
tmpfile_name = g_strdup_printf ("%s", sink->tmpfile_name); tmpfile_name = g_strdup_printf ("%s", sink->tmpfile_name);
} else { } else {
tmpfile_name = g_strdup_printf (".tmp.%04X%04X", g_random_int (), g_random_int ()); tmpfile_name =
g_strdup_printf (".tmp.%04X%04X", g_random_int (), g_random_int ());
} }
rename_from = g_strdup_printf ("%s%s", RENAME_FROM, tmpfile_name); rename_from = g_strdup_printf ("%s%s", RENAME_FROM, tmpfile_name);
last_slash = strrchr (basesink->file_name, '/'); last_slash = strrchr (basesink->file_name, '/');
if (last_slash != NULL) { if (last_slash != NULL) {
dir_name = g_strndup (basesink->file_name, last_slash - basesink->file_name); dir_name =
rename_to = g_strdup_printf ("%s%s", RENAME_TO, last_slash+1); g_strndup (basesink->file_name, last_slash - basesink->file_name);
rename_to = g_strdup_printf ("%s%s", RENAME_TO, last_slash + 1);
uploadfile_as = g_strdup_printf ("%s/%s", dir_name, tmpfile_name); uploadfile_as = g_strdup_printf ("%s/%s", dir_name, tmpfile_name);
} else { } else {
rename_to = g_strdup_printf ("%s%s", RENAME_TO, basesink->file_name); rename_to = g_strdup_printf ("%s%s", RENAME_TO, basesink->file_name);
uploadfile_as = g_strdup_printf ("%s", tmpfile_name); uploadfile_as = g_strdup_printf ("%s", tmpfile_name);
} }
tmp = g_strdup_printf ("%s%s", basesink->url, uploadfile_as); tmp = g_strdup_printf ("%s%s", basesink->url, uploadfile_as);
@ -222,7 +222,7 @@ set_ftp_dynamic_options_unlocked (GstCurlBaseSink * basesink)
g_free (uploadfile_as); g_free (uploadfile_as);
g_free (dir_name); g_free (dir_name);
g_free (tmpfile_name); g_free (tmpfile_name);
if(last_slash != NULL) { if (last_slash != NULL) {
*last_slash = '\0'; *last_slash = '\0';
} }
} else { } else {
@ -302,13 +302,14 @@ gst_curl_ftp_sink_set_property (GObject * object, guint prop_id,
break; break;
case PROP_CREATE_TEMP_FILE: case PROP_CREATE_TEMP_FILE:
sink->tmpfile_create = g_value_get_boolean (value); sink->tmpfile_create = g_value_get_boolean (value);
GST_DEBUG_OBJECT (sink, "create-tmp-file set to %d", sink->tmpfile_create); GST_DEBUG_OBJECT (sink, "create-tmp-file set to %d",
sink->tmpfile_create);
break; break;
case PROP_CREATE_TEMP_FILE_NAME: case PROP_CREATE_TEMP_FILE_NAME:
g_free (sink->tmpfile_name); g_free (sink->tmpfile_name);
sink->tmpfile_name = g_value_dup_string (value); sink->tmpfile_name = g_value_dup_string (value);
GST_DEBUG_OBJECT (sink, "tmp-file-name set to %s", sink->tmpfile_name); GST_DEBUG_OBJECT (sink, "tmp-file-name set to %s", sink->tmpfile_name);
break; break;
case PROP_CREATE_DIRS: case PROP_CREATE_DIRS:
sink->create_dirs = g_value_get_boolean (value); sink->create_dirs = g_value_get_boolean (value);
GST_DEBUG_OBJECT (sink, "create-dirs set to %d", sink->create_dirs); GST_DEBUG_OBJECT (sink, "create-dirs set to %d", sink->create_dirs);
@ -344,7 +345,7 @@ gst_curl_ftp_sink_get_property (GObject * object, guint prop_id,
break; break;
case PROP_CREATE_TEMP_FILE_NAME: case PROP_CREATE_TEMP_FILE_NAME:
g_value_set_string (value, sink->tmpfile_name); g_value_set_string (value, sink->tmpfile_name);
break; break;
case PROP_CREATE_DIRS: case PROP_CREATE_DIRS:
g_value_set_boolean (value, sink->create_dirs); g_value_set_boolean (value, sink->create_dirs);
break; break;

View file

@ -122,7 +122,8 @@ static gboolean gst_curl_smtp_sink_prepare_transfer (GstCurlBaseSink * bcsink);
static size_t gst_curl_smtp_sink_transfer_data_buffer (GstCurlBaseSink * sink, static size_t gst_curl_smtp_sink_transfer_data_buffer (GstCurlBaseSink * sink,
void *curl_ptr, size_t block_size, guint * last_chunk); void *curl_ptr, size_t block_size, guint * last_chunk);
static size_t gst_curl_smtp_sink_flush_data_unlocked (GstCurlBaseSink * bcsink, static size_t gst_curl_smtp_sink_flush_data_unlocked (GstCurlBaseSink * bcsink,
void *curl_ptr, size_t block_size, gboolean new_file, gboolean close_transfer); void *curl_ptr, size_t block_size, gboolean new_file,
gboolean close_transfer);
/* private functions */ /* private functions */
@ -750,14 +751,16 @@ gst_curl_smtp_sink_flush_data_unlocked (GstCurlBaseSink * bcsink,
gint len; gint len;
gchar *data_out; gchar *data_out;
GST_DEBUG ("live: %d, num attachments: %d, num attachments_left: %d, eos: %d, " GST_DEBUG
("live: %d, num attachments: %d, num attachments_left: %d, eos: %d, "
"close_transfer: %d, final boundary: %d, array_len: %d", bcsink->is_live, "close_transfer: %d, final boundary: %d, array_len: %d", bcsink->is_live,
sink->nbr_attachments, sink->nbr_attachments_left, sink->eos, close_transfer, sink->nbr_attachments, sink->nbr_attachments_left, sink->eos,
sink->final_boundary_added, array->len); close_transfer, sink->final_boundary_added, array->len);
if ((bcsink->is_live && (sink->nbr_attachments_left == sink->nbr_attachments)) if ((bcsink->is_live && (sink->nbr_attachments_left == sink->nbr_attachments))
|| (sink->nbr_attachments == 1) || sink->eos || sink->final_boundary_added) { || (sink->nbr_attachments == 1) || sink->eos
|| sink->final_boundary_added) {
bcsink->is_live = FALSE; bcsink->is_live = FALSE;
sink->reset_transfer_options = TRUE; sink->reset_transfer_options = TRUE;
sink->final_boundary_added = FALSE; sink->final_boundary_added = FALSE;