Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.48 KB | None | 0 0
  1. >>> f = open('gsocketinputstream.c.gcov')
  2. >>> a = f.read()
  3. >>> a
  4. '        -:    0:Source:gio/gsocketinputstream.c\n        -:    0:Graph:gst_switch_srv-gsocketinputstream.gcno\n        -:    0:Data:gst_switch_srv-gsocketinputstream.gcda\n        -:    0:Runs:15\n        -:    0:Programs:1\n        -:    1:/* GIO - GLib Input, Output and Streaming Library\n        -:    2: *\n        -:    3: * Copyright \xc2\xa9 2008 Christian Kellner, Samuel Cormier-Iijima\n        -:    4: *           \xc2\xa9 2009 codethink\n        -:    5: *\n        -:    6: * This library is free software; you can redistribute it and/or\n        -:    7: * modify it under the terms of the GNU Lesser General Public\n        -:    8: * License as published by the Free Software Foundation; either\n        -:    9: * version 2 of the License, or (at your option) any later version.\n        -:   10: *\n        -:   11: * This library is distributed in the hope that it will be useful,\n        -:   12: * but WITHOUT ANY WARRANTY; without even the implied warranty of\n        -:   13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n        -:   14: * Lesser General Public License for more details.\n        -:   15: *\n        -:   16: * You should have received a copy of the GNU Lesser General\n        -:   17: * Public License along with this library; if not, write to the\n        -:   18: * Free Software Foundation, Inc., 59 Temple Place, Suite 330,\n        -:   19: * Boston, MA 02111-1307, USA.\n        -:   20: *\n        -:   21: * Authors: Christian Kellner <gicmo@gnome.org>\n        -:   22: *          Samuel Cormier-Iijima <sciyoshi@gmail.com>\n        -:   23: *          Ryan Lortie <desrt@desrt.ca>\n        -:   24: */\n        -:   25:\n        -:   26:#include "config.h"\n        -:   27:#include <glib.h>\n        -:   28:#include <gio/gio.h>\n        -:   29:#include "gsocketinputstream.h"\n        -:   30:\n        -:   31:#define g_socket_input_stream_get_type _g_socket_input_stream_get_type\n        -:   32:\n    36783:   33:G_DEFINE_TYPE (GSocketInputStreamX, g_socket_input_stream, G_TYPE_INPUT_STREAM);\n        -:   34:\n        -:   35:enum\n        -:   36:{\n        -:   37:  PROP_0,\n        -:   38:  PROP_SOCKET\n        -:   39:};\n        -:   40:\n        -:   41:/**\n        -:   42: * @brief socket input stream private stuff\n        -:   43: * @internal\n        -:   44: */\n        -:   45:struct _GSocketInputStreamXPrivate\n        -:   46:{\n        -:   47:  GSocket *socket;\n        -:   48:\n        -:   49:  /* pending operation metadata */\n        -:   50:  GSimpleAsyncResult *result;\n        -:   51:  GCancellable *cancellable;\n        -:   52:  gpointer buffer;\n        -:   53:  gsize count;\n        -:   54:};\n        -:   55:\n        -:   56:static void\n    #####:   57:g_socket_input_stream_get_property (GObject * object,\n        -:   58:    guint prop_id, GValue * value, GParamSpec * pspec)\n        -:   59:{\n    #####:   60:  GSocketInputStreamX *stream = G_SOCKET_INPUT_STREAM (object);\n        -:   61:\n    #####:   62:  switch (prop_id) {\n        -:   63:    case PROP_SOCKET:\n    #####:   64:      g_value_set_object (value, stream->priv->socket);\n    #####:   65:      break;\n        -:   66:\n        -:   67:    default:\n    #####:   68:      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);\n        -:   69:  }\n    #####:   70:}\n        -:   71:\n        -:   72:static void\n       16:   73:g_socket_input_stream_set_property (GObject * object,\n        -:   74:    guint prop_id, const GValue * value, GParamSpec * pspec)\n        -:   75:{\n       16:   76:  GSocketInputStreamX *stream = G_SOCKET_INPUT_STREAM (object);\n        -:   77:\n       16:   78:  switch (prop_id) {\n        -:   79:    case PROP_SOCKET:\n       16:   80:      stream->priv->socket = g_value_dup_object (value);\n       16:   81:      break;\n        -:   82:\n        -:   83:    default:\n    #####:   84:      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);\n        -:   85:  }\n       16:   86:}\n        -:   87:\n        -:   88:static void\n        1:   89:g_socket_input_stream_finalize (GObject * object)\n        -:   90:{\n        1:   91:  GSocketInputStreamX *stream = G_SOCKET_INPUT_STREAM (object);\n        -:   92:\n        1:   93:  if (stream->priv->socket) {\n        1:   94:    GError *error = NULL;\n        -:   95:    /*\n        -:   96:       g_print ("%s:%d: %s, %d\\n", __FILE__, __LINE__, __FUNCTION__,\n        -:   97:       g_socket_get_fd (stream->priv->socket));\n        -:   98:     */\n        1:   99:    g_socket_close (stream->priv->socket, &error);\n        1:  100:    if (error) {\n        -:  101:      //ERROR ("%s", error->message);\n        -:  102:    }\n        1:  103:    g_object_unref (stream->priv->socket);\n        -:  104:  }\n        -:  105:\n        1:  106:  if (G_OBJECT_CLASS (g_socket_input_stream_parent_class)->finalize)\n        1:  107:    (*G_OBJECT_CLASS (g_socket_input_stream_parent_class)->finalize) (object);\n        1:  108:}\n        -:  109:\n        -:  110:static gssize\n    36710:  111:g_socket_input_stream_read (GInputStream * stream,\n        -:  112:    void *buffer, gsize count, GCancellable * cancellable, GError ** error)\n        -:  113:{\n    36710:  114:  GSocketInputStreamX *input_stream = G_SOCKET_INPUT_STREAM (stream);\n        -:  115:\n    36710:  116:  return g_socket_receive_with_blocking (input_stream->priv->socket,\n        -:  117:      buffer, count, TRUE, cancellable, error);\n        -:  118:}\n        -:  119:\n        -:  120:static void\n        8:  121:g_socket_input_stream_class_init (GSocketInputStreamXClass * klass)\n        -:  122:{\n        8:  123:  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);\n        8:  124:  GInputStreamClass *ginputstream_class = G_INPUT_STREAM_CLASS (klass);\n        -:  125:\n        8:  126:  g_type_class_add_private (klass, sizeof (GSocketInputStreamXPrivate));\n        -:  127:\n        8:  128:  gobject_class->finalize = g_socket_input_stream_finalize;\n        8:  129:  gobject_class->get_property = g_socket_input_stream_get_property;\n        8:  130:  gobject_class->set_property = g_socket_input_stream_set_property;\n        -:  131:\n        8:  132:  ginputstream_class->read_fn = g_socket_input_stream_read;\n        -:  133:\n        8:  134:  g_object_class_install_property (gobject_class, PROP_SOCKET,\n        -:  135:      g_param_spec_object ("socket",\n        -:  136:          "socket",\n        -:  137:          "The socket that this stream wraps",\n        -:  138:          G_TYPE_SOCKET, G_PARAM_CONSTRUCT_ONLY |\n        -:  139:          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));\n        8:  140:}\n        -:  141:\n        -:  142:static void\n       16:  143:g_socket_input_stream_init (GSocketInputStreamX * stream)\n        -:  144:{\n       16:  145:  stream->priv =\n       16:  146:      G_TYPE_INSTANCE_GET_PRIVATE (stream, G_TYPE_SOCKET_INPUT_STREAM,\n        -:  147:      GSocketInputStreamXPrivate);\n       16:  148:}\n        -:  149:\n        -:  150:GSocketInputStreamX *\n    #####:  151:_g_socket_input_stream_new (GSocket * socket)\n        -:  152:{\n    #####:  153:  return G_SOCKET_INPUT_STREAM (g_object_new (G_TYPE_SOCKET_INPUT_STREAM,\n        -:  154:          "socket", socket, NULL));\n        -:  155:}\n'
  5. >>> a.find(u'0xe9')
  6. Traceback (most recent call last):
  7.   File "<stdin>", line 1, in <module>
  8. UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 334: ordinal not in range(128)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement