Commit e3597e64 authored by Max Kellermann's avatar Max Kellermann

archive/bz2: fixed indentation

parent 357037f7
...@@ -48,7 +48,6 @@ typedef struct { ...@@ -48,7 +48,6 @@ typedef struct {
char *buffer; char *buffer;
} bz2_context; } bz2_context;
static const struct input_plugin bz2_inputplugin; static const struct input_plugin bz2_inputplugin;
/* single archive handling allocation helpers */ /* single archive handling allocation helpers */
...@@ -85,7 +84,7 @@ bz2_destroy(bz2_context *data) ...@@ -85,7 +84,7 @@ bz2_destroy(bz2_context *data)
/* archive open && listing routine */ /* archive open && listing routine */
static struct archive_file * static struct archive_file *
bz2_open(char * pathname) bz2_open(char *pathname)
{ {
bz2_context *context; bz2_context *context;
char *name; char *name;
...@@ -99,6 +98,7 @@ bz2_open(char * pathname) ...@@ -99,6 +98,7 @@ bz2_open(char * pathname)
g_free(context); g_free(context);
return NULL; return NULL;
} }
//capture filename //capture filename
name = strrchr(pathname, '/'); name = strrchr(pathname, '/');
if (name == NULL) { if (name == NULL) {
...@@ -106,12 +106,15 @@ bz2_open(char * pathname) ...@@ -106,12 +106,15 @@ bz2_open(char * pathname)
g_free(context); g_free(context);
return NULL; return NULL;
} }
context->name = g_strdup(name+1);
context->name = g_strdup(name + 1);
//remove suffix //remove suffix
len = strlen(context->name); len = strlen(context->name);
if (len > 4) { if (len > 4) {
context->name[len-4] = 0; //remove .bz2 suffix context->name[len - 4] = 0; //remove .bz2 suffix
} }
return (struct archive_file *) context; return (struct archive_file *) context;
} }
...@@ -127,10 +130,12 @@ bz2_scan_next(struct archive_file *file) ...@@ -127,10 +130,12 @@ bz2_scan_next(struct archive_file *file)
{ {
bz2_context *context = (bz2_context *) file; bz2_context *context = (bz2_context *) file;
char *name = NULL; char *name = NULL;
if (context->reset) { if (context->reset) {
name = context->name; name = context->name;
context->reset = false; context->reset = false;
} }
return name; return name;
} }
...@@ -138,6 +143,7 @@ static void ...@@ -138,6 +143,7 @@ static void
bz2_close(struct archive_file *file) bz2_close(struct archive_file *file)
{ {
bz2_context *context = (bz2_context *) file; bz2_context *context = (bz2_context *) file;
if (context->name) if (context->name)
g_free(context->name); g_free(context->name);
...@@ -152,6 +158,7 @@ bz2_open_stream(struct archive_file *file, struct input_stream *is, ...@@ -152,6 +158,7 @@ bz2_open_stream(struct archive_file *file, struct input_stream *is,
G_GNUC_UNUSED const char *path) G_GNUC_UNUSED const char *path)
{ {
bz2_context *context = (bz2_context *) file; bz2_context *context = (bz2_context *) file;
//setup file ops //setup file ops
is->plugin = &bz2_inputplugin; is->plugin = &bz2_inputplugin;
//insert back reference //insert back reference
...@@ -162,6 +169,7 @@ bz2_open_stream(struct archive_file *file, struct input_stream *is, ...@@ -162,6 +169,7 @@ bz2_open_stream(struct archive_file *file, struct input_stream *is,
g_warning("alloc bz2 failed\n"); g_warning("alloc bz2 failed\n");
return false; return false;
} }
return true; return true;
} }
...@@ -174,8 +182,7 @@ bz2_is_close(struct input_stream *is) ...@@ -174,8 +182,7 @@ bz2_is_close(struct input_stream *is)
} }
static int static int
bz2_fillbuffer(bz2_context *context, bz2_fillbuffer(bz2_context *context, size_t numBytes)
size_t numBytes)
{ {
size_t count; size_t count;
bz_stream *bzstream; bz_stream *bzstream;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment